From 527e82031e9856eb384accc1ef8ab07290db97a8 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Fri, 6 Mar 2026 18:55:18 +0000 Subject: [PATCH] Remove a bunch of generated bob, add feature and review tasks --- db/bobgen.yaml | 26 +- db/dberrors/feature.bob.go | 17 + db/dberrors/feature_pool.bob.go | 17 + db/dberrors/pool.bob.go | 17 - db/dberrors/review_task.bob.go | 17 + db/dberrors/review_task_pool.bob.go | 17 + db/dbinfo/{pool.bob.go => feature.bob.go} | 110 +- db/dbinfo/feature_pool.bob.go | 137 + db/dbinfo/review_task.bob.go | 177 + db/dbinfo/review_task_pool.bob.go | 147 + db/dbinfo/signal_pool.bob.go | 98 - db/factory/address.bob.go | 935 --- db/factory/arcgis.account.bob.go | 1069 --- db/factory/arcgis.address_mapping.bob.go | 570 -- db/factory/arcgis.layer.bob.go | 500 -- db/factory/arcgis.layer_field.bob.go | 636 -- db/factory/arcgis.oauth_token.bob.go | 945 --- db/factory/arcgis.parcel_mapping.bob.go | 570 -- db/factory/arcgis.service_feature.bob.go | 693 -- db/factory/arcgis.service_map.bob.go | 501 -- db/factory/arcgis.user_.bob.go | 984 --- db/factory/arcgis.user_privilege.bob.go | 369 - db/factory/bobfactory_context.bob.go | 546 -- db/factory/bobfactory_main.bob.go | 5388 --------------- db/factory/bobfactory_random.bob.go | 494 -- db/factory/comms.email_contact.bob.go | 821 --- db/factory/comms.email_log.bob.go | 848 --- db/factory/comms.email_template.bob.go | 672 -- db/factory/comms.mailer.bob.go | 564 -- db/factory/comms.phone.bob.go | 1209 ---- db/factory/comms.text_job.bob.go | 607 -- db/factory/comms.text_log.bob.go | 803 --- db/factory/compliance_report_request.bob.go | 648 -- .../compliance_report_request_mailer.bob.go | 260 - db/factory/district_subscription_email.bob.go | 431 -- db/factory/district_subscription_phone.bob.go | 431 -- db/factory/fieldseeker.containerrelate.bob.go | 1309 ---- .../fieldseeker.fieldscoutinglog.bob.go | 1123 ---- db/factory/fieldseeker.habitatrelate.bob.go | 1185 ---- .../fieldseeker.inspectionsample.bob.go | 1309 ---- .../fieldseeker.inspectionsampledetail.bob.go | 1991 ------ db/factory/fieldseeker.linelocation.bob.go | 3417 ---------- .../fieldseeker.locationtracking.bob.go | 1185 ---- .../fieldseeker.mosquitoinspection.bob.go | 3975 ----------- db/factory/fieldseeker.pointlocation.bob.go | 3227 --------- db/factory/fieldseeker.polygonlocation.bob.go | 3045 --------- db/factory/fieldseeker.pool.bob.go | 2177 ------ db/factory/fieldseeker.pooldetail.bob.go | 1309 ---- .../fieldseeker.proposedtreatmentarea.bob.go | 2487 ------- .../fieldseeker.qamosquitoinspection.bob.go | 4285 ------------ db/factory/fieldseeker.rodentlocation.bob.go | 2301 ------- .../fieldseeker.samplecollection.bob.go | 3293 --------- db/factory/fieldseeker.samplelocation.bob.go | 1929 ------ db/factory/fieldseeker.servicerequest.bob.go | 5831 ---------------- .../fieldseeker.speciesabundance.bob.go | 2239 ------- db/factory/fieldseeker.stormdrain.bob.go | 1619 ----- db/factory/fieldseeker.timecard.bob.go | 2177 ------ db/factory/fieldseeker.trapdata.bob.go | 3103 --------- db/factory/fieldseeker.traplocation.bob.go | 2359 ------- db/factory/fieldseeker.treatment.bob.go | 3847 ----------- db/factory/fieldseeker.treatmentarea.bob.go | 1557 ----- db/factory/fieldseeker.zones.bob.go | 1309 ---- db/factory/fieldseeker.zones2.bob.go | 1247 ---- db/factory/fieldseeker_sync.bob.go | 538 -- db/factory/fileupload.csv.bob.go | 651 -- db/factory/fileupload.error_csv.bob.go | 497 -- db/factory/fileupload.error_file.bob.go | 409 -- db/factory/fileupload.file.bob.go | 1168 ---- db/factory/fileupload.pool.bob.go | 1596 ----- db/factory/geography_columns.bob.go | 500 -- db/factory/geometry_columns.bob.go | 500 -- db/factory/goose_db_version.bob.go | 380 -- db/factory/h3_aggregation.bob.go | 606 -- db/factory/lead.bob.go | 841 --- db/factory/note_audio.bob.go | 1082 --- db/factory/note_audio_breadcrumb.bob.go | 549 -- db/factory/note_audio_data.bob.go | 462 -- db/factory/note_image.bob.go | 932 --- db/factory/note_image_breadcrumb.bob.go | 549 -- db/factory/note_image_data.bob.go | 462 -- db/factory/notification.bob.go | 607 -- db/factory/organization.bob.go | 5950 ----------------- db/factory/parcel.bob.go | 512 -- db/factory/pool.bob.go | 739 -- db/factory/publicreport.image.bob.go | 971 --- db/factory/publicreport.image_exif.bob.go | 413 -- .../publicreport.notify_email_nuisance.bob.go | 542 -- .../publicreport.notify_email_pool.bob.go | 542 -- .../publicreport.notify_phone_nuisance.bob.go | 542 -- .../publicreport.notify_phone_pool.bob.go | 542 -- db/factory/publicreport.nuisance.bob.go | 2204 ------ db/factory/publicreport.nuisance_image.bob.go | 431 -- db/factory/publicreport.pool.bob.go | 2106 ------ db/factory/publicreport.pool_image.bob.go | 431 -- db/factory/publicreport.quick.bob.go | 904 --- db/factory/publicreport.quick_image.bob.go | 431 -- .../publicreport.report_location.bob.go | 502 -- .../publicreport.subscribe_email.bob.go | 474 -- .../publicreport.subscribe_phone.bob.go | 474 -- db/factory/raster_columns.bob.go | 1081 --- db/factory/raster_overviews.bob.go | 616 -- db/factory/resident.bob.go | 845 --- db/factory/sessions.bob.go | 344 - db/factory/signal.bob.go | 926 --- db/factory/signal_pool.bob.go | 262 - db/factory/site.bob.go | 1380 ---- db/factory/spatial_ref_sys.bob.go | 505 -- db/factory/user_.bob.go | 2423 ------- db/migrations/00089_feature.sql | 36 + db/migrations/00090_review_task.sql | 20 + db/models/address.bob.go | 216 - db/models/arcgis.account.bob.go | 368 - db/models/arcgis.address_mapping.bob.go | 45 - db/models/arcgis.layer.bob.go | 141 - db/models/arcgis.layer_field.bob.go | 220 - db/models/arcgis.oauth_token.bob.go | 45 - db/models/arcgis.parcel_mapping.bob.go | 45 - db/models/arcgis.service_feature.bob.go | 216 - db/models/arcgis.service_map.bob.go | 30 - db/models/arcgis.user_.bob.go | 140 - db/models/arcgis.user_privilege.bob.go | 30 - db/models/bob_counts.bob.go | 244 - db/models/bob_joins.bob.go | 244 - db/models/bob_loaders.bob.go | 24 +- db/models/bob_where.bob.go | 18 +- db/models/comms.email_contact.bob.go | 441 -- db/models/comms.email_log.bob.go | 45 - db/models/comms.email_template.bob.go | 125 - db/models/comms.mailer.bob.go | 152 - db/models/comms.phone.bob.go | 821 --- db/models/comms.text_job.bob.go | 30 - db/models/comms.text_log.bob.go | 45 - db/models/compliance_report_request.bob.go | 167 - .../compliance_report_request_mailer.bob.go | 45 - db/models/district_subscription_email.bob.go | 45 - db/models/district_subscription_phone.bob.go | 45 - db/models/feature.bob.go | 1198 ++++ db/models/feature_pool.bob.go | 803 +++ db/models/fieldseeker.containerrelate.bob.go | 30 - db/models/fieldseeker.fieldscoutinglog.bob.go | 30 - db/models/fieldseeker.habitatrelate.bob.go | 30 - db/models/fieldseeker.inspectionsample.bob.go | 30 - .../fieldseeker.inspectionsampledetail.bob.go | 30 - db/models/fieldseeker.linelocation.bob.go | 30 - db/models/fieldseeker.locationtracking.bob.go | 30 - .../fieldseeker.mosquitoinspection.bob.go | 30 - db/models/fieldseeker.pointlocation.bob.go | 30 - db/models/fieldseeker.polygonlocation.bob.go | 30 - db/models/fieldseeker.pool.bob.go | 30 - db/models/fieldseeker.pooldetail.bob.go | 30 - .../fieldseeker.proposedtreatmentarea.bob.go | 30 - .../fieldseeker.qamosquitoinspection.bob.go | 30 - db/models/fieldseeker.rodentlocation.bob.go | 30 - db/models/fieldseeker.samplecollection.bob.go | 30 - db/models/fieldseeker.samplelocation.bob.go | 30 - db/models/fieldseeker.servicerequest.bob.go | 30 - db/models/fieldseeker.speciesabundance.bob.go | 30 - db/models/fieldseeker.stormdrain.bob.go | 30 - db/models/fieldseeker.timecard.bob.go | 30 - db/models/fieldseeker.trapdata.bob.go | 30 - db/models/fieldseeker.traplocation.bob.go | 30 - db/models/fieldseeker.treatment.bob.go | 30 - db/models/fieldseeker.treatmentarea.bob.go | 30 - db/models/fieldseeker.zones.bob.go | 30 - db/models/fieldseeker.zones2.bob.go | 30 - db/models/fieldseeker_sync.bob.go | 30 - db/models/fileupload.csv.bob.go | 216 - db/models/fileupload.error_csv.bob.go | 30 - db/models/fileupload.error_file.bob.go | 30 - db/models/fileupload.file.bob.go | 261 - db/models/fileupload.pool.bob.go | 75 - db/models/h3_aggregation.bob.go | 30 - db/models/lead.bob.go | 170 - db/models/note_audio.bob.go | 248 - db/models/note_audio_breadcrumb.bob.go | 30 - db/models/note_audio_data.bob.go | 30 - db/models/note_image.bob.go | 248 - db/models/note_image_breadcrumb.bob.go | 30 - db/models/note_image_data.bob.go | 30 - db/models/notification.bob.go | 30 - db/models/organization.bob.go | 3726 +---------- db/models/parcel.bob.go | 125 - db/models/pool.bob.go | 1136 ---- db/models/publicreport.image.bob.go | 387 -- db/models/publicreport.image_exif.bob.go | 30 - .../publicreport.notify_email_nuisance.bob.go | 45 - .../publicreport.notify_email_pool.bob.go | 45 - .../publicreport.notify_phone_nuisance.bob.go | 45 - .../publicreport.notify_phone_pool.bob.go | 45 - db/models/publicreport.nuisance.bob.go | 304 - db/models/publicreport.nuisance_image.bob.go | 45 - db/models/publicreport.pool.bob.go | 304 - db/models/publicreport.pool_image.bob.go | 45 - db/models/publicreport.quick.bob.go | 152 - db/models/publicreport.quick_image.bob.go | 45 - db/models/publicreport.subscribe_email.bob.go | 30 - db/models/publicreport.subscribe_phone.bob.go | 30 - db/models/resident.bob.go | 75 - db/models/review_task.bob.go | 1170 ++++ db/models/review_task_pool.bob.go | 785 +++ db/models/signal.bob.go | 286 +- db/models/signal_pool.bob.go | 478 -- db/models/site.bob.go | 700 +- db/models/user_.bob.go | 2074 ++---- .../{review-root.html => review/root.html} | 0 platform/csv/csv.go | 51 +- 206 files changed, 5761 insertions(+), 141269 deletions(-) create mode 100644 db/dberrors/feature.bob.go create mode 100644 db/dberrors/feature_pool.bob.go delete mode 100644 db/dberrors/pool.bob.go create mode 100644 db/dberrors/review_task.bob.go create mode 100644 db/dberrors/review_task_pool.bob.go rename db/dbinfo/{pool.bob.go => feature.bob.go} (55%) create mode 100644 db/dbinfo/feature_pool.bob.go create mode 100644 db/dbinfo/review_task.bob.go create mode 100644 db/dbinfo/review_task_pool.bob.go delete mode 100644 db/dbinfo/signal_pool.bob.go delete mode 100644 db/factory/address.bob.go delete mode 100644 db/factory/arcgis.account.bob.go delete mode 100644 db/factory/arcgis.address_mapping.bob.go delete mode 100644 db/factory/arcgis.layer.bob.go delete mode 100644 db/factory/arcgis.layer_field.bob.go delete mode 100644 db/factory/arcgis.oauth_token.bob.go delete mode 100644 db/factory/arcgis.parcel_mapping.bob.go delete mode 100644 db/factory/arcgis.service_feature.bob.go delete mode 100644 db/factory/arcgis.service_map.bob.go delete mode 100644 db/factory/arcgis.user_.bob.go delete mode 100644 db/factory/arcgis.user_privilege.bob.go delete mode 100644 db/factory/bobfactory_context.bob.go delete mode 100644 db/factory/bobfactory_main.bob.go delete mode 100644 db/factory/bobfactory_random.bob.go delete mode 100644 db/factory/comms.email_contact.bob.go delete mode 100644 db/factory/comms.email_log.bob.go delete mode 100644 db/factory/comms.email_template.bob.go delete mode 100644 db/factory/comms.mailer.bob.go delete mode 100644 db/factory/comms.phone.bob.go delete mode 100644 db/factory/comms.text_job.bob.go delete mode 100644 db/factory/comms.text_log.bob.go delete mode 100644 db/factory/compliance_report_request.bob.go delete mode 100644 db/factory/compliance_report_request_mailer.bob.go delete mode 100644 db/factory/district_subscription_email.bob.go delete mode 100644 db/factory/district_subscription_phone.bob.go delete mode 100644 db/factory/fieldseeker.containerrelate.bob.go delete mode 100644 db/factory/fieldseeker.fieldscoutinglog.bob.go delete mode 100644 db/factory/fieldseeker.habitatrelate.bob.go delete mode 100644 db/factory/fieldseeker.inspectionsample.bob.go delete mode 100644 db/factory/fieldseeker.inspectionsampledetail.bob.go delete mode 100644 db/factory/fieldseeker.linelocation.bob.go delete mode 100644 db/factory/fieldseeker.locationtracking.bob.go delete mode 100644 db/factory/fieldseeker.mosquitoinspection.bob.go delete mode 100644 db/factory/fieldseeker.pointlocation.bob.go delete mode 100644 db/factory/fieldseeker.polygonlocation.bob.go delete mode 100644 db/factory/fieldseeker.pool.bob.go delete mode 100644 db/factory/fieldseeker.pooldetail.bob.go delete mode 100644 db/factory/fieldseeker.proposedtreatmentarea.bob.go delete mode 100644 db/factory/fieldseeker.qamosquitoinspection.bob.go delete mode 100644 db/factory/fieldseeker.rodentlocation.bob.go delete mode 100644 db/factory/fieldseeker.samplecollection.bob.go delete mode 100644 db/factory/fieldseeker.samplelocation.bob.go delete mode 100644 db/factory/fieldseeker.servicerequest.bob.go delete mode 100644 db/factory/fieldseeker.speciesabundance.bob.go delete mode 100644 db/factory/fieldseeker.stormdrain.bob.go delete mode 100644 db/factory/fieldseeker.timecard.bob.go delete mode 100644 db/factory/fieldseeker.trapdata.bob.go delete mode 100644 db/factory/fieldseeker.traplocation.bob.go delete mode 100644 db/factory/fieldseeker.treatment.bob.go delete mode 100644 db/factory/fieldseeker.treatmentarea.bob.go delete mode 100644 db/factory/fieldseeker.zones.bob.go delete mode 100644 db/factory/fieldseeker.zones2.bob.go delete mode 100644 db/factory/fieldseeker_sync.bob.go delete mode 100644 db/factory/fileupload.csv.bob.go delete mode 100644 db/factory/fileupload.error_csv.bob.go delete mode 100644 db/factory/fileupload.error_file.bob.go delete mode 100644 db/factory/fileupload.file.bob.go delete mode 100644 db/factory/fileupload.pool.bob.go delete mode 100644 db/factory/geography_columns.bob.go delete mode 100644 db/factory/geometry_columns.bob.go delete mode 100644 db/factory/goose_db_version.bob.go delete mode 100644 db/factory/h3_aggregation.bob.go delete mode 100644 db/factory/lead.bob.go delete mode 100644 db/factory/note_audio.bob.go delete mode 100644 db/factory/note_audio_breadcrumb.bob.go delete mode 100644 db/factory/note_audio_data.bob.go delete mode 100644 db/factory/note_image.bob.go delete mode 100644 db/factory/note_image_breadcrumb.bob.go delete mode 100644 db/factory/note_image_data.bob.go delete mode 100644 db/factory/notification.bob.go delete mode 100644 db/factory/organization.bob.go delete mode 100644 db/factory/parcel.bob.go delete mode 100644 db/factory/pool.bob.go delete mode 100644 db/factory/publicreport.image.bob.go delete mode 100644 db/factory/publicreport.image_exif.bob.go delete mode 100644 db/factory/publicreport.notify_email_nuisance.bob.go delete mode 100644 db/factory/publicreport.notify_email_pool.bob.go delete mode 100644 db/factory/publicreport.notify_phone_nuisance.bob.go delete mode 100644 db/factory/publicreport.notify_phone_pool.bob.go delete mode 100644 db/factory/publicreport.nuisance.bob.go delete mode 100644 db/factory/publicreport.nuisance_image.bob.go delete mode 100644 db/factory/publicreport.pool.bob.go delete mode 100644 db/factory/publicreport.pool_image.bob.go delete mode 100644 db/factory/publicreport.quick.bob.go delete mode 100644 db/factory/publicreport.quick_image.bob.go delete mode 100644 db/factory/publicreport.report_location.bob.go delete mode 100644 db/factory/publicreport.subscribe_email.bob.go delete mode 100644 db/factory/publicreport.subscribe_phone.bob.go delete mode 100644 db/factory/raster_columns.bob.go delete mode 100644 db/factory/raster_overviews.bob.go delete mode 100644 db/factory/resident.bob.go delete mode 100644 db/factory/sessions.bob.go delete mode 100644 db/factory/signal.bob.go delete mode 100644 db/factory/signal_pool.bob.go delete mode 100644 db/factory/site.bob.go delete mode 100644 db/factory/spatial_ref_sys.bob.go delete mode 100644 db/factory/user_.bob.go create mode 100644 db/migrations/00089_feature.sql create mode 100644 db/migrations/00090_review_task.sql delete mode 100644 db/models/bob_counts.bob.go delete mode 100644 db/models/bob_joins.bob.go create mode 100644 db/models/feature.bob.go create mode 100644 db/models/feature_pool.bob.go delete mode 100644 db/models/pool.bob.go create mode 100644 db/models/review_task.bob.go create mode 100644 db/models/review_task_pool.bob.go delete mode 100644 db/models/signal_pool.bob.go rename html/template/sync/{review-root.html => review/root.html} (100%) diff --git a/db/bobgen.yaml b/db/bobgen.yaml index 1e9cf27d..c65e2027 100644 --- a/db/bobgen.yaml +++ b/db/bobgen.yaml @@ -28,4 +28,28 @@ psql: queries: - ./sql uuid_pkg: google -plugins_preset: "all" +plugins: + counts: + disabled: true + dbinfo: + destination: "dbinfo" + disabled: false + pkgname: "dbinfo" + enums: + destination: "enums" + disabled: false + pkgname: "enums" + factory: + disabled: true + pkgname: "factory" + destination: "factory" + joins: + disabled: true + loaders: + disabled: false + models: + destination: "models" + disabled: false + pkgname: "models" + where: + disabled: false diff --git a/db/dberrors/feature.bob.go b/db/dberrors/feature.bob.go new file mode 100644 index 00000000..2e76b234 --- /dev/null +++ b/db/dberrors/feature.bob.go @@ -0,0 +1,17 @@ +// Code generated by BobGen psql v0.42.5. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package dberrors + +var FeatureErrors = &featureErrors{ + ErrUniqueFeaturePkey: &UniqueConstraintError{ + schema: "", + table: "feature", + columns: []string{"id"}, + s: "feature_pkey", + }, +} + +type featureErrors struct { + ErrUniqueFeaturePkey *UniqueConstraintError +} diff --git a/db/dberrors/feature_pool.bob.go b/db/dberrors/feature_pool.bob.go new file mode 100644 index 00000000..d77670e4 --- /dev/null +++ b/db/dberrors/feature_pool.bob.go @@ -0,0 +1,17 @@ +// Code generated by BobGen psql v0.42.5. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package dberrors + +var FeaturePoolErrors = &featurePoolErrors{ + ErrUniqueFeaturePoolPkey: &UniqueConstraintError{ + schema: "", + table: "feature_pool", + columns: []string{"feature_id"}, + s: "feature_pool_pkey", + }, +} + +type featurePoolErrors struct { + ErrUniqueFeaturePoolPkey *UniqueConstraintError +} diff --git a/db/dberrors/pool.bob.go b/db/dberrors/pool.bob.go deleted file mode 100644 index 8cc4b911..00000000 --- a/db/dberrors/pool.bob.go +++ /dev/null @@ -1,17 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dberrors - -var PoolErrors = &poolErrors{ - ErrUniquePoolPkey: &UniqueConstraintError{ - schema: "", - table: "pool", - columns: []string{"id"}, - s: "pool_pkey", - }, -} - -type poolErrors struct { - ErrUniquePoolPkey *UniqueConstraintError -} diff --git a/db/dberrors/review_task.bob.go b/db/dberrors/review_task.bob.go new file mode 100644 index 00000000..3099c63e --- /dev/null +++ b/db/dberrors/review_task.bob.go @@ -0,0 +1,17 @@ +// Code generated by BobGen psql v0.42.5. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package dberrors + +var ReviewTaskErrors = &reviewTaskErrors{ + ErrUniqueReviewTaskPkey: &UniqueConstraintError{ + schema: "", + table: "review_task", + columns: []string{"id"}, + s: "review_task_pkey", + }, +} + +type reviewTaskErrors struct { + ErrUniqueReviewTaskPkey *UniqueConstraintError +} diff --git a/db/dberrors/review_task_pool.bob.go b/db/dberrors/review_task_pool.bob.go new file mode 100644 index 00000000..79e66146 --- /dev/null +++ b/db/dberrors/review_task_pool.bob.go @@ -0,0 +1,17 @@ +// Code generated by BobGen psql v0.42.5. DO NOT EDIT. +// This file is meant to be re-generated in place and/or deleted at any time. + +package dberrors + +var ReviewTaskPoolErrors = &reviewTaskPoolErrors{ + ErrUniqueReviewTaskPoolPkey: &UniqueConstraintError{ + schema: "", + table: "review_task_pool", + columns: []string{"review_task_id"}, + s: "review_task_pool_pkey", + }, +} + +type reviewTaskPoolErrors struct { + ErrUniqueReviewTaskPoolPkey *UniqueConstraintError +} diff --git a/db/dbinfo/pool.bob.go b/db/dbinfo/feature.bob.go similarity index 55% rename from db/dbinfo/pool.bob.go rename to db/dbinfo/feature.bob.go index 0dd15514..7c97988a 100644 --- a/db/dbinfo/pool.bob.go +++ b/db/dbinfo/feature.bob.go @@ -5,25 +5,16 @@ package dbinfo import "github.com/aarondl/opt/null" -var Pools = Table[ - poolColumns, - poolIndexes, - poolForeignKeys, - poolUniques, - poolChecks, +var Features = Table[ + featureColumns, + featureIndexes, + featureForeignKeys, + featureUniques, + featureChecks, ]{ Schema: "", - Name: "pool", - Columns: poolColumns{ - Condition: column{ - Name: "condition", - DBType: "public.poolconditiontype", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, + Name: "feature", + Columns: featureColumns{ Created: column{ Name: "created", DBType: "timestamp without time zone", @@ -45,7 +36,16 @@ var Pools = Table[ ID: column{ Name: "id", DBType: "integer", - Default: "nextval('pool_id_seq'::regclass)", + Default: "nextval('feature_id_seq'::regclass)", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", Comment: "", Nullable: false, Generated: false, @@ -79,10 +79,10 @@ var Pools = Table[ AutoIncr: false, }, }, - Indexes: poolIndexes{ - PoolPkey: index{ + Indexes: featureIndexes{ + FeaturePkey: index{ Type: "btree", - Name: "pool_pkey", + Name: "feature_pkey", Columns: []indexColumn{ { Name: "id", @@ -99,23 +99,32 @@ var Pools = Table[ }, }, PrimaryKey: &constraint{ - Name: "pool_pkey", + Name: "feature_pkey", Columns: []string{"id"}, Comment: "", }, - ForeignKeys: poolForeignKeys{ - PoolPoolCreatorIDFkey: foreignKey{ + ForeignKeys: featureForeignKeys{ + FeatureFeatureCreatorIDFkey: foreignKey{ constraint: constraint{ - Name: "pool.pool_creator_id_fkey", + Name: "feature.feature_creator_id_fkey", Columns: []string{"creator_id"}, Comment: "", }, ForeignTable: "user_", ForeignColumns: []string{"id"}, }, - PoolPoolSiteIDSiteVersionFkey: foreignKey{ + FeatureFeatureOrganizationIDFkey: foreignKey{ constraint: constraint{ - Name: "pool.pool_site_id_site_version_fkey", + Name: "feature.feature_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + FeatureFeatureSiteIDSiteVersionFkey: foreignKey{ + constraint: constraint{ + Name: "feature.feature_site_id_site_version_fkey", Columns: []string{"site_id", "site_version"}, Comment: "", }, @@ -127,51 +136,52 @@ var Pools = Table[ Comment: "", } -type poolColumns struct { - Condition column - Created column - CreatorID column - ID column - SiteID column - SiteVersion column - Geometry column +type featureColumns struct { + Created column + CreatorID column + ID column + OrganizationID column + SiteID column + SiteVersion column + Geometry column } -func (c poolColumns) AsSlice() []column { +func (c featureColumns) AsSlice() []column { return []column{ - c.Condition, c.Created, c.CreatorID, c.ID, c.SiteID, c.SiteVersion, c.Geometry, + c.Created, c.CreatorID, c.ID, c.OrganizationID, c.SiteID, c.SiteVersion, c.Geometry, } } -type poolIndexes struct { - PoolPkey index +type featureIndexes struct { + FeaturePkey index } -func (i poolIndexes) AsSlice() []index { +func (i featureIndexes) AsSlice() []index { return []index{ - i.PoolPkey, + i.FeaturePkey, } } -type poolForeignKeys struct { - PoolPoolCreatorIDFkey foreignKey - PoolPoolSiteIDSiteVersionFkey foreignKey +type featureForeignKeys struct { + FeatureFeatureCreatorIDFkey foreignKey + FeatureFeatureOrganizationIDFkey foreignKey + FeatureFeatureSiteIDSiteVersionFkey foreignKey } -func (f poolForeignKeys) AsSlice() []foreignKey { +func (f featureForeignKeys) AsSlice() []foreignKey { return []foreignKey{ - f.PoolPoolCreatorIDFkey, f.PoolPoolSiteIDSiteVersionFkey, + f.FeatureFeatureCreatorIDFkey, f.FeatureFeatureOrganizationIDFkey, f.FeatureFeatureSiteIDSiteVersionFkey, } } -type poolUniques struct{} +type featureUniques struct{} -func (u poolUniques) AsSlice() []constraint { +func (u featureUniques) AsSlice() []constraint { return []constraint{} } -type poolChecks struct{} +type featureChecks struct{} -func (c poolChecks) AsSlice() []check { +func (c featureChecks) AsSlice() []check { return []check{} } diff --git a/db/dbinfo/feature_pool.bob.go b/db/dbinfo/feature_pool.bob.go new file mode 100644 index 00000000..fda5508e --- /dev/null +++ b/db/dbinfo/feature_pool.bob.go @@ -0,0 +1,137 @@ +// Code generated by BobGen psql v0.42.5. 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 FeaturePools = Table[ + featurePoolColumns, + featurePoolIndexes, + featurePoolForeignKeys, + featurePoolUniques, + featurePoolChecks, +]{ + Schema: "", + Name: "feature_pool", + Columns: featurePoolColumns{ + FeatureID: column{ + Name: "feature_id", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Condition: column{ + Name: "condition", + DBType: "public.poolconditiontype", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + DepthMeters: column{ + Name: "depth_meters", + DBType: "double precision", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "geometry", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: featurePoolIndexes{ + FeaturePoolPkey: index{ + Type: "btree", + Name: "feature_pool_pkey", + Columns: []indexColumn{ + { + Name: "feature_id", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "feature_pool_pkey", + Columns: []string{"feature_id"}, + Comment: "", + }, + ForeignKeys: featurePoolForeignKeys{ + FeaturePoolFeaturePoolFeatureIDFkey: foreignKey{ + constraint: constraint{ + Name: "feature_pool.feature_pool_feature_id_fkey", + Columns: []string{"feature_id"}, + Comment: "", + }, + ForeignTable: "feature", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type featurePoolColumns struct { + FeatureID column + Condition column + DepthMeters column + Geometry column +} + +func (c featurePoolColumns) AsSlice() []column { + return []column{ + c.FeatureID, c.Condition, c.DepthMeters, c.Geometry, + } +} + +type featurePoolIndexes struct { + FeaturePoolPkey index +} + +func (i featurePoolIndexes) AsSlice() []index { + return []index{ + i.FeaturePoolPkey, + } +} + +type featurePoolForeignKeys struct { + FeaturePoolFeaturePoolFeatureIDFkey foreignKey +} + +func (f featurePoolForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.FeaturePoolFeaturePoolFeatureIDFkey, + } +} + +type featurePoolUniques struct{} + +func (u featurePoolUniques) AsSlice() []constraint { + return []constraint{} +} + +type featurePoolChecks struct{} + +func (c featurePoolChecks) AsSlice() []check { + return []check{} +} diff --git a/db/dbinfo/review_task.bob.go b/db/dbinfo/review_task.bob.go new file mode 100644 index 00000000..c63fb9bd --- /dev/null +++ b/db/dbinfo/review_task.bob.go @@ -0,0 +1,177 @@ +// Code generated by BobGen psql v0.42.5. 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 ReviewTasks = Table[ + reviewTaskColumns, + reviewTaskIndexes, + reviewTaskForeignKeys, + reviewTaskUniques, + reviewTaskChecks, +]{ + Schema: "", + Name: "review_task", + Columns: reviewTaskColumns{ + 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: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ID: column{ + Name: "id", + DBType: "integer", + Default: "nextval('review_task_id_seq'::regclass)", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + OrganizationID: column{ + Name: "organization_id", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Reviewed: column{ + Name: "reviewed", + DBType: "timestamp without time zone", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ReviewerID: column{ + Name: "reviewer_id", + DBType: "integer", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: reviewTaskIndexes{ + ReviewTaskPkey: index{ + Type: "btree", + Name: "review_task_pkey", + Columns: []indexColumn{ + { + Name: "id", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "review_task_pkey", + Columns: []string{"id"}, + Comment: "", + }, + ForeignKeys: reviewTaskForeignKeys{ + ReviewTaskReviewTaskCreatorIDFkey: foreignKey{ + constraint: constraint{ + Name: "review_task.review_task_creator_id_fkey", + Columns: []string{"creator_id"}, + Comment: "", + }, + ForeignTable: "user_", + ForeignColumns: []string{"id"}, + }, + ReviewTaskReviewTaskOrganizationIDFkey: foreignKey{ + constraint: constraint{ + Name: "review_task.review_task_organization_id_fkey", + Columns: []string{"organization_id"}, + Comment: "", + }, + ForeignTable: "organization", + ForeignColumns: []string{"id"}, + }, + ReviewTaskReviewTaskReviewerIDFkey: foreignKey{ + constraint: constraint{ + Name: "review_task.review_task_reviewer_id_fkey", + Columns: []string{"reviewer_id"}, + Comment: "", + }, + ForeignTable: "user_", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type reviewTaskColumns struct { + Created column + CreatorID column + ID column + OrganizationID column + Reviewed column + ReviewerID column +} + +func (c reviewTaskColumns) AsSlice() []column { + return []column{ + c.Created, c.CreatorID, c.ID, c.OrganizationID, c.Reviewed, c.ReviewerID, + } +} + +type reviewTaskIndexes struct { + ReviewTaskPkey index +} + +func (i reviewTaskIndexes) AsSlice() []index { + return []index{ + i.ReviewTaskPkey, + } +} + +type reviewTaskForeignKeys struct { + ReviewTaskReviewTaskCreatorIDFkey foreignKey + ReviewTaskReviewTaskOrganizationIDFkey foreignKey + ReviewTaskReviewTaskReviewerIDFkey foreignKey +} + +func (f reviewTaskForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.ReviewTaskReviewTaskCreatorIDFkey, f.ReviewTaskReviewTaskOrganizationIDFkey, f.ReviewTaskReviewTaskReviewerIDFkey, + } +} + +type reviewTaskUniques struct{} + +func (u reviewTaskUniques) AsSlice() []constraint { + return []constraint{} +} + +type reviewTaskChecks struct{} + +func (c reviewTaskChecks) AsSlice() []check { + return []check{} +} diff --git a/db/dbinfo/review_task_pool.bob.go b/db/dbinfo/review_task_pool.bob.go new file mode 100644 index 00000000..87f68daf --- /dev/null +++ b/db/dbinfo/review_task_pool.bob.go @@ -0,0 +1,147 @@ +// Code generated by BobGen psql v0.42.5. 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 ReviewTaskPools = Table[ + reviewTaskPoolColumns, + reviewTaskPoolIndexes, + reviewTaskPoolForeignKeys, + reviewTaskPoolUniques, + reviewTaskPoolChecks, +]{ + Schema: "", + Name: "review_task_pool", + Columns: reviewTaskPoolColumns{ + FeaturePool: column{ + Name: "feature_pool", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + Location: column{ + Name: "location", + DBType: "geometry", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + Geometry: column{ + Name: "geometry", + DBType: "geometry", + Default: "NULL", + Comment: "", + Nullable: true, + Generated: false, + AutoIncr: false, + }, + ReviewTaskID: column{ + Name: "review_task_id", + DBType: "integer", + Default: "", + Comment: "", + Nullable: false, + Generated: false, + AutoIncr: false, + }, + }, + Indexes: reviewTaskPoolIndexes{ + ReviewTaskPoolPkey: index{ + Type: "btree", + Name: "review_task_pool_pkey", + Columns: []indexColumn{ + { + Name: "review_task_id", + Desc: null.FromCond(false, true), + IsExpression: false, + }, + }, + Unique: true, + Comment: "", + NullsFirst: []bool{false}, + NullsDistinct: false, + Where: "", + Include: []string{}, + }, + }, + PrimaryKey: &constraint{ + Name: "review_task_pool_pkey", + Columns: []string{"review_task_id"}, + Comment: "", + }, + ForeignKeys: reviewTaskPoolForeignKeys{ + ReviewTaskPoolReviewTaskPoolFeaturePoolFkey: foreignKey{ + constraint: constraint{ + Name: "review_task_pool.review_task_pool_feature_pool_fkey", + Columns: []string{"feature_pool"}, + Comment: "", + }, + ForeignTable: "feature_pool", + ForeignColumns: []string{"feature_id"}, + }, + ReviewTaskPoolReviewTaskPoolReviewTaskIDFkey: foreignKey{ + constraint: constraint{ + Name: "review_task_pool.review_task_pool_review_task_id_fkey", + Columns: []string{"review_task_id"}, + Comment: "", + }, + ForeignTable: "review_task", + ForeignColumns: []string{"id"}, + }, + }, + + Comment: "", +} + +type reviewTaskPoolColumns struct { + FeaturePool column + Location column + Geometry column + ReviewTaskID column +} + +func (c reviewTaskPoolColumns) AsSlice() []column { + return []column{ + c.FeaturePool, c.Location, c.Geometry, c.ReviewTaskID, + } +} + +type reviewTaskPoolIndexes struct { + ReviewTaskPoolPkey index +} + +func (i reviewTaskPoolIndexes) AsSlice() []index { + return []index{ + i.ReviewTaskPoolPkey, + } +} + +type reviewTaskPoolForeignKeys struct { + ReviewTaskPoolReviewTaskPoolFeaturePoolFkey foreignKey + ReviewTaskPoolReviewTaskPoolReviewTaskIDFkey foreignKey +} + +func (f reviewTaskPoolForeignKeys) AsSlice() []foreignKey { + return []foreignKey{ + f.ReviewTaskPoolReviewTaskPoolFeaturePoolFkey, f.ReviewTaskPoolReviewTaskPoolReviewTaskIDFkey, + } +} + +type reviewTaskPoolUniques struct{} + +func (u reviewTaskPoolUniques) AsSlice() []constraint { + return []constraint{} +} + +type reviewTaskPoolChecks struct{} + +func (c reviewTaskPoolChecks) AsSlice() []check { + return []check{} +} diff --git a/db/dbinfo/signal_pool.bob.go b/db/dbinfo/signal_pool.bob.go deleted file mode 100644 index 29965619..00000000 --- a/db/dbinfo/signal_pool.bob.go +++ /dev/null @@ -1,98 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package dbinfo - -var SignalPools = Table[ - signalPoolColumns, - signalPoolIndexes, - signalPoolForeignKeys, - signalPoolUniques, - signalPoolChecks, -]{ - Schema: "", - Name: "signal_pool", - Columns: signalPoolColumns{ - PoolID: column{ - Name: "pool_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - SignalID: column{ - Name: "signal_id", - DBType: "integer", - Default: "", - Comment: "", - Nullable: false, - Generated: false, - AutoIncr: false, - }, - }, - - ForeignKeys: signalPoolForeignKeys{ - SignalPoolSignalPoolPoolIDFkey: foreignKey{ - constraint: constraint{ - Name: "signal_pool.signal_pool_pool_id_fkey", - Columns: []string{"pool_id"}, - Comment: "", - }, - ForeignTable: "pool", - ForeignColumns: []string{"id"}, - }, - SignalPoolSignalPoolSignalIDFkey: foreignKey{ - constraint: constraint{ - Name: "signal_pool.signal_pool_signal_id_fkey", - Columns: []string{"signal_id"}, - Comment: "", - }, - ForeignTable: "signal", - ForeignColumns: []string{"id"}, - }, - }, - - Comment: "", -} - -type signalPoolColumns struct { - PoolID column - SignalID column -} - -func (c signalPoolColumns) AsSlice() []column { - return []column{ - c.PoolID, c.SignalID, - } -} - -type signalPoolIndexes struct{} - -func (i signalPoolIndexes) AsSlice() []index { - return []index{} -} - -type signalPoolForeignKeys struct { - SignalPoolSignalPoolPoolIDFkey foreignKey - SignalPoolSignalPoolSignalIDFkey foreignKey -} - -func (f signalPoolForeignKeys) AsSlice() []foreignKey { - return []foreignKey{ - f.SignalPoolSignalPoolPoolIDFkey, f.SignalPoolSignalPoolSignalIDFkey, - } -} - -type signalPoolUniques struct{} - -func (u signalPoolUniques) AsSlice() []constraint { - return []constraint{} -} - -type signalPoolChecks struct{} - -func (c signalPoolChecks) AsSlice() []check { - return []check{} -} diff --git a/db/factory/address.bob.go b/db/factory/address.bob.go deleted file mode 100644 index a2b79c51..00000000 --- a/db/factory/address.bob.go +++ /dev/null @@ -1,935 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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/jaswdr/faker/v2" -) - -type AddressMod interface { - Apply(context.Context, *AddressTemplate) -} - -type AddressModFunc func(context.Context, *AddressTemplate) - -func (f AddressModFunc) Apply(ctx context.Context, n *AddressTemplate) { - f(ctx, n) -} - -type AddressModSlice []AddressMod - -func (mods AddressModSlice) Apply(ctx context.Context, n *AddressTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// AddressTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type AddressTemplate struct { - Country func() enums.Countrytype - Created func() time.Time - Geom func() string - H3cell func() string - ID func() int32 - Locality func() string - PostalCode func() string - Street func() string - Unit func() string - Region func() string - Number func() string - - r addressR - f *Factory - - alreadyPersisted bool -} - -type addressR struct { - Mailers []*addressRMailersR - Residents []*addressRResidentsR - Site *addressRSiteR -} - -type addressRMailersR struct { - number int - o *CommsMailerTemplate -} -type addressRResidentsR struct { - number int - o *ResidentTemplate -} -type addressRSiteR struct { - o *SiteTemplate -} - -// Apply mods to the AddressTemplate -func (o *AddressTemplate) Apply(ctx context.Context, mods ...AddressMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.Address -// according to the relationships in the template. Nothing is inserted into the db -func (t AddressTemplate) setModelRels(o *models.Address) { - if t.r.Mailers != nil { - rel := models.CommsMailerSlice{} - for _, r := range t.r.Mailers { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.AddressID = o.ID // h2 - rel.R.Address = o - } - rel = append(rel, related...) - } - o.R.Mailers = rel - } - - if t.r.Residents != nil { - rel := models.ResidentSlice{} - for _, r := range t.r.Residents { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.AddressID = o.ID // h2 - rel.R.Address = o - } - rel = append(rel, related...) - } - o.R.Residents = rel - } - - if t.r.Site != nil { - rel := t.r.Site.o.Build() - rel.R.Address = o - rel.AddressID = o.ID // h2 - o.R.Site = rel - } -} - -// BuildSetter returns an *models.AddressSetter -// this does nothing with the relationship templates -func (o AddressTemplate) BuildSetter() *models.AddressSetter { - m := &models.AddressSetter{} - - if o.Country != nil { - val := o.Country() - m.Country = omit.From(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.Geom != nil { - val := o.Geom() - m.Geom = omit.From(val) - } - if o.H3cell != nil { - val := o.H3cell() - m.H3cell = omit.From(val) - } - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.Locality != nil { - val := o.Locality() - m.Locality = omit.From(val) - } - if o.PostalCode != nil { - val := o.PostalCode() - m.PostalCode = omit.From(val) - } - if o.Street != nil { - val := o.Street() - m.Street = omit.From(val) - } - if o.Unit != nil { - val := o.Unit() - m.Unit = omit.From(val) - } - if o.Region != nil { - val := o.Region() - m.Region = omit.From(val) - } - if o.Number != nil { - val := o.Number() - m.Number = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.AddressSetter -// this does nothing with the relationship templates -func (o AddressTemplate) BuildManySetter(number int) []*models.AddressSetter { - m := make([]*models.AddressSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.Address -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use AddressTemplate.Create -func (o AddressTemplate) Build() *models.Address { - m := &models.Address{} - - if o.Country != nil { - m.Country = o.Country() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.Geom != nil { - m.Geom = o.Geom() - } - if o.H3cell != nil { - m.H3cell = o.H3cell() - } - if o.ID != nil { - m.ID = o.ID() - } - if o.Locality != nil { - m.Locality = o.Locality() - } - if o.PostalCode != nil { - m.PostalCode = o.PostalCode() - } - if o.Street != nil { - m.Street = o.Street() - } - if o.Unit != nil { - m.Unit = o.Unit() - } - if o.Region != nil { - m.Region = o.Region() - } - if o.Number != nil { - m.Number = o.Number() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.AddressSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use AddressTemplate.CreateMany -func (o AddressTemplate) BuildMany(number int) models.AddressSlice { - m := make(models.AddressSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableAddress(m *models.AddressSetter) { - if !(m.Country.IsValue()) { - val := random_enums_Countrytype(nil) - m.Country = omit.From(val) - } - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.Geom.IsValue()) { - val := random_string(nil) - m.Geom = omit.From(val) - } - if !(m.H3cell.IsValue()) { - val := random_string(nil) - m.H3cell = omit.From(val) - } - if !(m.Locality.IsValue()) { - val := random_string(nil) - m.Locality = omit.From(val) - } - if !(m.PostalCode.IsValue()) { - val := random_string(nil) - m.PostalCode = omit.From(val) - } - if !(m.Street.IsValue()) { - val := random_string(nil) - m.Street = omit.From(val) - } - if !(m.Unit.IsValue()) { - val := random_string(nil) - m.Unit = omit.From(val) - } - if !(m.Region.IsValue()) { - val := random_string(nil) - m.Region = omit.From(val) - } - if !(m.Number.IsValue()) { - val := random_string(nil) - m.Number = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.Address -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *AddressTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.Address) error { - var err error - - isMailersDone, _ := addressRelMailersCtx.Value(ctx) - if !isMailersDone && o.r.Mailers != nil { - ctx = addressRelMailersCtx.WithValue(ctx, true) - for _, r := range o.r.Mailers { - if r.o.alreadyPersisted { - m.R.Mailers = append(m.R.Mailers, r.o.Build()) - } else { - rel0, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachMailers(ctx, exec, rel0...) - if err != nil { - return err - } - } - } - } - - isResidentsDone, _ := addressRelResidentsCtx.Value(ctx) - if !isResidentsDone && o.r.Residents != nil { - ctx = addressRelResidentsCtx.WithValue(ctx, true) - for _, r := range o.r.Residents { - if r.o.alreadyPersisted { - m.R.Residents = append(m.R.Residents, r.o.Build()) - } else { - rel1, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachResidents(ctx, exec, rel1...) - if err != nil { - return err - } - } - } - } - - isSiteDone, _ := addressRelSiteCtx.Value(ctx) - if !isSiteDone && o.r.Site != nil { - ctx = addressRelSiteCtx.WithValue(ctx, true) - if o.r.Site.o.alreadyPersisted { - m.R.Site = o.r.Site.o.Build() - } else { - var rel2 *models.Site - rel2, err = o.r.Site.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachSite(ctx, exec, rel2) - if err != nil { - return err - } - } - - } - - return err -} - -// Create builds a address and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *AddressTemplate) Create(ctx context.Context, exec bob.Executor) (*models.Address, error) { - var err error - opt := o.BuildSetter() - ensureCreatableAddress(opt) - - m, err := models.Addresses.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a address and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *AddressTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.Address { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a address 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 *AddressTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.Address { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple addresses and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o AddressTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.AddressSlice, error) { - var err error - m := make(models.AddressSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple addresses and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o AddressTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.AddressSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple addresses 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 AddressTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.AddressSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// Address has methods that act as mods for the AddressTemplate -var AddressMods addressMods - -type addressMods struct{} - -func (m addressMods) RandomizeAllColumns(f *faker.Faker) AddressMod { - return AddressModSlice{ - AddressMods.RandomCountry(f), - AddressMods.RandomCreated(f), - AddressMods.RandomGeom(f), - AddressMods.RandomH3cell(f), - AddressMods.RandomID(f), - AddressMods.RandomLocality(f), - AddressMods.RandomPostalCode(f), - AddressMods.RandomStreet(f), - AddressMods.RandomUnit(f), - AddressMods.RandomRegion(f), - AddressMods.RandomNumber(f), - } -} - -// Set the model columns to this value -func (m addressMods) Country(val enums.Countrytype) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Country = func() enums.Countrytype { return val } - }) -} - -// Set the Column from the function -func (m addressMods) CountryFunc(f func() enums.Countrytype) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Country = f - }) -} - -// Clear any values for the column -func (m addressMods) UnsetCountry() AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Country = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m addressMods) RandomCountry(f *faker.Faker) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Country = func() enums.Countrytype { - return random_enums_Countrytype(f) - } - }) -} - -// Set the model columns to this value -func (m addressMods) Created(val time.Time) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m addressMods) CreatedFunc(f func() time.Time) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m addressMods) UnsetCreated() AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - 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 addressMods) RandomCreated(f *faker.Faker) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m addressMods) Geom(val string) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Geom = func() string { return val } - }) -} - -// Set the Column from the function -func (m addressMods) GeomFunc(f func() string) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Geom = f - }) -} - -// Clear any values for the column -func (m addressMods) UnsetGeom() AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Geom = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m addressMods) RandomGeom(f *faker.Faker) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Geom = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m addressMods) H3cell(val string) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.H3cell = func() string { return val } - }) -} - -// Set the Column from the function -func (m addressMods) H3cellFunc(f func() string) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.H3cell = f - }) -} - -// Clear any values for the column -func (m addressMods) UnsetH3cell() AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.H3cell = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m addressMods) RandomH3cell(f *faker.Faker) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.H3cell = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m addressMods) ID(val int32) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m addressMods) IDFunc(f func() int32) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m addressMods) UnsetID() AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m addressMods) RandomID(f *faker.Faker) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m addressMods) Locality(val string) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Locality = func() string { return val } - }) -} - -// Set the Column from the function -func (m addressMods) LocalityFunc(f func() string) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Locality = f - }) -} - -// Clear any values for the column -func (m addressMods) UnsetLocality() AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Locality = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m addressMods) RandomLocality(f *faker.Faker) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Locality = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m addressMods) PostalCode(val string) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.PostalCode = func() string { return val } - }) -} - -// Set the Column from the function -func (m addressMods) PostalCodeFunc(f func() string) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.PostalCode = f - }) -} - -// Clear any values for the column -func (m addressMods) UnsetPostalCode() AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.PostalCode = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m addressMods) RandomPostalCode(f *faker.Faker) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.PostalCode = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m addressMods) Street(val string) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Street = func() string { return val } - }) -} - -// Set the Column from the function -func (m addressMods) StreetFunc(f func() string) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Street = f - }) -} - -// Clear any values for the column -func (m addressMods) UnsetStreet() AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Street = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m addressMods) RandomStreet(f *faker.Faker) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Street = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m addressMods) Unit(val string) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Unit = func() string { return val } - }) -} - -// Set the Column from the function -func (m addressMods) UnitFunc(f func() string) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Unit = f - }) -} - -// Clear any values for the column -func (m addressMods) UnsetUnit() AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Unit = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m addressMods) RandomUnit(f *faker.Faker) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Unit = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m addressMods) Region(val string) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Region = func() string { return val } - }) -} - -// Set the Column from the function -func (m addressMods) RegionFunc(f func() string) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Region = f - }) -} - -// Clear any values for the column -func (m addressMods) UnsetRegion() AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Region = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m addressMods) RandomRegion(f *faker.Faker) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Region = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m addressMods) Number(val string) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Number = func() string { return val } - }) -} - -// Set the Column from the function -func (m addressMods) NumberFunc(f func() string) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Number = f - }) -} - -// Clear any values for the column -func (m addressMods) UnsetNumber() AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Number = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m addressMods) RandomNumber(f *faker.Faker) AddressMod { - return AddressModFunc(func(_ context.Context, o *AddressTemplate) { - o.Number = func() string { - return random_string(f) - } - }) -} - -func (m addressMods) WithParentsCascading() AddressMod { - return AddressModFunc(func(ctx context.Context, o *AddressTemplate) { - if isDone, _ := addressWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = addressWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewSiteWithContext(ctx, SiteMods.WithParentsCascading()) - m.WithSite(related).Apply(ctx, o) - } - }) -} - -func (m addressMods) WithSite(rel *SiteTemplate) AddressMod { - return AddressModFunc(func(ctx context.Context, o *AddressTemplate) { - o.r.Site = &addressRSiteR{ - o: rel, - } - }) -} - -func (m addressMods) WithNewSite(mods ...SiteMod) AddressMod { - return AddressModFunc(func(ctx context.Context, o *AddressTemplate) { - related := o.f.NewSiteWithContext(ctx, mods...) - - m.WithSite(related).Apply(ctx, o) - }) -} - -func (m addressMods) WithExistingSite(em *models.Site) AddressMod { - return AddressModFunc(func(ctx context.Context, o *AddressTemplate) { - o.r.Site = &addressRSiteR{ - o: o.f.FromExistingSite(em), - } - }) -} - -func (m addressMods) WithoutSite() AddressMod { - return AddressModFunc(func(ctx context.Context, o *AddressTemplate) { - o.r.Site = nil - }) -} - -func (m addressMods) WithMailers(number int, related *CommsMailerTemplate) AddressMod { - return AddressModFunc(func(ctx context.Context, o *AddressTemplate) { - o.r.Mailers = []*addressRMailersR{{ - number: number, - o: related, - }} - }) -} - -func (m addressMods) WithNewMailers(number int, mods ...CommsMailerMod) AddressMod { - return AddressModFunc(func(ctx context.Context, o *AddressTemplate) { - related := o.f.NewCommsMailerWithContext(ctx, mods...) - m.WithMailers(number, related).Apply(ctx, o) - }) -} - -func (m addressMods) AddMailers(number int, related *CommsMailerTemplate) AddressMod { - return AddressModFunc(func(ctx context.Context, o *AddressTemplate) { - o.r.Mailers = append(o.r.Mailers, &addressRMailersR{ - number: number, - o: related, - }) - }) -} - -func (m addressMods) AddNewMailers(number int, mods ...CommsMailerMod) AddressMod { - return AddressModFunc(func(ctx context.Context, o *AddressTemplate) { - related := o.f.NewCommsMailerWithContext(ctx, mods...) - m.AddMailers(number, related).Apply(ctx, o) - }) -} - -func (m addressMods) AddExistingMailers(existingModels ...*models.CommsMailer) AddressMod { - return AddressModFunc(func(ctx context.Context, o *AddressTemplate) { - for _, em := range existingModels { - o.r.Mailers = append(o.r.Mailers, &addressRMailersR{ - o: o.f.FromExistingCommsMailer(em), - }) - } - }) -} - -func (m addressMods) WithoutMailers() AddressMod { - return AddressModFunc(func(ctx context.Context, o *AddressTemplate) { - o.r.Mailers = nil - }) -} - -func (m addressMods) WithResidents(number int, related *ResidentTemplate) AddressMod { - return AddressModFunc(func(ctx context.Context, o *AddressTemplate) { - o.r.Residents = []*addressRResidentsR{{ - number: number, - o: related, - }} - }) -} - -func (m addressMods) WithNewResidents(number int, mods ...ResidentMod) AddressMod { - return AddressModFunc(func(ctx context.Context, o *AddressTemplate) { - related := o.f.NewResidentWithContext(ctx, mods...) - m.WithResidents(number, related).Apply(ctx, o) - }) -} - -func (m addressMods) AddResidents(number int, related *ResidentTemplate) AddressMod { - return AddressModFunc(func(ctx context.Context, o *AddressTemplate) { - o.r.Residents = append(o.r.Residents, &addressRResidentsR{ - number: number, - o: related, - }) - }) -} - -func (m addressMods) AddNewResidents(number int, mods ...ResidentMod) AddressMod { - return AddressModFunc(func(ctx context.Context, o *AddressTemplate) { - related := o.f.NewResidentWithContext(ctx, mods...) - m.AddResidents(number, related).Apply(ctx, o) - }) -} - -func (m addressMods) AddExistingResidents(existingModels ...*models.Resident) AddressMod { - return AddressModFunc(func(ctx context.Context, o *AddressTemplate) { - for _, em := range existingModels { - o.r.Residents = append(o.r.Residents, &addressRResidentsR{ - o: o.f.FromExistingResident(em), - }) - } - }) -} - -func (m addressMods) WithoutResidents() AddressMod { - return AddressModFunc(func(ctx context.Context, o *AddressTemplate) { - o.r.Residents = nil - }) -} diff --git a/db/factory/arcgis.account.bob.go b/db/factory/arcgis.account.bob.go deleted file mode 100644 index c985466c..00000000 --- a/db/factory/arcgis.account.bob.go +++ /dev/null @@ -1,1069 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - 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" -) - -type ArcgisAccountMod interface { - Apply(context.Context, *ArcgisAccountTemplate) -} - -type ArcgisAccountModFunc func(context.Context, *ArcgisAccountTemplate) - -func (f ArcgisAccountModFunc) Apply(ctx context.Context, n *ArcgisAccountTemplate) { - f(ctx, n) -} - -type ArcgisAccountModSlice []ArcgisAccountMod - -func (mods ArcgisAccountModSlice) Apply(ctx context.Context, n *ArcgisAccountTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// ArcgisAccountTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type ArcgisAccountTemplate struct { - ID func() string - Name func() string - OrganizationID func() int32 - URLFeatures func() null.Val[string] - URLInsights func() null.Val[string] - URLGeometry func() null.Val[string] - URLNotebooks func() null.Val[string] - URLTiles func() null.Val[string] - - r arcgisAccountR - f *Factory - - alreadyPersisted bool -} - -type arcgisAccountR struct { - Organization *arcgisAccountROrganizationR - ArcgisAccountOauthTokens []*arcgisAccountRArcgisAccountOauthTokensR - ServiceFeatures []*arcgisAccountRServiceFeaturesR - ServiceMaps []*arcgisAccountRServiceMapsR - ArcgisAccountOrganizations []*arcgisAccountRArcgisAccountOrganizationsR -} - -type arcgisAccountROrganizationR struct { - o *OrganizationTemplate -} -type arcgisAccountRArcgisAccountOauthTokensR struct { - number int - o *ArcgisOauthTokenTemplate -} -type arcgisAccountRServiceFeaturesR struct { - number int - o *ArcgisServiceFeatureTemplate -} -type arcgisAccountRServiceMapsR struct { - number int - o *ArcgisServiceMapTemplate -} -type arcgisAccountRArcgisAccountOrganizationsR struct { - number int - o *OrganizationTemplate -} - -// Apply mods to the ArcgisAccountTemplate -func (o *ArcgisAccountTemplate) Apply(ctx context.Context, mods ...ArcgisAccountMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.ArcgisAccount -// according to the relationships in the template. Nothing is inserted into the db -func (t ArcgisAccountTemplate) setModelRels(o *models.ArcgisAccount) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.Accounts = append(rel.R.Accounts, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } - - if t.r.ArcgisAccountOauthTokens != nil { - rel := models.ArcgisOauthTokenSlice{} - for _, r := range t.r.ArcgisAccountOauthTokens { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.ArcgisAccountID = null.From(o.ID) // h2 - rel.R.ArcgisAccountAccount = o - } - rel = append(rel, related...) - } - o.R.ArcgisAccountOauthTokens = rel - } - - if t.r.ServiceFeatures != nil { - rel := models.ArcgisServiceFeatureSlice{} - for _, r := range t.r.ServiceFeatures { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.AccountID = null.From(o.ID) // h2 - rel.R.Account = o - } - rel = append(rel, related...) - } - o.R.ServiceFeatures = rel - } - - if t.r.ServiceMaps != nil { - rel := models.ArcgisServiceMapSlice{} - for _, r := range t.r.ServiceMaps { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.AccountID = o.ID // h2 - rel.R.Account = o - } - rel = append(rel, related...) - } - o.R.ServiceMaps = rel - } - - if t.r.ArcgisAccountOrganizations != nil { - rel := models.OrganizationSlice{} - for _, r := range t.r.ArcgisAccountOrganizations { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.ArcgisAccountID = null.From(o.ID) // h2 - rel.R.ArcgisAccountAccount = o - } - rel = append(rel, related...) - } - o.R.ArcgisAccountOrganizations = rel - } -} - -// BuildSetter returns an *models.ArcgisAccountSetter -// this does nothing with the relationship templates -func (o ArcgisAccountTemplate) BuildSetter() *models.ArcgisAccountSetter { - m := &models.ArcgisAccountSetter{} - - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omit.From(val) - } - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.URLFeatures != nil { - val := o.URLFeatures() - m.URLFeatures = omitnull.FromNull(val) - } - if o.URLInsights != nil { - val := o.URLInsights() - m.URLInsights = omitnull.FromNull(val) - } - if o.URLGeometry != nil { - val := o.URLGeometry() - m.URLGeometry = omitnull.FromNull(val) - } - if o.URLNotebooks != nil { - val := o.URLNotebooks() - m.URLNotebooks = omitnull.FromNull(val) - } - if o.URLTiles != nil { - val := o.URLTiles() - m.URLTiles = omitnull.FromNull(val) - } - - return m -} - -// BuildManySetter returns an []*models.ArcgisAccountSetter -// this does nothing with the relationship templates -func (o ArcgisAccountTemplate) BuildManySetter(number int) []*models.ArcgisAccountSetter { - m := make([]*models.ArcgisAccountSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.ArcgisAccount -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ArcgisAccountTemplate.Create -func (o ArcgisAccountTemplate) Build() *models.ArcgisAccount { - m := &models.ArcgisAccount{} - - if o.ID != nil { - m.ID = o.ID() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.URLFeatures != nil { - m.URLFeatures = o.URLFeatures() - } - if o.URLInsights != nil { - m.URLInsights = o.URLInsights() - } - if o.URLGeometry != nil { - m.URLGeometry = o.URLGeometry() - } - if o.URLNotebooks != nil { - m.URLNotebooks = o.URLNotebooks() - } - if o.URLTiles != nil { - m.URLTiles = o.URLTiles() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.ArcgisAccountSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ArcgisAccountTemplate.CreateMany -func (o ArcgisAccountTemplate) BuildMany(number int) models.ArcgisAccountSlice { - m := make(models.ArcgisAccountSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableArcgisAccount(m *models.ArcgisAccountSetter) { - if !(m.ID.IsValue()) { - val := random_string(nil) - m.ID = omit.From(val) - } - if !(m.Name.IsValue()) { - val := random_string(nil) - m.Name = 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.ArcgisAccount -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *ArcgisAccountTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.ArcgisAccount) error { - var err error - - isArcgisAccountOauthTokensDone, _ := arcgisAccountRelArcgisAccountOauthTokensCtx.Value(ctx) - if !isArcgisAccountOauthTokensDone && o.r.ArcgisAccountOauthTokens != nil { - ctx = arcgisAccountRelArcgisAccountOauthTokensCtx.WithValue(ctx, true) - for _, r := range o.r.ArcgisAccountOauthTokens { - if r.o.alreadyPersisted { - m.R.ArcgisAccountOauthTokens = append(m.R.ArcgisAccountOauthTokens, r.o.Build()) - } else { - rel1, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachArcgisAccountOauthTokens(ctx, exec, rel1...) - if err != nil { - return err - } - } - } - } - - isServiceFeaturesDone, _ := arcgisAccountRelServiceFeaturesCtx.Value(ctx) - if !isServiceFeaturesDone && o.r.ServiceFeatures != nil { - ctx = arcgisAccountRelServiceFeaturesCtx.WithValue(ctx, true) - for _, r := range o.r.ServiceFeatures { - if r.o.alreadyPersisted { - m.R.ServiceFeatures = append(m.R.ServiceFeatures, r.o.Build()) - } else { - rel2, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachServiceFeatures(ctx, exec, rel2...) - if err != nil { - return err - } - } - } - } - - isServiceMapsDone, _ := arcgisAccountRelServiceMapsCtx.Value(ctx) - if !isServiceMapsDone && o.r.ServiceMaps != nil { - ctx = arcgisAccountRelServiceMapsCtx.WithValue(ctx, true) - for _, r := range o.r.ServiceMaps { - if r.o.alreadyPersisted { - m.R.ServiceMaps = append(m.R.ServiceMaps, r.o.Build()) - } else { - rel3, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachServiceMaps(ctx, exec, rel3...) - if err != nil { - return err - } - } - } - } - - isArcgisAccountOrganizationsDone, _ := arcgisAccountRelArcgisAccountOrganizationsCtx.Value(ctx) - if !isArcgisAccountOrganizationsDone && o.r.ArcgisAccountOrganizations != nil { - ctx = arcgisAccountRelArcgisAccountOrganizationsCtx.WithValue(ctx, true) - for _, r := range o.r.ArcgisAccountOrganizations { - if r.o.alreadyPersisted { - m.R.ArcgisAccountOrganizations = append(m.R.ArcgisAccountOrganizations, r.o.Build()) - } else { - rel4, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachArcgisAccountOrganizations(ctx, exec, rel4...) - if err != nil { - return err - } - } - } - } - - return err -} - -// Create builds a arcgisAccount and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *ArcgisAccountTemplate) Create(ctx context.Context, exec bob.Executor) (*models.ArcgisAccount, error) { - var err error - opt := o.BuildSetter() - ensureCreatableArcgisAccount(opt) - - if o.r.Organization == nil { - ArcgisAccountMods.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.ArcgisAccounts.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 arcgisAccount and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *ArcgisAccountTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.ArcgisAccount { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a arcgisAccount 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 *ArcgisAccountTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.ArcgisAccount { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple arcgisAccounts and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o ArcgisAccountTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.ArcgisAccountSlice, error) { - var err error - m := make(models.ArcgisAccountSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple arcgisAccounts and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o ArcgisAccountTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.ArcgisAccountSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple arcgisAccounts 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 ArcgisAccountTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.ArcgisAccountSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// ArcgisAccount has methods that act as mods for the ArcgisAccountTemplate -var ArcgisAccountMods arcgisAccountMods - -type arcgisAccountMods struct{} - -func (m arcgisAccountMods) RandomizeAllColumns(f *faker.Faker) ArcgisAccountMod { - return ArcgisAccountModSlice{ - ArcgisAccountMods.RandomID(f), - ArcgisAccountMods.RandomName(f), - ArcgisAccountMods.RandomOrganizationID(f), - ArcgisAccountMods.RandomURLFeatures(f), - ArcgisAccountMods.RandomURLInsights(f), - ArcgisAccountMods.RandomURLGeometry(f), - ArcgisAccountMods.RandomURLNotebooks(f), - ArcgisAccountMods.RandomURLTiles(f), - } -} - -// Set the model columns to this value -func (m arcgisAccountMods) ID(val string) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.ID = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisAccountMods) IDFunc(f func() string) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m arcgisAccountMods) UnsetID() ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisAccountMods) RandomID(f *faker.Faker) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.ID = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisAccountMods) Name(val string) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.Name = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisAccountMods) NameFunc(f func() string) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m arcgisAccountMods) UnsetName() ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.Name = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisAccountMods) RandomName(f *faker.Faker) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.Name = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisAccountMods) OrganizationID(val int32) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m arcgisAccountMods) OrganizationIDFunc(f func() int32) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m arcgisAccountMods) UnsetOrganizationID() ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - 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 arcgisAccountMods) RandomOrganizationID(f *faker.Faker) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisAccountMods) URLFeatures(val null.Val[string]) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLFeatures = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m arcgisAccountMods) URLFeaturesFunc(f func() null.Val[string]) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLFeatures = f - }) -} - -// Clear any values for the column -func (m arcgisAccountMods) UnsetURLFeatures() ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLFeatures = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m arcgisAccountMods) RandomURLFeatures(f *faker.Faker) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLFeatures = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m arcgisAccountMods) RandomURLFeaturesNotNull(f *faker.Faker) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLFeatures = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m arcgisAccountMods) URLInsights(val null.Val[string]) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLInsights = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m arcgisAccountMods) URLInsightsFunc(f func() null.Val[string]) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLInsights = f - }) -} - -// Clear any values for the column -func (m arcgisAccountMods) UnsetURLInsights() ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLInsights = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m arcgisAccountMods) RandomURLInsights(f *faker.Faker) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLInsights = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m arcgisAccountMods) RandomURLInsightsNotNull(f *faker.Faker) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLInsights = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m arcgisAccountMods) URLGeometry(val null.Val[string]) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLGeometry = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m arcgisAccountMods) URLGeometryFunc(f func() null.Val[string]) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLGeometry = f - }) -} - -// Clear any values for the column -func (m arcgisAccountMods) UnsetURLGeometry() ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLGeometry = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m arcgisAccountMods) RandomURLGeometry(f *faker.Faker) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLGeometry = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m arcgisAccountMods) RandomURLGeometryNotNull(f *faker.Faker) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLGeometry = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m arcgisAccountMods) URLNotebooks(val null.Val[string]) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLNotebooks = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m arcgisAccountMods) URLNotebooksFunc(f func() null.Val[string]) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLNotebooks = f - }) -} - -// Clear any values for the column -func (m arcgisAccountMods) UnsetURLNotebooks() ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLNotebooks = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m arcgisAccountMods) RandomURLNotebooks(f *faker.Faker) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLNotebooks = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m arcgisAccountMods) RandomURLNotebooksNotNull(f *faker.Faker) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLNotebooks = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m arcgisAccountMods) URLTiles(val null.Val[string]) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLTiles = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m arcgisAccountMods) URLTilesFunc(f func() null.Val[string]) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLTiles = f - }) -} - -// Clear any values for the column -func (m arcgisAccountMods) UnsetURLTiles() ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLTiles = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m arcgisAccountMods) RandomURLTiles(f *faker.Faker) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLTiles = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m arcgisAccountMods) RandomURLTilesNotNull(f *faker.Faker) ArcgisAccountMod { - return ArcgisAccountModFunc(func(_ context.Context, o *ArcgisAccountTemplate) { - o.URLTiles = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -func (m arcgisAccountMods) WithParentsCascading() ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - if isDone, _ := arcgisAccountWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = arcgisAccountWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m arcgisAccountMods) WithOrganization(rel *OrganizationTemplate) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - o.r.Organization = &arcgisAccountROrganizationR{ - o: rel, - } - }) -} - -func (m arcgisAccountMods) WithNewOrganization(mods ...OrganizationMod) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m arcgisAccountMods) WithExistingOrganization(em *models.Organization) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - o.r.Organization = &arcgisAccountROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m arcgisAccountMods) WithoutOrganization() ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - o.r.Organization = nil - }) -} - -func (m arcgisAccountMods) WithArcgisAccountOauthTokens(number int, related *ArcgisOauthTokenTemplate) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - o.r.ArcgisAccountOauthTokens = []*arcgisAccountRArcgisAccountOauthTokensR{{ - number: number, - o: related, - }} - }) -} - -func (m arcgisAccountMods) WithNewArcgisAccountOauthTokens(number int, mods ...ArcgisOauthTokenMod) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - related := o.f.NewArcgisOauthTokenWithContext(ctx, mods...) - m.WithArcgisAccountOauthTokens(number, related).Apply(ctx, o) - }) -} - -func (m arcgisAccountMods) AddArcgisAccountOauthTokens(number int, related *ArcgisOauthTokenTemplate) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - o.r.ArcgisAccountOauthTokens = append(o.r.ArcgisAccountOauthTokens, &arcgisAccountRArcgisAccountOauthTokensR{ - number: number, - o: related, - }) - }) -} - -func (m arcgisAccountMods) AddNewArcgisAccountOauthTokens(number int, mods ...ArcgisOauthTokenMod) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - related := o.f.NewArcgisOauthTokenWithContext(ctx, mods...) - m.AddArcgisAccountOauthTokens(number, related).Apply(ctx, o) - }) -} - -func (m arcgisAccountMods) AddExistingArcgisAccountOauthTokens(existingModels ...*models.ArcgisOauthToken) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - for _, em := range existingModels { - o.r.ArcgisAccountOauthTokens = append(o.r.ArcgisAccountOauthTokens, &arcgisAccountRArcgisAccountOauthTokensR{ - o: o.f.FromExistingArcgisOauthToken(em), - }) - } - }) -} - -func (m arcgisAccountMods) WithoutArcgisAccountOauthTokens() ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - o.r.ArcgisAccountOauthTokens = nil - }) -} - -func (m arcgisAccountMods) WithServiceFeatures(number int, related *ArcgisServiceFeatureTemplate) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - o.r.ServiceFeatures = []*arcgisAccountRServiceFeaturesR{{ - number: number, - o: related, - }} - }) -} - -func (m arcgisAccountMods) WithNewServiceFeatures(number int, mods ...ArcgisServiceFeatureMod) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - related := o.f.NewArcgisServiceFeatureWithContext(ctx, mods...) - m.WithServiceFeatures(number, related).Apply(ctx, o) - }) -} - -func (m arcgisAccountMods) AddServiceFeatures(number int, related *ArcgisServiceFeatureTemplate) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - o.r.ServiceFeatures = append(o.r.ServiceFeatures, &arcgisAccountRServiceFeaturesR{ - number: number, - o: related, - }) - }) -} - -func (m arcgisAccountMods) AddNewServiceFeatures(number int, mods ...ArcgisServiceFeatureMod) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - related := o.f.NewArcgisServiceFeatureWithContext(ctx, mods...) - m.AddServiceFeatures(number, related).Apply(ctx, o) - }) -} - -func (m arcgisAccountMods) AddExistingServiceFeatures(existingModels ...*models.ArcgisServiceFeature) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - for _, em := range existingModels { - o.r.ServiceFeatures = append(o.r.ServiceFeatures, &arcgisAccountRServiceFeaturesR{ - o: o.f.FromExistingArcgisServiceFeature(em), - }) - } - }) -} - -func (m arcgisAccountMods) WithoutServiceFeatures() ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - o.r.ServiceFeatures = nil - }) -} - -func (m arcgisAccountMods) WithServiceMaps(number int, related *ArcgisServiceMapTemplate) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - o.r.ServiceMaps = []*arcgisAccountRServiceMapsR{{ - number: number, - o: related, - }} - }) -} - -func (m arcgisAccountMods) WithNewServiceMaps(number int, mods ...ArcgisServiceMapMod) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - related := o.f.NewArcgisServiceMapWithContext(ctx, mods...) - m.WithServiceMaps(number, related).Apply(ctx, o) - }) -} - -func (m arcgisAccountMods) AddServiceMaps(number int, related *ArcgisServiceMapTemplate) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - o.r.ServiceMaps = append(o.r.ServiceMaps, &arcgisAccountRServiceMapsR{ - number: number, - o: related, - }) - }) -} - -func (m arcgisAccountMods) AddNewServiceMaps(number int, mods ...ArcgisServiceMapMod) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - related := o.f.NewArcgisServiceMapWithContext(ctx, mods...) - m.AddServiceMaps(number, related).Apply(ctx, o) - }) -} - -func (m arcgisAccountMods) AddExistingServiceMaps(existingModels ...*models.ArcgisServiceMap) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - for _, em := range existingModels { - o.r.ServiceMaps = append(o.r.ServiceMaps, &arcgisAccountRServiceMapsR{ - o: o.f.FromExistingArcgisServiceMap(em), - }) - } - }) -} - -func (m arcgisAccountMods) WithoutServiceMaps() ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - o.r.ServiceMaps = nil - }) -} - -func (m arcgisAccountMods) WithArcgisAccountOrganizations(number int, related *OrganizationTemplate) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - o.r.ArcgisAccountOrganizations = []*arcgisAccountRArcgisAccountOrganizationsR{{ - number: number, - o: related, - }} - }) -} - -func (m arcgisAccountMods) WithNewArcgisAccountOrganizations(number int, mods ...OrganizationMod) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - m.WithArcgisAccountOrganizations(number, related).Apply(ctx, o) - }) -} - -func (m arcgisAccountMods) AddArcgisAccountOrganizations(number int, related *OrganizationTemplate) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - o.r.ArcgisAccountOrganizations = append(o.r.ArcgisAccountOrganizations, &arcgisAccountRArcgisAccountOrganizationsR{ - number: number, - o: related, - }) - }) -} - -func (m arcgisAccountMods) AddNewArcgisAccountOrganizations(number int, mods ...OrganizationMod) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - m.AddArcgisAccountOrganizations(number, related).Apply(ctx, o) - }) -} - -func (m arcgisAccountMods) AddExistingArcgisAccountOrganizations(existingModels ...*models.Organization) ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - for _, em := range existingModels { - o.r.ArcgisAccountOrganizations = append(o.r.ArcgisAccountOrganizations, &arcgisAccountRArcgisAccountOrganizationsR{ - o: o.f.FromExistingOrganization(em), - }) - } - }) -} - -func (m arcgisAccountMods) WithoutArcgisAccountOrganizations() ArcgisAccountMod { - return ArcgisAccountModFunc(func(ctx context.Context, o *ArcgisAccountTemplate) { - o.r.ArcgisAccountOrganizations = nil - }) -} diff --git a/db/factory/arcgis.address_mapping.bob.go b/db/factory/arcgis.address_mapping.bob.go deleted file mode 100644 index 3277c800..00000000 --- a/db/factory/arcgis.address_mapping.bob.go +++ /dev/null @@ -1,570 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - 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/jaswdr/faker/v2" -) - -type ArcgisAddressMappingMod interface { - Apply(context.Context, *ArcgisAddressMappingTemplate) -} - -type ArcgisAddressMappingModFunc func(context.Context, *ArcgisAddressMappingTemplate) - -func (f ArcgisAddressMappingModFunc) Apply(ctx context.Context, n *ArcgisAddressMappingTemplate) { - f(ctx, n) -} - -type ArcgisAddressMappingModSlice []ArcgisAddressMappingMod - -func (mods ArcgisAddressMappingModSlice) Apply(ctx context.Context, n *ArcgisAddressMappingTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// ArcgisAddressMappingTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type ArcgisAddressMappingTemplate struct { - Destination func() enums.ArcgisMappingdestinationaddress - LayerFeatureServiceItemID func() string - LayerIndex func() int32 - LayerFieldName func() string - OrganizationID func() int32 - - r arcgisAddressMappingR - f *Factory - - alreadyPersisted bool -} - -type arcgisAddressMappingR struct { - LayerField *arcgisAddressMappingRLayerFieldR - Organization *arcgisAddressMappingROrganizationR -} - -type arcgisAddressMappingRLayerFieldR struct { - o *ArcgisLayerFieldTemplate -} -type arcgisAddressMappingROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the ArcgisAddressMappingTemplate -func (o *ArcgisAddressMappingTemplate) Apply(ctx context.Context, mods ...ArcgisAddressMappingMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.ArcgisAddressMapping -// according to the relationships in the template. Nothing is inserted into the db -func (t ArcgisAddressMappingTemplate) setModelRels(o *models.ArcgisAddressMapping) { - if t.r.LayerField != nil { - rel := t.r.LayerField.o.Build() - rel.R.AddressMappings = append(rel.R.AddressMappings, o) - o.LayerFeatureServiceItemID = rel.LayerFeatureServiceItemID // h2 - o.LayerIndex = rel.LayerIndex // h2 - o.LayerFieldName = rel.Name // h2 - o.R.LayerField = rel - } - - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.AddressMappings = append(rel.R.AddressMappings, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.ArcgisAddressMappingSetter -// this does nothing with the relationship templates -func (o ArcgisAddressMappingTemplate) BuildSetter() *models.ArcgisAddressMappingSetter { - m := &models.ArcgisAddressMappingSetter{} - - if o.Destination != nil { - val := o.Destination() - m.Destination = omit.From(val) - } - if o.LayerFeatureServiceItemID != nil { - val := o.LayerFeatureServiceItemID() - m.LayerFeatureServiceItemID = omit.From(val) - } - if o.LayerIndex != nil { - val := o.LayerIndex() - m.LayerIndex = omit.From(val) - } - if o.LayerFieldName != nil { - val := o.LayerFieldName() - m.LayerFieldName = omit.From(val) - } - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.ArcgisAddressMappingSetter -// this does nothing with the relationship templates -func (o ArcgisAddressMappingTemplate) BuildManySetter(number int) []*models.ArcgisAddressMappingSetter { - m := make([]*models.ArcgisAddressMappingSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.ArcgisAddressMapping -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ArcgisAddressMappingTemplate.Create -func (o ArcgisAddressMappingTemplate) Build() *models.ArcgisAddressMapping { - m := &models.ArcgisAddressMapping{} - - if o.Destination != nil { - m.Destination = o.Destination() - } - if o.LayerFeatureServiceItemID != nil { - m.LayerFeatureServiceItemID = o.LayerFeatureServiceItemID() - } - if o.LayerIndex != nil { - m.LayerIndex = o.LayerIndex() - } - if o.LayerFieldName != nil { - m.LayerFieldName = o.LayerFieldName() - } - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.ArcgisAddressMappingSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ArcgisAddressMappingTemplate.CreateMany -func (o ArcgisAddressMappingTemplate) BuildMany(number int) models.ArcgisAddressMappingSlice { - m := make(models.ArcgisAddressMappingSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableArcgisAddressMapping(m *models.ArcgisAddressMappingSetter) { - if !(m.Destination.IsValue()) { - val := random_enums_ArcgisMappingdestinationaddress(nil) - m.Destination = omit.From(val) - } - if !(m.LayerFeatureServiceItemID.IsValue()) { - val := random_string(nil) - m.LayerFeatureServiceItemID = omit.From(val) - } - if !(m.LayerIndex.IsValue()) { - val := random_int32(nil) - m.LayerIndex = omit.From(val) - } - if !(m.LayerFieldName.IsValue()) { - val := random_string(nil) - m.LayerFieldName = 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.ArcgisAddressMapping -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *ArcgisAddressMappingTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.ArcgisAddressMapping) error { - var err error - - return err -} - -// Create builds a arcgisAddressMapping and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *ArcgisAddressMappingTemplate) Create(ctx context.Context, exec bob.Executor) (*models.ArcgisAddressMapping, error) { - var err error - opt := o.BuildSetter() - ensureCreatableArcgisAddressMapping(opt) - - if o.r.LayerField == nil { - ArcgisAddressMappingMods.WithNewLayerField().Apply(ctx, o) - } - - var rel0 *models.ArcgisLayerField - - if o.r.LayerField.o.alreadyPersisted { - rel0 = o.r.LayerField.o.Build() - } else { - rel0, err = o.r.LayerField.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.LayerFeatureServiceItemID = omit.From(rel0.LayerFeatureServiceItemID) - opt.LayerIndex = omit.From(rel0.LayerIndex) - opt.LayerFieldName = omit.From(rel0.Name) - - if o.r.Organization == nil { - ArcgisAddressMappingMods.WithNewOrganization().Apply(ctx, o) - } - - var rel1 *models.Organization - - if o.r.Organization.o.alreadyPersisted { - rel1 = o.r.Organization.o.Build() - } else { - rel1, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.OrganizationID = omit.From(rel1.ID) - - m, err := models.ArcgisAddressMappings.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.LayerField = rel0 - m.R.Organization = rel1 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a arcgisAddressMapping and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *ArcgisAddressMappingTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.ArcgisAddressMapping { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a arcgisAddressMapping 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 *ArcgisAddressMappingTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.ArcgisAddressMapping { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple arcgisAddressMappings and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o ArcgisAddressMappingTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.ArcgisAddressMappingSlice, error) { - var err error - m := make(models.ArcgisAddressMappingSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple arcgisAddressMappings and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o ArcgisAddressMappingTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.ArcgisAddressMappingSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple arcgisAddressMappings 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 ArcgisAddressMappingTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.ArcgisAddressMappingSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// ArcgisAddressMapping has methods that act as mods for the ArcgisAddressMappingTemplate -var ArcgisAddressMappingMods arcgisAddressMappingMods - -type arcgisAddressMappingMods struct{} - -func (m arcgisAddressMappingMods) RandomizeAllColumns(f *faker.Faker) ArcgisAddressMappingMod { - return ArcgisAddressMappingModSlice{ - ArcgisAddressMappingMods.RandomDestination(f), - ArcgisAddressMappingMods.RandomLayerFeatureServiceItemID(f), - ArcgisAddressMappingMods.RandomLayerIndex(f), - ArcgisAddressMappingMods.RandomLayerFieldName(f), - ArcgisAddressMappingMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m arcgisAddressMappingMods) Destination(val enums.ArcgisMappingdestinationaddress) ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(_ context.Context, o *ArcgisAddressMappingTemplate) { - o.Destination = func() enums.ArcgisMappingdestinationaddress { return val } - }) -} - -// Set the Column from the function -func (m arcgisAddressMappingMods) DestinationFunc(f func() enums.ArcgisMappingdestinationaddress) ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(_ context.Context, o *ArcgisAddressMappingTemplate) { - o.Destination = f - }) -} - -// Clear any values for the column -func (m arcgisAddressMappingMods) UnsetDestination() ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(_ context.Context, o *ArcgisAddressMappingTemplate) { - o.Destination = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisAddressMappingMods) RandomDestination(f *faker.Faker) ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(_ context.Context, o *ArcgisAddressMappingTemplate) { - o.Destination = func() enums.ArcgisMappingdestinationaddress { - return random_enums_ArcgisMappingdestinationaddress(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisAddressMappingMods) LayerFeatureServiceItemID(val string) ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(_ context.Context, o *ArcgisAddressMappingTemplate) { - o.LayerFeatureServiceItemID = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisAddressMappingMods) LayerFeatureServiceItemIDFunc(f func() string) ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(_ context.Context, o *ArcgisAddressMappingTemplate) { - o.LayerFeatureServiceItemID = f - }) -} - -// Clear any values for the column -func (m arcgisAddressMappingMods) UnsetLayerFeatureServiceItemID() ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(_ context.Context, o *ArcgisAddressMappingTemplate) { - o.LayerFeatureServiceItemID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisAddressMappingMods) RandomLayerFeatureServiceItemID(f *faker.Faker) ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(_ context.Context, o *ArcgisAddressMappingTemplate) { - o.LayerFeatureServiceItemID = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisAddressMappingMods) LayerIndex(val int32) ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(_ context.Context, o *ArcgisAddressMappingTemplate) { - o.LayerIndex = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m arcgisAddressMappingMods) LayerIndexFunc(f func() int32) ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(_ context.Context, o *ArcgisAddressMappingTemplate) { - o.LayerIndex = f - }) -} - -// Clear any values for the column -func (m arcgisAddressMappingMods) UnsetLayerIndex() ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(_ context.Context, o *ArcgisAddressMappingTemplate) { - o.LayerIndex = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisAddressMappingMods) RandomLayerIndex(f *faker.Faker) ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(_ context.Context, o *ArcgisAddressMappingTemplate) { - o.LayerIndex = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisAddressMappingMods) LayerFieldName(val string) ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(_ context.Context, o *ArcgisAddressMappingTemplate) { - o.LayerFieldName = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisAddressMappingMods) LayerFieldNameFunc(f func() string) ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(_ context.Context, o *ArcgisAddressMappingTemplate) { - o.LayerFieldName = f - }) -} - -// Clear any values for the column -func (m arcgisAddressMappingMods) UnsetLayerFieldName() ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(_ context.Context, o *ArcgisAddressMappingTemplate) { - o.LayerFieldName = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisAddressMappingMods) RandomLayerFieldName(f *faker.Faker) ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(_ context.Context, o *ArcgisAddressMappingTemplate) { - o.LayerFieldName = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisAddressMappingMods) OrganizationID(val int32) ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(_ context.Context, o *ArcgisAddressMappingTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m arcgisAddressMappingMods) OrganizationIDFunc(f func() int32) ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(_ context.Context, o *ArcgisAddressMappingTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m arcgisAddressMappingMods) UnsetOrganizationID() ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(_ context.Context, o *ArcgisAddressMappingTemplate) { - 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 arcgisAddressMappingMods) RandomOrganizationID(f *faker.Faker) ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(_ context.Context, o *ArcgisAddressMappingTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -func (m arcgisAddressMappingMods) WithParentsCascading() ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(ctx context.Context, o *ArcgisAddressMappingTemplate) { - if isDone, _ := arcgisAddressMappingWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = arcgisAddressMappingWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewArcgisLayerFieldWithContext(ctx, ArcgisLayerFieldMods.WithParentsCascading()) - m.WithLayerField(related).Apply(ctx, o) - } - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m arcgisAddressMappingMods) WithLayerField(rel *ArcgisLayerFieldTemplate) ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(ctx context.Context, o *ArcgisAddressMappingTemplate) { - o.r.LayerField = &arcgisAddressMappingRLayerFieldR{ - o: rel, - } - }) -} - -func (m arcgisAddressMappingMods) WithNewLayerField(mods ...ArcgisLayerFieldMod) ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(ctx context.Context, o *ArcgisAddressMappingTemplate) { - related := o.f.NewArcgisLayerFieldWithContext(ctx, mods...) - - m.WithLayerField(related).Apply(ctx, o) - }) -} - -func (m arcgisAddressMappingMods) WithExistingLayerField(em *models.ArcgisLayerField) ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(ctx context.Context, o *ArcgisAddressMappingTemplate) { - o.r.LayerField = &arcgisAddressMappingRLayerFieldR{ - o: o.f.FromExistingArcgisLayerField(em), - } - }) -} - -func (m arcgisAddressMappingMods) WithoutLayerField() ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(ctx context.Context, o *ArcgisAddressMappingTemplate) { - o.r.LayerField = nil - }) -} - -func (m arcgisAddressMappingMods) WithOrganization(rel *OrganizationTemplate) ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(ctx context.Context, o *ArcgisAddressMappingTemplate) { - o.r.Organization = &arcgisAddressMappingROrganizationR{ - o: rel, - } - }) -} - -func (m arcgisAddressMappingMods) WithNewOrganization(mods ...OrganizationMod) ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(ctx context.Context, o *ArcgisAddressMappingTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m arcgisAddressMappingMods) WithExistingOrganization(em *models.Organization) ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(ctx context.Context, o *ArcgisAddressMappingTemplate) { - o.r.Organization = &arcgisAddressMappingROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m arcgisAddressMappingMods) WithoutOrganization() ArcgisAddressMappingMod { - return ArcgisAddressMappingModFunc(func(ctx context.Context, o *ArcgisAddressMappingTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/arcgis.layer.bob.go b/db/factory/arcgis.layer.bob.go deleted file mode 100644 index 8bd5332b..00000000 --- a/db/factory/arcgis.layer.bob.go +++ /dev/null @@ -1,500 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/omit" - "github.com/jaswdr/faker/v2" -) - -type ArcgisLayerMod interface { - Apply(context.Context, *ArcgisLayerTemplate) -} - -type ArcgisLayerModFunc func(context.Context, *ArcgisLayerTemplate) - -func (f ArcgisLayerModFunc) Apply(ctx context.Context, n *ArcgisLayerTemplate) { - f(ctx, n) -} - -type ArcgisLayerModSlice []ArcgisLayerMod - -func (mods ArcgisLayerModSlice) Apply(ctx context.Context, n *ArcgisLayerTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// ArcgisLayerTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type ArcgisLayerTemplate struct { - Extent func() string - FeatureServiceItemID func() string - Index func() int32 - - r arcgisLayerR - f *Factory - - alreadyPersisted bool -} - -type arcgisLayerR struct { - FeatureServiceItemServiceFeature *arcgisLayerRFeatureServiceItemServiceFeatureR - LayerFields []*arcgisLayerRLayerFieldsR -} - -type arcgisLayerRFeatureServiceItemServiceFeatureR struct { - o *ArcgisServiceFeatureTemplate -} -type arcgisLayerRLayerFieldsR struct { - number int - o *ArcgisLayerFieldTemplate -} - -// Apply mods to the ArcgisLayerTemplate -func (o *ArcgisLayerTemplate) Apply(ctx context.Context, mods ...ArcgisLayerMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.ArcgisLayer -// according to the relationships in the template. Nothing is inserted into the db -func (t ArcgisLayerTemplate) setModelRels(o *models.ArcgisLayer) { - if t.r.FeatureServiceItemServiceFeature != nil { - rel := t.r.FeatureServiceItemServiceFeature.o.Build() - rel.R.FeatureServiceItemLayers = append(rel.R.FeatureServiceItemLayers, o) - o.FeatureServiceItemID = rel.ItemID // h2 - o.R.FeatureServiceItemServiceFeature = rel - } - - if t.r.LayerFields != nil { - rel := models.ArcgisLayerFieldSlice{} - for _, r := range t.r.LayerFields { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.LayerFeatureServiceItemID = o.FeatureServiceItemID // h2 - rel.LayerIndex = o.Index // h2 - rel.R.Layer = o - } - rel = append(rel, related...) - } - o.R.LayerFields = rel - } -} - -// BuildSetter returns an *models.ArcgisLayerSetter -// this does nothing with the relationship templates -func (o ArcgisLayerTemplate) BuildSetter() *models.ArcgisLayerSetter { - m := &models.ArcgisLayerSetter{} - - if o.Extent != nil { - val := o.Extent() - m.Extent = omit.From(val) - } - if o.FeatureServiceItemID != nil { - val := o.FeatureServiceItemID() - m.FeatureServiceItemID = omit.From(val) - } - if o.Index != nil { - val := o.Index() - m.Index = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.ArcgisLayerSetter -// this does nothing with the relationship templates -func (o ArcgisLayerTemplate) BuildManySetter(number int) []*models.ArcgisLayerSetter { - m := make([]*models.ArcgisLayerSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.ArcgisLayer -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ArcgisLayerTemplate.Create -func (o ArcgisLayerTemplate) Build() *models.ArcgisLayer { - m := &models.ArcgisLayer{} - - if o.Extent != nil { - m.Extent = o.Extent() - } - if o.FeatureServiceItemID != nil { - m.FeatureServiceItemID = o.FeatureServiceItemID() - } - if o.Index != nil { - m.Index = o.Index() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.ArcgisLayerSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ArcgisLayerTemplate.CreateMany -func (o ArcgisLayerTemplate) BuildMany(number int) models.ArcgisLayerSlice { - m := make(models.ArcgisLayerSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableArcgisLayer(m *models.ArcgisLayerSetter) { - if !(m.Extent.IsValue()) { - val := random_string(nil) - m.Extent = omit.From(val) - } - if !(m.FeatureServiceItemID.IsValue()) { - val := random_string(nil) - m.FeatureServiceItemID = omit.From(val) - } - if !(m.Index.IsValue()) { - val := random_int32(nil) - m.Index = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.ArcgisLayer -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *ArcgisLayerTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.ArcgisLayer) error { - var err error - - isLayerFieldsDone, _ := arcgisLayerRelLayerFieldsCtx.Value(ctx) - if !isLayerFieldsDone && o.r.LayerFields != nil { - ctx = arcgisLayerRelLayerFieldsCtx.WithValue(ctx, true) - for _, r := range o.r.LayerFields { - if r.o.alreadyPersisted { - m.R.LayerFields = append(m.R.LayerFields, r.o.Build()) - } else { - rel1, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachLayerFields(ctx, exec, rel1...) - if err != nil { - return err - } - } - } - } - - return err -} - -// Create builds a arcgisLayer and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *ArcgisLayerTemplate) Create(ctx context.Context, exec bob.Executor) (*models.ArcgisLayer, error) { - var err error - opt := o.BuildSetter() - ensureCreatableArcgisLayer(opt) - - if o.r.FeatureServiceItemServiceFeature == nil { - ArcgisLayerMods.WithNewFeatureServiceItemServiceFeature().Apply(ctx, o) - } - - var rel0 *models.ArcgisServiceFeature - - if o.r.FeatureServiceItemServiceFeature.o.alreadyPersisted { - rel0 = o.r.FeatureServiceItemServiceFeature.o.Build() - } else { - rel0, err = o.r.FeatureServiceItemServiceFeature.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.FeatureServiceItemID = omit.From(rel0.ItemID) - - m, err := models.ArcgisLayers.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.FeatureServiceItemServiceFeature = rel0 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a arcgisLayer and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *ArcgisLayerTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.ArcgisLayer { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a arcgisLayer 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 *ArcgisLayerTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.ArcgisLayer { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple arcgisLayers and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o ArcgisLayerTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.ArcgisLayerSlice, error) { - var err error - m := make(models.ArcgisLayerSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple arcgisLayers and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o ArcgisLayerTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.ArcgisLayerSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple arcgisLayers 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 ArcgisLayerTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.ArcgisLayerSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// ArcgisLayer has methods that act as mods for the ArcgisLayerTemplate -var ArcgisLayerMods arcgisLayerMods - -type arcgisLayerMods struct{} - -func (m arcgisLayerMods) RandomizeAllColumns(f *faker.Faker) ArcgisLayerMod { - return ArcgisLayerModSlice{ - ArcgisLayerMods.RandomExtent(f), - ArcgisLayerMods.RandomFeatureServiceItemID(f), - ArcgisLayerMods.RandomIndex(f), - } -} - -// Set the model columns to this value -func (m arcgisLayerMods) Extent(val string) ArcgisLayerMod { - return ArcgisLayerModFunc(func(_ context.Context, o *ArcgisLayerTemplate) { - o.Extent = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisLayerMods) ExtentFunc(f func() string) ArcgisLayerMod { - return ArcgisLayerModFunc(func(_ context.Context, o *ArcgisLayerTemplate) { - o.Extent = f - }) -} - -// Clear any values for the column -func (m arcgisLayerMods) UnsetExtent() ArcgisLayerMod { - return ArcgisLayerModFunc(func(_ context.Context, o *ArcgisLayerTemplate) { - o.Extent = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisLayerMods) RandomExtent(f *faker.Faker) ArcgisLayerMod { - return ArcgisLayerModFunc(func(_ context.Context, o *ArcgisLayerTemplate) { - o.Extent = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisLayerMods) FeatureServiceItemID(val string) ArcgisLayerMod { - return ArcgisLayerModFunc(func(_ context.Context, o *ArcgisLayerTemplate) { - o.FeatureServiceItemID = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisLayerMods) FeatureServiceItemIDFunc(f func() string) ArcgisLayerMod { - return ArcgisLayerModFunc(func(_ context.Context, o *ArcgisLayerTemplate) { - o.FeatureServiceItemID = f - }) -} - -// Clear any values for the column -func (m arcgisLayerMods) UnsetFeatureServiceItemID() ArcgisLayerMod { - return ArcgisLayerModFunc(func(_ context.Context, o *ArcgisLayerTemplate) { - o.FeatureServiceItemID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisLayerMods) RandomFeatureServiceItemID(f *faker.Faker) ArcgisLayerMod { - return ArcgisLayerModFunc(func(_ context.Context, o *ArcgisLayerTemplate) { - o.FeatureServiceItemID = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisLayerMods) Index(val int32) ArcgisLayerMod { - return ArcgisLayerModFunc(func(_ context.Context, o *ArcgisLayerTemplate) { - o.Index = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m arcgisLayerMods) IndexFunc(f func() int32) ArcgisLayerMod { - return ArcgisLayerModFunc(func(_ context.Context, o *ArcgisLayerTemplate) { - o.Index = f - }) -} - -// Clear any values for the column -func (m arcgisLayerMods) UnsetIndex() ArcgisLayerMod { - return ArcgisLayerModFunc(func(_ context.Context, o *ArcgisLayerTemplate) { - o.Index = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisLayerMods) RandomIndex(f *faker.Faker) ArcgisLayerMod { - return ArcgisLayerModFunc(func(_ context.Context, o *ArcgisLayerTemplate) { - o.Index = func() int32 { - return random_int32(f) - } - }) -} - -func (m arcgisLayerMods) WithParentsCascading() ArcgisLayerMod { - return ArcgisLayerModFunc(func(ctx context.Context, o *ArcgisLayerTemplate) { - if isDone, _ := arcgisLayerWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = arcgisLayerWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewArcgisServiceFeatureWithContext(ctx, ArcgisServiceFeatureMods.WithParentsCascading()) - m.WithFeatureServiceItemServiceFeature(related).Apply(ctx, o) - } - }) -} - -func (m arcgisLayerMods) WithFeatureServiceItemServiceFeature(rel *ArcgisServiceFeatureTemplate) ArcgisLayerMod { - return ArcgisLayerModFunc(func(ctx context.Context, o *ArcgisLayerTemplate) { - o.r.FeatureServiceItemServiceFeature = &arcgisLayerRFeatureServiceItemServiceFeatureR{ - o: rel, - } - }) -} - -func (m arcgisLayerMods) WithNewFeatureServiceItemServiceFeature(mods ...ArcgisServiceFeatureMod) ArcgisLayerMod { - return ArcgisLayerModFunc(func(ctx context.Context, o *ArcgisLayerTemplate) { - related := o.f.NewArcgisServiceFeatureWithContext(ctx, mods...) - - m.WithFeatureServiceItemServiceFeature(related).Apply(ctx, o) - }) -} - -func (m arcgisLayerMods) WithExistingFeatureServiceItemServiceFeature(em *models.ArcgisServiceFeature) ArcgisLayerMod { - return ArcgisLayerModFunc(func(ctx context.Context, o *ArcgisLayerTemplate) { - o.r.FeatureServiceItemServiceFeature = &arcgisLayerRFeatureServiceItemServiceFeatureR{ - o: o.f.FromExistingArcgisServiceFeature(em), - } - }) -} - -func (m arcgisLayerMods) WithoutFeatureServiceItemServiceFeature() ArcgisLayerMod { - return ArcgisLayerModFunc(func(ctx context.Context, o *ArcgisLayerTemplate) { - o.r.FeatureServiceItemServiceFeature = nil - }) -} - -func (m arcgisLayerMods) WithLayerFields(number int, related *ArcgisLayerFieldTemplate) ArcgisLayerMod { - return ArcgisLayerModFunc(func(ctx context.Context, o *ArcgisLayerTemplate) { - o.r.LayerFields = []*arcgisLayerRLayerFieldsR{{ - number: number, - o: related, - }} - }) -} - -func (m arcgisLayerMods) WithNewLayerFields(number int, mods ...ArcgisLayerFieldMod) ArcgisLayerMod { - return ArcgisLayerModFunc(func(ctx context.Context, o *ArcgisLayerTemplate) { - related := o.f.NewArcgisLayerFieldWithContext(ctx, mods...) - m.WithLayerFields(number, related).Apply(ctx, o) - }) -} - -func (m arcgisLayerMods) AddLayerFields(number int, related *ArcgisLayerFieldTemplate) ArcgisLayerMod { - return ArcgisLayerModFunc(func(ctx context.Context, o *ArcgisLayerTemplate) { - o.r.LayerFields = append(o.r.LayerFields, &arcgisLayerRLayerFieldsR{ - number: number, - o: related, - }) - }) -} - -func (m arcgisLayerMods) AddNewLayerFields(number int, mods ...ArcgisLayerFieldMod) ArcgisLayerMod { - return ArcgisLayerModFunc(func(ctx context.Context, o *ArcgisLayerTemplate) { - related := o.f.NewArcgisLayerFieldWithContext(ctx, mods...) - m.AddLayerFields(number, related).Apply(ctx, o) - }) -} - -func (m arcgisLayerMods) AddExistingLayerFields(existingModels ...*models.ArcgisLayerField) ArcgisLayerMod { - return ArcgisLayerModFunc(func(ctx context.Context, o *ArcgisLayerTemplate) { - for _, em := range existingModels { - o.r.LayerFields = append(o.r.LayerFields, &arcgisLayerRLayerFieldsR{ - o: o.f.FromExistingArcgisLayerField(em), - }) - } - }) -} - -func (m arcgisLayerMods) WithoutLayerFields() ArcgisLayerMod { - return ArcgisLayerModFunc(func(ctx context.Context, o *ArcgisLayerTemplate) { - o.r.LayerFields = nil - }) -} diff --git a/db/factory/arcgis.layer_field.bob.go b/db/factory/arcgis.layer_field.bob.go deleted file mode 100644 index 5faea2ce..00000000 --- a/db/factory/arcgis.layer_field.bob.go +++ /dev/null @@ -1,636 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - 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/jaswdr/faker/v2" -) - -type ArcgisLayerFieldMod interface { - Apply(context.Context, *ArcgisLayerFieldTemplate) -} - -type ArcgisLayerFieldModFunc func(context.Context, *ArcgisLayerFieldTemplate) - -func (f ArcgisLayerFieldModFunc) Apply(ctx context.Context, n *ArcgisLayerFieldTemplate) { - f(ctx, n) -} - -type ArcgisLayerFieldModSlice []ArcgisLayerFieldMod - -func (mods ArcgisLayerFieldModSlice) Apply(ctx context.Context, n *ArcgisLayerFieldTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// ArcgisLayerFieldTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type ArcgisLayerFieldTemplate struct { - LayerFeatureServiceItemID func() string - LayerIndex func() int32 - Name func() string - Type func() enums.ArcgisFieldtype - - r arcgisLayerFieldR - f *Factory - - alreadyPersisted bool -} - -type arcgisLayerFieldR struct { - AddressMappings []*arcgisLayerFieldRAddressMappingsR - Layer *arcgisLayerFieldRLayerR - ParcelMappings []*arcgisLayerFieldRParcelMappingsR -} - -type arcgisLayerFieldRAddressMappingsR struct { - number int - o *ArcgisAddressMappingTemplate -} -type arcgisLayerFieldRLayerR struct { - o *ArcgisLayerTemplate -} -type arcgisLayerFieldRParcelMappingsR struct { - number int - o *ArcgisParcelMappingTemplate -} - -// Apply mods to the ArcgisLayerFieldTemplate -func (o *ArcgisLayerFieldTemplate) Apply(ctx context.Context, mods ...ArcgisLayerFieldMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.ArcgisLayerField -// according to the relationships in the template. Nothing is inserted into the db -func (t ArcgisLayerFieldTemplate) setModelRels(o *models.ArcgisLayerField) { - if t.r.AddressMappings != nil { - rel := models.ArcgisAddressMappingSlice{} - for _, r := range t.r.AddressMappings { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.LayerFeatureServiceItemID = o.LayerFeatureServiceItemID // h2 - rel.LayerIndex = o.LayerIndex // h2 - rel.LayerFieldName = o.Name // h2 - rel.R.LayerField = o - } - rel = append(rel, related...) - } - o.R.AddressMappings = rel - } - - if t.r.Layer != nil { - rel := t.r.Layer.o.Build() - rel.R.LayerFields = append(rel.R.LayerFields, o) - o.LayerFeatureServiceItemID = rel.FeatureServiceItemID // h2 - o.LayerIndex = rel.Index // h2 - o.R.Layer = rel - } - - if t.r.ParcelMappings != nil { - rel := models.ArcgisParcelMappingSlice{} - for _, r := range t.r.ParcelMappings { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.LayerFeatureServiceItemID = o.LayerFeatureServiceItemID // h2 - rel.LayerIndex = o.LayerIndex // h2 - rel.LayerFieldName = o.Name // h2 - rel.R.LayerField = o - } - rel = append(rel, related...) - } - o.R.ParcelMappings = rel - } -} - -// BuildSetter returns an *models.ArcgisLayerFieldSetter -// this does nothing with the relationship templates -func (o ArcgisLayerFieldTemplate) BuildSetter() *models.ArcgisLayerFieldSetter { - m := &models.ArcgisLayerFieldSetter{} - - if o.LayerFeatureServiceItemID != nil { - val := o.LayerFeatureServiceItemID() - m.LayerFeatureServiceItemID = omit.From(val) - } - if o.LayerIndex != nil { - val := o.LayerIndex() - m.LayerIndex = omit.From(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omit.From(val) - } - if o.Type != nil { - val := o.Type() - m.Type = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.ArcgisLayerFieldSetter -// this does nothing with the relationship templates -func (o ArcgisLayerFieldTemplate) BuildManySetter(number int) []*models.ArcgisLayerFieldSetter { - m := make([]*models.ArcgisLayerFieldSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.ArcgisLayerField -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ArcgisLayerFieldTemplate.Create -func (o ArcgisLayerFieldTemplate) Build() *models.ArcgisLayerField { - m := &models.ArcgisLayerField{} - - if o.LayerFeatureServiceItemID != nil { - m.LayerFeatureServiceItemID = o.LayerFeatureServiceItemID() - } - if o.LayerIndex != nil { - m.LayerIndex = o.LayerIndex() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Type != nil { - m.Type = o.Type() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.ArcgisLayerFieldSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ArcgisLayerFieldTemplate.CreateMany -func (o ArcgisLayerFieldTemplate) BuildMany(number int) models.ArcgisLayerFieldSlice { - m := make(models.ArcgisLayerFieldSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableArcgisLayerField(m *models.ArcgisLayerFieldSetter) { - if !(m.LayerFeatureServiceItemID.IsValue()) { - val := random_string(nil) - m.LayerFeatureServiceItemID = omit.From(val) - } - if !(m.LayerIndex.IsValue()) { - val := random_int32(nil) - m.LayerIndex = omit.From(val) - } - if !(m.Name.IsValue()) { - val := random_string(nil) - m.Name = omit.From(val) - } - if !(m.Type.IsValue()) { - val := random_enums_ArcgisFieldtype(nil) - m.Type = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.ArcgisLayerField -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *ArcgisLayerFieldTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.ArcgisLayerField) error { - var err error - - isAddressMappingsDone, _ := arcgisLayerFieldRelAddressMappingsCtx.Value(ctx) - if !isAddressMappingsDone && o.r.AddressMappings != nil { - ctx = arcgisLayerFieldRelAddressMappingsCtx.WithValue(ctx, true) - for _, r := range o.r.AddressMappings { - if r.o.alreadyPersisted { - m.R.AddressMappings = append(m.R.AddressMappings, r.o.Build()) - } else { - rel0, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachAddressMappings(ctx, exec, rel0...) - if err != nil { - return err - } - } - } - } - - isParcelMappingsDone, _ := arcgisLayerFieldRelParcelMappingsCtx.Value(ctx) - if !isParcelMappingsDone && o.r.ParcelMappings != nil { - ctx = arcgisLayerFieldRelParcelMappingsCtx.WithValue(ctx, true) - for _, r := range o.r.ParcelMappings { - if r.o.alreadyPersisted { - m.R.ParcelMappings = append(m.R.ParcelMappings, r.o.Build()) - } else { - rel2, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachParcelMappings(ctx, exec, rel2...) - if err != nil { - return err - } - } - } - } - - return err -} - -// Create builds a arcgisLayerField and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *ArcgisLayerFieldTemplate) Create(ctx context.Context, exec bob.Executor) (*models.ArcgisLayerField, error) { - var err error - opt := o.BuildSetter() - ensureCreatableArcgisLayerField(opt) - - if o.r.Layer == nil { - ArcgisLayerFieldMods.WithNewLayer().Apply(ctx, o) - } - - var rel1 *models.ArcgisLayer - - if o.r.Layer.o.alreadyPersisted { - rel1 = o.r.Layer.o.Build() - } else { - rel1, err = o.r.Layer.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.LayerFeatureServiceItemID = omit.From(rel1.FeatureServiceItemID) - opt.LayerIndex = omit.From(rel1.Index) - - m, err := models.ArcgisLayerFields.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.Layer = rel1 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a arcgisLayerField and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *ArcgisLayerFieldTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.ArcgisLayerField { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a arcgisLayerField 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 *ArcgisLayerFieldTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.ArcgisLayerField { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple arcgisLayerFields and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o ArcgisLayerFieldTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.ArcgisLayerFieldSlice, error) { - var err error - m := make(models.ArcgisLayerFieldSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple arcgisLayerFields and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o ArcgisLayerFieldTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.ArcgisLayerFieldSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple arcgisLayerFields 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 ArcgisLayerFieldTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.ArcgisLayerFieldSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// ArcgisLayerField has methods that act as mods for the ArcgisLayerFieldTemplate -var ArcgisLayerFieldMods arcgisLayerFieldMods - -type arcgisLayerFieldMods struct{} - -func (m arcgisLayerFieldMods) RandomizeAllColumns(f *faker.Faker) ArcgisLayerFieldMod { - return ArcgisLayerFieldModSlice{ - ArcgisLayerFieldMods.RandomLayerFeatureServiceItemID(f), - ArcgisLayerFieldMods.RandomLayerIndex(f), - ArcgisLayerFieldMods.RandomName(f), - ArcgisLayerFieldMods.RandomType(f), - } -} - -// Set the model columns to this value -func (m arcgisLayerFieldMods) LayerFeatureServiceItemID(val string) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(_ context.Context, o *ArcgisLayerFieldTemplate) { - o.LayerFeatureServiceItemID = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisLayerFieldMods) LayerFeatureServiceItemIDFunc(f func() string) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(_ context.Context, o *ArcgisLayerFieldTemplate) { - o.LayerFeatureServiceItemID = f - }) -} - -// Clear any values for the column -func (m arcgisLayerFieldMods) UnsetLayerFeatureServiceItemID() ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(_ context.Context, o *ArcgisLayerFieldTemplate) { - o.LayerFeatureServiceItemID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisLayerFieldMods) RandomLayerFeatureServiceItemID(f *faker.Faker) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(_ context.Context, o *ArcgisLayerFieldTemplate) { - o.LayerFeatureServiceItemID = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisLayerFieldMods) LayerIndex(val int32) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(_ context.Context, o *ArcgisLayerFieldTemplate) { - o.LayerIndex = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m arcgisLayerFieldMods) LayerIndexFunc(f func() int32) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(_ context.Context, o *ArcgisLayerFieldTemplate) { - o.LayerIndex = f - }) -} - -// Clear any values for the column -func (m arcgisLayerFieldMods) UnsetLayerIndex() ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(_ context.Context, o *ArcgisLayerFieldTemplate) { - o.LayerIndex = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisLayerFieldMods) RandomLayerIndex(f *faker.Faker) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(_ context.Context, o *ArcgisLayerFieldTemplate) { - o.LayerIndex = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisLayerFieldMods) Name(val string) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(_ context.Context, o *ArcgisLayerFieldTemplate) { - o.Name = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisLayerFieldMods) NameFunc(f func() string) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(_ context.Context, o *ArcgisLayerFieldTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m arcgisLayerFieldMods) UnsetName() ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(_ context.Context, o *ArcgisLayerFieldTemplate) { - o.Name = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisLayerFieldMods) RandomName(f *faker.Faker) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(_ context.Context, o *ArcgisLayerFieldTemplate) { - o.Name = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisLayerFieldMods) Type(val enums.ArcgisFieldtype) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(_ context.Context, o *ArcgisLayerFieldTemplate) { - o.Type = func() enums.ArcgisFieldtype { return val } - }) -} - -// Set the Column from the function -func (m arcgisLayerFieldMods) TypeFunc(f func() enums.ArcgisFieldtype) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(_ context.Context, o *ArcgisLayerFieldTemplate) { - o.Type = f - }) -} - -// Clear any values for the column -func (m arcgisLayerFieldMods) UnsetType() ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(_ context.Context, o *ArcgisLayerFieldTemplate) { - 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 arcgisLayerFieldMods) RandomType(f *faker.Faker) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(_ context.Context, o *ArcgisLayerFieldTemplate) { - o.Type = func() enums.ArcgisFieldtype { - return random_enums_ArcgisFieldtype(f) - } - }) -} - -func (m arcgisLayerFieldMods) WithParentsCascading() ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(ctx context.Context, o *ArcgisLayerFieldTemplate) { - if isDone, _ := arcgisLayerFieldWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = arcgisLayerFieldWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewArcgisLayerWithContext(ctx, ArcgisLayerMods.WithParentsCascading()) - m.WithLayer(related).Apply(ctx, o) - } - }) -} - -func (m arcgisLayerFieldMods) WithLayer(rel *ArcgisLayerTemplate) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(ctx context.Context, o *ArcgisLayerFieldTemplate) { - o.r.Layer = &arcgisLayerFieldRLayerR{ - o: rel, - } - }) -} - -func (m arcgisLayerFieldMods) WithNewLayer(mods ...ArcgisLayerMod) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(ctx context.Context, o *ArcgisLayerFieldTemplate) { - related := o.f.NewArcgisLayerWithContext(ctx, mods...) - - m.WithLayer(related).Apply(ctx, o) - }) -} - -func (m arcgisLayerFieldMods) WithExistingLayer(em *models.ArcgisLayer) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(ctx context.Context, o *ArcgisLayerFieldTemplate) { - o.r.Layer = &arcgisLayerFieldRLayerR{ - o: o.f.FromExistingArcgisLayer(em), - } - }) -} - -func (m arcgisLayerFieldMods) WithoutLayer() ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(ctx context.Context, o *ArcgisLayerFieldTemplate) { - o.r.Layer = nil - }) -} - -func (m arcgisLayerFieldMods) WithAddressMappings(number int, related *ArcgisAddressMappingTemplate) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(ctx context.Context, o *ArcgisLayerFieldTemplate) { - o.r.AddressMappings = []*arcgisLayerFieldRAddressMappingsR{{ - number: number, - o: related, - }} - }) -} - -func (m arcgisLayerFieldMods) WithNewAddressMappings(number int, mods ...ArcgisAddressMappingMod) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(ctx context.Context, o *ArcgisLayerFieldTemplate) { - related := o.f.NewArcgisAddressMappingWithContext(ctx, mods...) - m.WithAddressMappings(number, related).Apply(ctx, o) - }) -} - -func (m arcgisLayerFieldMods) AddAddressMappings(number int, related *ArcgisAddressMappingTemplate) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(ctx context.Context, o *ArcgisLayerFieldTemplate) { - o.r.AddressMappings = append(o.r.AddressMappings, &arcgisLayerFieldRAddressMappingsR{ - number: number, - o: related, - }) - }) -} - -func (m arcgisLayerFieldMods) AddNewAddressMappings(number int, mods ...ArcgisAddressMappingMod) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(ctx context.Context, o *ArcgisLayerFieldTemplate) { - related := o.f.NewArcgisAddressMappingWithContext(ctx, mods...) - m.AddAddressMappings(number, related).Apply(ctx, o) - }) -} - -func (m arcgisLayerFieldMods) AddExistingAddressMappings(existingModels ...*models.ArcgisAddressMapping) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(ctx context.Context, o *ArcgisLayerFieldTemplate) { - for _, em := range existingModels { - o.r.AddressMappings = append(o.r.AddressMappings, &arcgisLayerFieldRAddressMappingsR{ - o: o.f.FromExistingArcgisAddressMapping(em), - }) - } - }) -} - -func (m arcgisLayerFieldMods) WithoutAddressMappings() ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(ctx context.Context, o *ArcgisLayerFieldTemplate) { - o.r.AddressMappings = nil - }) -} - -func (m arcgisLayerFieldMods) WithParcelMappings(number int, related *ArcgisParcelMappingTemplate) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(ctx context.Context, o *ArcgisLayerFieldTemplate) { - o.r.ParcelMappings = []*arcgisLayerFieldRParcelMappingsR{{ - number: number, - o: related, - }} - }) -} - -func (m arcgisLayerFieldMods) WithNewParcelMappings(number int, mods ...ArcgisParcelMappingMod) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(ctx context.Context, o *ArcgisLayerFieldTemplate) { - related := o.f.NewArcgisParcelMappingWithContext(ctx, mods...) - m.WithParcelMappings(number, related).Apply(ctx, o) - }) -} - -func (m arcgisLayerFieldMods) AddParcelMappings(number int, related *ArcgisParcelMappingTemplate) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(ctx context.Context, o *ArcgisLayerFieldTemplate) { - o.r.ParcelMappings = append(o.r.ParcelMappings, &arcgisLayerFieldRParcelMappingsR{ - number: number, - o: related, - }) - }) -} - -func (m arcgisLayerFieldMods) AddNewParcelMappings(number int, mods ...ArcgisParcelMappingMod) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(ctx context.Context, o *ArcgisLayerFieldTemplate) { - related := o.f.NewArcgisParcelMappingWithContext(ctx, mods...) - m.AddParcelMappings(number, related).Apply(ctx, o) - }) -} - -func (m arcgisLayerFieldMods) AddExistingParcelMappings(existingModels ...*models.ArcgisParcelMapping) ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(ctx context.Context, o *ArcgisLayerFieldTemplate) { - for _, em := range existingModels { - o.r.ParcelMappings = append(o.r.ParcelMappings, &arcgisLayerFieldRParcelMappingsR{ - o: o.f.FromExistingArcgisParcelMapping(em), - }) - } - }) -} - -func (m arcgisLayerFieldMods) WithoutParcelMappings() ArcgisLayerFieldMod { - return ArcgisLayerFieldModFunc(func(ctx context.Context, o *ArcgisLayerFieldTemplate) { - o.r.ParcelMappings = nil - }) -} diff --git a/db/factory/arcgis.oauth_token.bob.go b/db/factory/arcgis.oauth_token.bob.go deleted file mode 100644 index afdb670f..00000000 --- a/db/factory/arcgis.oauth_token.bob.go +++ /dev/null @@ -1,945 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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" -) - -type ArcgisOauthTokenMod interface { - Apply(context.Context, *ArcgisOauthTokenTemplate) -} - -type ArcgisOauthTokenModFunc func(context.Context, *ArcgisOauthTokenTemplate) - -func (f ArcgisOauthTokenModFunc) Apply(ctx context.Context, n *ArcgisOauthTokenTemplate) { - f(ctx, n) -} - -type ArcgisOauthTokenModSlice []ArcgisOauthTokenMod - -func (mods ArcgisOauthTokenModSlice) Apply(ctx context.Context, n *ArcgisOauthTokenTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// ArcgisOauthTokenTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type ArcgisOauthTokenTemplate struct { - AccessToken func() string - AccessTokenExpires func() time.Time - ArcgisAccountID func() null.Val[string] - ArcgisID func() null.Val[string] - ArcgisLicenseTypeID func() null.Val[string] - Created func() time.Time - ID func() int32 - InvalidatedAt func() null.Val[time.Time] - RefreshToken func() string - RefreshTokenExpires func() time.Time - UserID func() int32 - Username func() string - - r arcgisOauthTokenR - f *Factory - - alreadyPersisted bool -} - -type arcgisOauthTokenR struct { - ArcgisAccountAccount *arcgisOauthTokenRArcgisAccountAccountR - UserUser *arcgisOauthTokenRUserUserR -} - -type arcgisOauthTokenRArcgisAccountAccountR struct { - o *ArcgisAccountTemplate -} -type arcgisOauthTokenRUserUserR struct { - o *UserTemplate -} - -// Apply mods to the ArcgisOauthTokenTemplate -func (o *ArcgisOauthTokenTemplate) Apply(ctx context.Context, mods ...ArcgisOauthTokenMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.ArcgisOauthToken -// according to the relationships in the template. Nothing is inserted into the db -func (t ArcgisOauthTokenTemplate) setModelRels(o *models.ArcgisOauthToken) { - if t.r.ArcgisAccountAccount != nil { - rel := t.r.ArcgisAccountAccount.o.Build() - rel.R.ArcgisAccountOauthTokens = append(rel.R.ArcgisAccountOauthTokens, o) - o.ArcgisAccountID = null.From(rel.ID) // h2 - o.R.ArcgisAccountAccount = rel - } - - if t.r.UserUser != nil { - rel := t.r.UserUser.o.Build() - rel.R.UserOauthTokens = append(rel.R.UserOauthTokens, o) - o.UserID = rel.ID // h2 - o.R.UserUser = rel - } -} - -// BuildSetter returns an *models.ArcgisOauthTokenSetter -// this does nothing with the relationship templates -func (o ArcgisOauthTokenTemplate) BuildSetter() *models.ArcgisOauthTokenSetter { - m := &models.ArcgisOauthTokenSetter{} - - if o.AccessToken != nil { - val := o.AccessToken() - m.AccessToken = omit.From(val) - } - if o.AccessTokenExpires != nil { - val := o.AccessTokenExpires() - m.AccessTokenExpires = omit.From(val) - } - if o.ArcgisAccountID != nil { - val := o.ArcgisAccountID() - m.ArcgisAccountID = omitnull.FromNull(val) - } - if o.ArcgisID != nil { - val := o.ArcgisID() - m.ArcgisID = omitnull.FromNull(val) - } - if o.ArcgisLicenseTypeID != nil { - val := o.ArcgisLicenseTypeID() - m.ArcgisLicenseTypeID = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.InvalidatedAt != nil { - val := o.InvalidatedAt() - m.InvalidatedAt = omitnull.FromNull(val) - } - if o.RefreshToken != nil { - val := o.RefreshToken() - m.RefreshToken = omit.From(val) - } - if o.RefreshTokenExpires != nil { - val := o.RefreshTokenExpires() - m.RefreshTokenExpires = omit.From(val) - } - if o.UserID != nil { - val := o.UserID() - m.UserID = omit.From(val) - } - if o.Username != nil { - val := o.Username() - m.Username = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.ArcgisOauthTokenSetter -// this does nothing with the relationship templates -func (o ArcgisOauthTokenTemplate) BuildManySetter(number int) []*models.ArcgisOauthTokenSetter { - m := make([]*models.ArcgisOauthTokenSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.ArcgisOauthToken -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ArcgisOauthTokenTemplate.Create -func (o ArcgisOauthTokenTemplate) Build() *models.ArcgisOauthToken { - m := &models.ArcgisOauthToken{} - - if o.AccessToken != nil { - m.AccessToken = o.AccessToken() - } - if o.AccessTokenExpires != nil { - m.AccessTokenExpires = o.AccessTokenExpires() - } - if o.ArcgisAccountID != nil { - m.ArcgisAccountID = o.ArcgisAccountID() - } - if o.ArcgisID != nil { - m.ArcgisID = o.ArcgisID() - } - if o.ArcgisLicenseTypeID != nil { - m.ArcgisLicenseTypeID = o.ArcgisLicenseTypeID() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.ID != nil { - m.ID = o.ID() - } - if o.InvalidatedAt != nil { - m.InvalidatedAt = o.InvalidatedAt() - } - if o.RefreshToken != nil { - m.RefreshToken = o.RefreshToken() - } - if o.RefreshTokenExpires != nil { - m.RefreshTokenExpires = o.RefreshTokenExpires() - } - if o.UserID != nil { - m.UserID = o.UserID() - } - if o.Username != nil { - m.Username = o.Username() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.ArcgisOauthTokenSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ArcgisOauthTokenTemplate.CreateMany -func (o ArcgisOauthTokenTemplate) BuildMany(number int) models.ArcgisOauthTokenSlice { - m := make(models.ArcgisOauthTokenSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableArcgisOauthToken(m *models.ArcgisOauthTokenSetter) { - if !(m.AccessToken.IsValue()) { - val := random_string(nil) - m.AccessToken = omit.From(val) - } - if !(m.AccessTokenExpires.IsValue()) { - val := random_time_Time(nil) - m.AccessTokenExpires = omit.From(val) - } - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.RefreshToken.IsValue()) { - val := random_string(nil) - m.RefreshToken = omit.From(val) - } - if !(m.RefreshTokenExpires.IsValue()) { - val := random_time_Time(nil) - m.RefreshTokenExpires = omit.From(val) - } - if !(m.UserID.IsValue()) { - val := random_int32(nil) - m.UserID = omit.From(val) - } - if !(m.Username.IsValue()) { - val := random_string(nil) - m.Username = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.ArcgisOauthToken -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *ArcgisOauthTokenTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.ArcgisOauthToken) error { - var err error - - isArcgisAccountAccountDone, _ := arcgisOauthTokenRelArcgisAccountAccountCtx.Value(ctx) - if !isArcgisAccountAccountDone && o.r.ArcgisAccountAccount != nil { - ctx = arcgisOauthTokenRelArcgisAccountAccountCtx.WithValue(ctx, true) - if o.r.ArcgisAccountAccount.o.alreadyPersisted { - m.R.ArcgisAccountAccount = o.r.ArcgisAccountAccount.o.Build() - } else { - var rel0 *models.ArcgisAccount - rel0, err = o.r.ArcgisAccountAccount.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachArcgisAccountAccount(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - - return err -} - -// Create builds a arcgisOauthToken and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *ArcgisOauthTokenTemplate) Create(ctx context.Context, exec bob.Executor) (*models.ArcgisOauthToken, error) { - var err error - opt := o.BuildSetter() - ensureCreatableArcgisOauthToken(opt) - - if o.r.UserUser == nil { - ArcgisOauthTokenMods.WithNewUserUser().Apply(ctx, o) - } - - var rel1 *models.User - - if o.r.UserUser.o.alreadyPersisted { - rel1 = o.r.UserUser.o.Build() - } else { - rel1, err = o.r.UserUser.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.UserID = omit.From(rel1.ID) - - m, err := models.ArcgisOauthTokens.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.UserUser = rel1 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a arcgisOauthToken and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *ArcgisOauthTokenTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.ArcgisOauthToken { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a arcgisOauthToken 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 *ArcgisOauthTokenTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.ArcgisOauthToken { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple arcgisOauthTokens and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o ArcgisOauthTokenTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.ArcgisOauthTokenSlice, error) { - var err error - m := make(models.ArcgisOauthTokenSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple arcgisOauthTokens and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o ArcgisOauthTokenTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.ArcgisOauthTokenSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple arcgisOauthTokens 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 ArcgisOauthTokenTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.ArcgisOauthTokenSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// ArcgisOauthToken has methods that act as mods for the ArcgisOauthTokenTemplate -var ArcgisOauthTokenMods arcgisOauthTokenMods - -type arcgisOauthTokenMods struct{} - -func (m arcgisOauthTokenMods) RandomizeAllColumns(f *faker.Faker) ArcgisOauthTokenMod { - return ArcgisOauthTokenModSlice{ - ArcgisOauthTokenMods.RandomAccessToken(f), - ArcgisOauthTokenMods.RandomAccessTokenExpires(f), - ArcgisOauthTokenMods.RandomArcgisAccountID(f), - ArcgisOauthTokenMods.RandomArcgisID(f), - ArcgisOauthTokenMods.RandomArcgisLicenseTypeID(f), - ArcgisOauthTokenMods.RandomCreated(f), - ArcgisOauthTokenMods.RandomID(f), - ArcgisOauthTokenMods.RandomInvalidatedAt(f), - ArcgisOauthTokenMods.RandomRefreshToken(f), - ArcgisOauthTokenMods.RandomRefreshTokenExpires(f), - ArcgisOauthTokenMods.RandomUserID(f), - ArcgisOauthTokenMods.RandomUsername(f), - } -} - -// Set the model columns to this value -func (m arcgisOauthTokenMods) AccessToken(val string) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.AccessToken = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisOauthTokenMods) AccessTokenFunc(f func() string) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.AccessToken = f - }) -} - -// Clear any values for the column -func (m arcgisOauthTokenMods) UnsetAccessToken() ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.AccessToken = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisOauthTokenMods) RandomAccessToken(f *faker.Faker) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.AccessToken = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisOauthTokenMods) AccessTokenExpires(val time.Time) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.AccessTokenExpires = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m arcgisOauthTokenMods) AccessTokenExpiresFunc(f func() time.Time) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.AccessTokenExpires = f - }) -} - -// Clear any values for the column -func (m arcgisOauthTokenMods) UnsetAccessTokenExpires() ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.AccessTokenExpires = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisOauthTokenMods) RandomAccessTokenExpires(f *faker.Faker) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.AccessTokenExpires = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisOauthTokenMods) ArcgisAccountID(val null.Val[string]) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.ArcgisAccountID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m arcgisOauthTokenMods) ArcgisAccountIDFunc(f func() null.Val[string]) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.ArcgisAccountID = f - }) -} - -// Clear any values for the column -func (m arcgisOauthTokenMods) UnsetArcgisAccountID() ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.ArcgisAccountID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m arcgisOauthTokenMods) RandomArcgisAccountID(f *faker.Faker) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.ArcgisAccountID = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m arcgisOauthTokenMods) RandomArcgisAccountIDNotNull(f *faker.Faker) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.ArcgisAccountID = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m arcgisOauthTokenMods) ArcgisID(val null.Val[string]) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.ArcgisID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m arcgisOauthTokenMods) ArcgisIDFunc(f func() null.Val[string]) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.ArcgisID = f - }) -} - -// Clear any values for the column -func (m arcgisOauthTokenMods) UnsetArcgisID() ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.ArcgisID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m arcgisOauthTokenMods) RandomArcgisID(f *faker.Faker) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.ArcgisID = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m arcgisOauthTokenMods) RandomArcgisIDNotNull(f *faker.Faker) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.ArcgisID = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m arcgisOauthTokenMods) ArcgisLicenseTypeID(val null.Val[string]) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.ArcgisLicenseTypeID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m arcgisOauthTokenMods) ArcgisLicenseTypeIDFunc(f func() null.Val[string]) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.ArcgisLicenseTypeID = f - }) -} - -// Clear any values for the column -func (m arcgisOauthTokenMods) UnsetArcgisLicenseTypeID() ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.ArcgisLicenseTypeID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m arcgisOauthTokenMods) RandomArcgisLicenseTypeID(f *faker.Faker) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.ArcgisLicenseTypeID = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m arcgisOauthTokenMods) RandomArcgisLicenseTypeIDNotNull(f *faker.Faker) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.ArcgisLicenseTypeID = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m arcgisOauthTokenMods) Created(val time.Time) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m arcgisOauthTokenMods) CreatedFunc(f func() time.Time) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m arcgisOauthTokenMods) UnsetCreated() ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - 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 arcgisOauthTokenMods) RandomCreated(f *faker.Faker) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisOauthTokenMods) ID(val int32) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m arcgisOauthTokenMods) IDFunc(f func() int32) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m arcgisOauthTokenMods) UnsetID() ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisOauthTokenMods) RandomID(f *faker.Faker) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisOauthTokenMods) InvalidatedAt(val null.Val[time.Time]) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.InvalidatedAt = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m arcgisOauthTokenMods) InvalidatedAtFunc(f func() null.Val[time.Time]) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.InvalidatedAt = f - }) -} - -// Clear any values for the column -func (m arcgisOauthTokenMods) UnsetInvalidatedAt() ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.InvalidatedAt = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m arcgisOauthTokenMods) RandomInvalidatedAt(f *faker.Faker) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.InvalidatedAt = 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 arcgisOauthTokenMods) RandomInvalidatedAtNotNull(f *faker.Faker) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.InvalidatedAt = 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 arcgisOauthTokenMods) RefreshToken(val string) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.RefreshToken = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisOauthTokenMods) RefreshTokenFunc(f func() string) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.RefreshToken = f - }) -} - -// Clear any values for the column -func (m arcgisOauthTokenMods) UnsetRefreshToken() ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.RefreshToken = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisOauthTokenMods) RandomRefreshToken(f *faker.Faker) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.RefreshToken = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisOauthTokenMods) RefreshTokenExpires(val time.Time) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.RefreshTokenExpires = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m arcgisOauthTokenMods) RefreshTokenExpiresFunc(f func() time.Time) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.RefreshTokenExpires = f - }) -} - -// Clear any values for the column -func (m arcgisOauthTokenMods) UnsetRefreshTokenExpires() ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.RefreshTokenExpires = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisOauthTokenMods) RandomRefreshTokenExpires(f *faker.Faker) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.RefreshTokenExpires = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisOauthTokenMods) UserID(val int32) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.UserID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m arcgisOauthTokenMods) UserIDFunc(f func() int32) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.UserID = f - }) -} - -// Clear any values for the column -func (m arcgisOauthTokenMods) UnsetUserID() ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.UserID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisOauthTokenMods) RandomUserID(f *faker.Faker) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.UserID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisOauthTokenMods) Username(val string) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.Username = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisOauthTokenMods) UsernameFunc(f func() string) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.Username = f - }) -} - -// Clear any values for the column -func (m arcgisOauthTokenMods) UnsetUsername() ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.Username = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisOauthTokenMods) RandomUsername(f *faker.Faker) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(_ context.Context, o *ArcgisOauthTokenTemplate) { - o.Username = func() string { - return random_string(f) - } - }) -} - -func (m arcgisOauthTokenMods) WithParentsCascading() ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(ctx context.Context, o *ArcgisOauthTokenTemplate) { - if isDone, _ := arcgisOauthTokenWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = arcgisOauthTokenWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewArcgisAccountWithContext(ctx, ArcgisAccountMods.WithParentsCascading()) - m.WithArcgisAccountAccount(related).Apply(ctx, o) - } - { - - related := o.f.NewUserWithContext(ctx, UserMods.WithParentsCascading()) - m.WithUserUser(related).Apply(ctx, o) - } - }) -} - -func (m arcgisOauthTokenMods) WithArcgisAccountAccount(rel *ArcgisAccountTemplate) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(ctx context.Context, o *ArcgisOauthTokenTemplate) { - o.r.ArcgisAccountAccount = &arcgisOauthTokenRArcgisAccountAccountR{ - o: rel, - } - }) -} - -func (m arcgisOauthTokenMods) WithNewArcgisAccountAccount(mods ...ArcgisAccountMod) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(ctx context.Context, o *ArcgisOauthTokenTemplate) { - related := o.f.NewArcgisAccountWithContext(ctx, mods...) - - m.WithArcgisAccountAccount(related).Apply(ctx, o) - }) -} - -func (m arcgisOauthTokenMods) WithExistingArcgisAccountAccount(em *models.ArcgisAccount) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(ctx context.Context, o *ArcgisOauthTokenTemplate) { - o.r.ArcgisAccountAccount = &arcgisOauthTokenRArcgisAccountAccountR{ - o: o.f.FromExistingArcgisAccount(em), - } - }) -} - -func (m arcgisOauthTokenMods) WithoutArcgisAccountAccount() ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(ctx context.Context, o *ArcgisOauthTokenTemplate) { - o.r.ArcgisAccountAccount = nil - }) -} - -func (m arcgisOauthTokenMods) WithUserUser(rel *UserTemplate) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(ctx context.Context, o *ArcgisOauthTokenTemplate) { - o.r.UserUser = &arcgisOauthTokenRUserUserR{ - o: rel, - } - }) -} - -func (m arcgisOauthTokenMods) WithNewUserUser(mods ...UserMod) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(ctx context.Context, o *ArcgisOauthTokenTemplate) { - related := o.f.NewUserWithContext(ctx, mods...) - - m.WithUserUser(related).Apply(ctx, o) - }) -} - -func (m arcgisOauthTokenMods) WithExistingUserUser(em *models.User) ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(ctx context.Context, o *ArcgisOauthTokenTemplate) { - o.r.UserUser = &arcgisOauthTokenRUserUserR{ - o: o.f.FromExistingUser(em), - } - }) -} - -func (m arcgisOauthTokenMods) WithoutUserUser() ArcgisOauthTokenMod { - return ArcgisOauthTokenModFunc(func(ctx context.Context, o *ArcgisOauthTokenTemplate) { - o.r.UserUser = nil - }) -} diff --git a/db/factory/arcgis.parcel_mapping.bob.go b/db/factory/arcgis.parcel_mapping.bob.go deleted file mode 100644 index 42018da8..00000000 --- a/db/factory/arcgis.parcel_mapping.bob.go +++ /dev/null @@ -1,570 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - 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/jaswdr/faker/v2" -) - -type ArcgisParcelMappingMod interface { - Apply(context.Context, *ArcgisParcelMappingTemplate) -} - -type ArcgisParcelMappingModFunc func(context.Context, *ArcgisParcelMappingTemplate) - -func (f ArcgisParcelMappingModFunc) Apply(ctx context.Context, n *ArcgisParcelMappingTemplate) { - f(ctx, n) -} - -type ArcgisParcelMappingModSlice []ArcgisParcelMappingMod - -func (mods ArcgisParcelMappingModSlice) Apply(ctx context.Context, n *ArcgisParcelMappingTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// ArcgisParcelMappingTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type ArcgisParcelMappingTemplate struct { - Destination func() enums.ArcgisMappingdestinationparcel - LayerFeatureServiceItemID func() string - LayerIndex func() int32 - LayerFieldName func() string - OrganizationID func() int32 - - r arcgisParcelMappingR - f *Factory - - alreadyPersisted bool -} - -type arcgisParcelMappingR struct { - LayerField *arcgisParcelMappingRLayerFieldR - Organization *arcgisParcelMappingROrganizationR -} - -type arcgisParcelMappingRLayerFieldR struct { - o *ArcgisLayerFieldTemplate -} -type arcgisParcelMappingROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the ArcgisParcelMappingTemplate -func (o *ArcgisParcelMappingTemplate) Apply(ctx context.Context, mods ...ArcgisParcelMappingMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.ArcgisParcelMapping -// according to the relationships in the template. Nothing is inserted into the db -func (t ArcgisParcelMappingTemplate) setModelRels(o *models.ArcgisParcelMapping) { - if t.r.LayerField != nil { - rel := t.r.LayerField.o.Build() - rel.R.ParcelMappings = append(rel.R.ParcelMappings, o) - o.LayerFeatureServiceItemID = rel.LayerFeatureServiceItemID // h2 - o.LayerIndex = rel.LayerIndex // h2 - o.LayerFieldName = rel.Name // h2 - o.R.LayerField = rel - } - - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.ParcelMappings = append(rel.R.ParcelMappings, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.ArcgisParcelMappingSetter -// this does nothing with the relationship templates -func (o ArcgisParcelMappingTemplate) BuildSetter() *models.ArcgisParcelMappingSetter { - m := &models.ArcgisParcelMappingSetter{} - - if o.Destination != nil { - val := o.Destination() - m.Destination = omit.From(val) - } - if o.LayerFeatureServiceItemID != nil { - val := o.LayerFeatureServiceItemID() - m.LayerFeatureServiceItemID = omit.From(val) - } - if o.LayerIndex != nil { - val := o.LayerIndex() - m.LayerIndex = omit.From(val) - } - if o.LayerFieldName != nil { - val := o.LayerFieldName() - m.LayerFieldName = omit.From(val) - } - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.ArcgisParcelMappingSetter -// this does nothing with the relationship templates -func (o ArcgisParcelMappingTemplate) BuildManySetter(number int) []*models.ArcgisParcelMappingSetter { - m := make([]*models.ArcgisParcelMappingSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.ArcgisParcelMapping -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ArcgisParcelMappingTemplate.Create -func (o ArcgisParcelMappingTemplate) Build() *models.ArcgisParcelMapping { - m := &models.ArcgisParcelMapping{} - - if o.Destination != nil { - m.Destination = o.Destination() - } - if o.LayerFeatureServiceItemID != nil { - m.LayerFeatureServiceItemID = o.LayerFeatureServiceItemID() - } - if o.LayerIndex != nil { - m.LayerIndex = o.LayerIndex() - } - if o.LayerFieldName != nil { - m.LayerFieldName = o.LayerFieldName() - } - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.ArcgisParcelMappingSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ArcgisParcelMappingTemplate.CreateMany -func (o ArcgisParcelMappingTemplate) BuildMany(number int) models.ArcgisParcelMappingSlice { - m := make(models.ArcgisParcelMappingSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableArcgisParcelMapping(m *models.ArcgisParcelMappingSetter) { - if !(m.Destination.IsValue()) { - val := random_enums_ArcgisMappingdestinationparcel(nil) - m.Destination = omit.From(val) - } - if !(m.LayerFeatureServiceItemID.IsValue()) { - val := random_string(nil) - m.LayerFeatureServiceItemID = omit.From(val) - } - if !(m.LayerIndex.IsValue()) { - val := random_int32(nil) - m.LayerIndex = omit.From(val) - } - if !(m.LayerFieldName.IsValue()) { - val := random_string(nil) - m.LayerFieldName = 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.ArcgisParcelMapping -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *ArcgisParcelMappingTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.ArcgisParcelMapping) error { - var err error - - return err -} - -// Create builds a arcgisParcelMapping and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *ArcgisParcelMappingTemplate) Create(ctx context.Context, exec bob.Executor) (*models.ArcgisParcelMapping, error) { - var err error - opt := o.BuildSetter() - ensureCreatableArcgisParcelMapping(opt) - - if o.r.LayerField == nil { - ArcgisParcelMappingMods.WithNewLayerField().Apply(ctx, o) - } - - var rel0 *models.ArcgisLayerField - - if o.r.LayerField.o.alreadyPersisted { - rel0 = o.r.LayerField.o.Build() - } else { - rel0, err = o.r.LayerField.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.LayerFeatureServiceItemID = omit.From(rel0.LayerFeatureServiceItemID) - opt.LayerIndex = omit.From(rel0.LayerIndex) - opt.LayerFieldName = omit.From(rel0.Name) - - if o.r.Organization == nil { - ArcgisParcelMappingMods.WithNewOrganization().Apply(ctx, o) - } - - var rel1 *models.Organization - - if o.r.Organization.o.alreadyPersisted { - rel1 = o.r.Organization.o.Build() - } else { - rel1, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.OrganizationID = omit.From(rel1.ID) - - m, err := models.ArcgisParcelMappings.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.LayerField = rel0 - m.R.Organization = rel1 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a arcgisParcelMapping and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *ArcgisParcelMappingTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.ArcgisParcelMapping { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a arcgisParcelMapping 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 *ArcgisParcelMappingTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.ArcgisParcelMapping { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple arcgisParcelMappings and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o ArcgisParcelMappingTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.ArcgisParcelMappingSlice, error) { - var err error - m := make(models.ArcgisParcelMappingSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple arcgisParcelMappings and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o ArcgisParcelMappingTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.ArcgisParcelMappingSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple arcgisParcelMappings 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 ArcgisParcelMappingTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.ArcgisParcelMappingSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// ArcgisParcelMapping has methods that act as mods for the ArcgisParcelMappingTemplate -var ArcgisParcelMappingMods arcgisParcelMappingMods - -type arcgisParcelMappingMods struct{} - -func (m arcgisParcelMappingMods) RandomizeAllColumns(f *faker.Faker) ArcgisParcelMappingMod { - return ArcgisParcelMappingModSlice{ - ArcgisParcelMappingMods.RandomDestination(f), - ArcgisParcelMappingMods.RandomLayerFeatureServiceItemID(f), - ArcgisParcelMappingMods.RandomLayerIndex(f), - ArcgisParcelMappingMods.RandomLayerFieldName(f), - ArcgisParcelMappingMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m arcgisParcelMappingMods) Destination(val enums.ArcgisMappingdestinationparcel) ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(_ context.Context, o *ArcgisParcelMappingTemplate) { - o.Destination = func() enums.ArcgisMappingdestinationparcel { return val } - }) -} - -// Set the Column from the function -func (m arcgisParcelMappingMods) DestinationFunc(f func() enums.ArcgisMappingdestinationparcel) ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(_ context.Context, o *ArcgisParcelMappingTemplate) { - o.Destination = f - }) -} - -// Clear any values for the column -func (m arcgisParcelMappingMods) UnsetDestination() ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(_ context.Context, o *ArcgisParcelMappingTemplate) { - o.Destination = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisParcelMappingMods) RandomDestination(f *faker.Faker) ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(_ context.Context, o *ArcgisParcelMappingTemplate) { - o.Destination = func() enums.ArcgisMappingdestinationparcel { - return random_enums_ArcgisMappingdestinationparcel(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisParcelMappingMods) LayerFeatureServiceItemID(val string) ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(_ context.Context, o *ArcgisParcelMappingTemplate) { - o.LayerFeatureServiceItemID = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisParcelMappingMods) LayerFeatureServiceItemIDFunc(f func() string) ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(_ context.Context, o *ArcgisParcelMappingTemplate) { - o.LayerFeatureServiceItemID = f - }) -} - -// Clear any values for the column -func (m arcgisParcelMappingMods) UnsetLayerFeatureServiceItemID() ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(_ context.Context, o *ArcgisParcelMappingTemplate) { - o.LayerFeatureServiceItemID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisParcelMappingMods) RandomLayerFeatureServiceItemID(f *faker.Faker) ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(_ context.Context, o *ArcgisParcelMappingTemplate) { - o.LayerFeatureServiceItemID = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisParcelMappingMods) LayerIndex(val int32) ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(_ context.Context, o *ArcgisParcelMappingTemplate) { - o.LayerIndex = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m arcgisParcelMappingMods) LayerIndexFunc(f func() int32) ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(_ context.Context, o *ArcgisParcelMappingTemplate) { - o.LayerIndex = f - }) -} - -// Clear any values for the column -func (m arcgisParcelMappingMods) UnsetLayerIndex() ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(_ context.Context, o *ArcgisParcelMappingTemplate) { - o.LayerIndex = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisParcelMappingMods) RandomLayerIndex(f *faker.Faker) ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(_ context.Context, o *ArcgisParcelMappingTemplate) { - o.LayerIndex = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisParcelMappingMods) LayerFieldName(val string) ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(_ context.Context, o *ArcgisParcelMappingTemplate) { - o.LayerFieldName = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisParcelMappingMods) LayerFieldNameFunc(f func() string) ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(_ context.Context, o *ArcgisParcelMappingTemplate) { - o.LayerFieldName = f - }) -} - -// Clear any values for the column -func (m arcgisParcelMappingMods) UnsetLayerFieldName() ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(_ context.Context, o *ArcgisParcelMappingTemplate) { - o.LayerFieldName = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisParcelMappingMods) RandomLayerFieldName(f *faker.Faker) ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(_ context.Context, o *ArcgisParcelMappingTemplate) { - o.LayerFieldName = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisParcelMappingMods) OrganizationID(val int32) ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(_ context.Context, o *ArcgisParcelMappingTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m arcgisParcelMappingMods) OrganizationIDFunc(f func() int32) ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(_ context.Context, o *ArcgisParcelMappingTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m arcgisParcelMappingMods) UnsetOrganizationID() ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(_ context.Context, o *ArcgisParcelMappingTemplate) { - 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 arcgisParcelMappingMods) RandomOrganizationID(f *faker.Faker) ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(_ context.Context, o *ArcgisParcelMappingTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -func (m arcgisParcelMappingMods) WithParentsCascading() ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(ctx context.Context, o *ArcgisParcelMappingTemplate) { - if isDone, _ := arcgisParcelMappingWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = arcgisParcelMappingWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewArcgisLayerFieldWithContext(ctx, ArcgisLayerFieldMods.WithParentsCascading()) - m.WithLayerField(related).Apply(ctx, o) - } - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m arcgisParcelMappingMods) WithLayerField(rel *ArcgisLayerFieldTemplate) ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(ctx context.Context, o *ArcgisParcelMappingTemplate) { - o.r.LayerField = &arcgisParcelMappingRLayerFieldR{ - o: rel, - } - }) -} - -func (m arcgisParcelMappingMods) WithNewLayerField(mods ...ArcgisLayerFieldMod) ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(ctx context.Context, o *ArcgisParcelMappingTemplate) { - related := o.f.NewArcgisLayerFieldWithContext(ctx, mods...) - - m.WithLayerField(related).Apply(ctx, o) - }) -} - -func (m arcgisParcelMappingMods) WithExistingLayerField(em *models.ArcgisLayerField) ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(ctx context.Context, o *ArcgisParcelMappingTemplate) { - o.r.LayerField = &arcgisParcelMappingRLayerFieldR{ - o: o.f.FromExistingArcgisLayerField(em), - } - }) -} - -func (m arcgisParcelMappingMods) WithoutLayerField() ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(ctx context.Context, o *ArcgisParcelMappingTemplate) { - o.r.LayerField = nil - }) -} - -func (m arcgisParcelMappingMods) WithOrganization(rel *OrganizationTemplate) ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(ctx context.Context, o *ArcgisParcelMappingTemplate) { - o.r.Organization = &arcgisParcelMappingROrganizationR{ - o: rel, - } - }) -} - -func (m arcgisParcelMappingMods) WithNewOrganization(mods ...OrganizationMod) ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(ctx context.Context, o *ArcgisParcelMappingTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m arcgisParcelMappingMods) WithExistingOrganization(em *models.Organization) ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(ctx context.Context, o *ArcgisParcelMappingTemplate) { - o.r.Organization = &arcgisParcelMappingROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m arcgisParcelMappingMods) WithoutOrganization() ArcgisParcelMappingMod { - return ArcgisParcelMappingModFunc(func(ctx context.Context, o *ArcgisParcelMappingTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/arcgis.service_feature.bob.go b/db/factory/arcgis.service_feature.bob.go deleted file mode 100644 index 6541dec9..00000000 --- a/db/factory/arcgis.service_feature.bob.go +++ /dev/null @@ -1,693 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - 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" -) - -type ArcgisServiceFeatureMod interface { - Apply(context.Context, *ArcgisServiceFeatureTemplate) -} - -type ArcgisServiceFeatureModFunc func(context.Context, *ArcgisServiceFeatureTemplate) - -func (f ArcgisServiceFeatureModFunc) Apply(ctx context.Context, n *ArcgisServiceFeatureTemplate) { - f(ctx, n) -} - -type ArcgisServiceFeatureModSlice []ArcgisServiceFeatureMod - -func (mods ArcgisServiceFeatureModSlice) Apply(ctx context.Context, n *ArcgisServiceFeatureTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// ArcgisServiceFeatureTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type ArcgisServiceFeatureTemplate struct { - Extent func() string - ItemID func() string - SpatialReference func() int32 - URL func() string - AccountID func() null.Val[string] - - r arcgisServiceFeatureR - f *Factory - - alreadyPersisted bool -} - -type arcgisServiceFeatureR struct { - FeatureServiceItemLayers []*arcgisServiceFeatureRFeatureServiceItemLayersR - Account *arcgisServiceFeatureRAccountR - FieldseekerServiceFeatureItemOrganizations []*arcgisServiceFeatureRFieldseekerServiceFeatureItemOrganizationsR -} - -type arcgisServiceFeatureRFeatureServiceItemLayersR struct { - number int - o *ArcgisLayerTemplate -} -type arcgisServiceFeatureRAccountR struct { - o *ArcgisAccountTemplate -} -type arcgisServiceFeatureRFieldseekerServiceFeatureItemOrganizationsR struct { - number int - o *OrganizationTemplate -} - -// Apply mods to the ArcgisServiceFeatureTemplate -func (o *ArcgisServiceFeatureTemplate) Apply(ctx context.Context, mods ...ArcgisServiceFeatureMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.ArcgisServiceFeature -// according to the relationships in the template. Nothing is inserted into the db -func (t ArcgisServiceFeatureTemplate) setModelRels(o *models.ArcgisServiceFeature) { - if t.r.FeatureServiceItemLayers != nil { - rel := models.ArcgisLayerSlice{} - for _, r := range t.r.FeatureServiceItemLayers { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.FeatureServiceItemID = o.ItemID // h2 - rel.R.FeatureServiceItemServiceFeature = o - } - rel = append(rel, related...) - } - o.R.FeatureServiceItemLayers = rel - } - - if t.r.Account != nil { - rel := t.r.Account.o.Build() - rel.R.ServiceFeatures = append(rel.R.ServiceFeatures, o) - o.AccountID = null.From(rel.ID) // h2 - o.R.Account = rel - } - - if t.r.FieldseekerServiceFeatureItemOrganizations != nil { - rel := models.OrganizationSlice{} - for _, r := range t.r.FieldseekerServiceFeatureItemOrganizations { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.FieldseekerServiceFeatureItemID = null.From(o.ItemID) // h2 - rel.R.FieldseekerServiceFeatureItemServiceFeature = o - } - rel = append(rel, related...) - } - o.R.FieldseekerServiceFeatureItemOrganizations = rel - } -} - -// BuildSetter returns an *models.ArcgisServiceFeatureSetter -// this does nothing with the relationship templates -func (o ArcgisServiceFeatureTemplate) BuildSetter() *models.ArcgisServiceFeatureSetter { - m := &models.ArcgisServiceFeatureSetter{} - - if o.Extent != nil { - val := o.Extent() - m.Extent = omit.From(val) - } - if o.ItemID != nil { - val := o.ItemID() - m.ItemID = omit.From(val) - } - if o.SpatialReference != nil { - val := o.SpatialReference() - m.SpatialReference = omit.From(val) - } - if o.URL != nil { - val := o.URL() - m.URL = omit.From(val) - } - if o.AccountID != nil { - val := o.AccountID() - m.AccountID = omitnull.FromNull(val) - } - - return m -} - -// BuildManySetter returns an []*models.ArcgisServiceFeatureSetter -// this does nothing with the relationship templates -func (o ArcgisServiceFeatureTemplate) BuildManySetter(number int) []*models.ArcgisServiceFeatureSetter { - m := make([]*models.ArcgisServiceFeatureSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.ArcgisServiceFeature -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ArcgisServiceFeatureTemplate.Create -func (o ArcgisServiceFeatureTemplate) Build() *models.ArcgisServiceFeature { - m := &models.ArcgisServiceFeature{} - - if o.Extent != nil { - m.Extent = o.Extent() - } - if o.ItemID != nil { - m.ItemID = o.ItemID() - } - if o.SpatialReference != nil { - m.SpatialReference = o.SpatialReference() - } - if o.URL != nil { - m.URL = o.URL() - } - if o.AccountID != nil { - m.AccountID = o.AccountID() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.ArcgisServiceFeatureSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ArcgisServiceFeatureTemplate.CreateMany -func (o ArcgisServiceFeatureTemplate) BuildMany(number int) models.ArcgisServiceFeatureSlice { - m := make(models.ArcgisServiceFeatureSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableArcgisServiceFeature(m *models.ArcgisServiceFeatureSetter) { - if !(m.Extent.IsValue()) { - val := random_string(nil) - m.Extent = omit.From(val) - } - if !(m.ItemID.IsValue()) { - val := random_string(nil) - m.ItemID = omit.From(val) - } - if !(m.SpatialReference.IsValue()) { - val := random_int32(nil) - m.SpatialReference = omit.From(val) - } - if !(m.URL.IsValue()) { - val := random_string(nil) - m.URL = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.ArcgisServiceFeature -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *ArcgisServiceFeatureTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.ArcgisServiceFeature) error { - var err error - - isFeatureServiceItemLayersDone, _ := arcgisServiceFeatureRelFeatureServiceItemLayersCtx.Value(ctx) - if !isFeatureServiceItemLayersDone && o.r.FeatureServiceItemLayers != nil { - ctx = arcgisServiceFeatureRelFeatureServiceItemLayersCtx.WithValue(ctx, true) - for _, r := range o.r.FeatureServiceItemLayers { - if r.o.alreadyPersisted { - m.R.FeatureServiceItemLayers = append(m.R.FeatureServiceItemLayers, r.o.Build()) - } else { - rel0, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFeatureServiceItemLayers(ctx, exec, rel0...) - if err != nil { - return err - } - } - } - } - - isAccountDone, _ := arcgisServiceFeatureRelAccountCtx.Value(ctx) - if !isAccountDone && o.r.Account != nil { - ctx = arcgisServiceFeatureRelAccountCtx.WithValue(ctx, true) - if o.r.Account.o.alreadyPersisted { - m.R.Account = o.r.Account.o.Build() - } else { - var rel1 *models.ArcgisAccount - rel1, err = o.r.Account.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachAccount(ctx, exec, rel1) - if err != nil { - return err - } - } - - } - - isFieldseekerServiceFeatureItemOrganizationsDone, _ := arcgisServiceFeatureRelFieldseekerServiceFeatureItemOrganizationsCtx.Value(ctx) - if !isFieldseekerServiceFeatureItemOrganizationsDone && o.r.FieldseekerServiceFeatureItemOrganizations != nil { - ctx = arcgisServiceFeatureRelFieldseekerServiceFeatureItemOrganizationsCtx.WithValue(ctx, true) - for _, r := range o.r.FieldseekerServiceFeatureItemOrganizations { - if r.o.alreadyPersisted { - m.R.FieldseekerServiceFeatureItemOrganizations = append(m.R.FieldseekerServiceFeatureItemOrganizations, r.o.Build()) - } else { - rel2, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFieldseekerServiceFeatureItemOrganizations(ctx, exec, rel2...) - if err != nil { - return err - } - } - } - } - - return err -} - -// Create builds a arcgisServiceFeature and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *ArcgisServiceFeatureTemplate) Create(ctx context.Context, exec bob.Executor) (*models.ArcgisServiceFeature, error) { - var err error - opt := o.BuildSetter() - ensureCreatableArcgisServiceFeature(opt) - - m, err := models.ArcgisServiceFeatures.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a arcgisServiceFeature and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *ArcgisServiceFeatureTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.ArcgisServiceFeature { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a arcgisServiceFeature 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 *ArcgisServiceFeatureTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.ArcgisServiceFeature { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple arcgisServiceFeatures and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o ArcgisServiceFeatureTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.ArcgisServiceFeatureSlice, error) { - var err error - m := make(models.ArcgisServiceFeatureSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple arcgisServiceFeatures and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o ArcgisServiceFeatureTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.ArcgisServiceFeatureSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple arcgisServiceFeatures 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 ArcgisServiceFeatureTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.ArcgisServiceFeatureSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// ArcgisServiceFeature has methods that act as mods for the ArcgisServiceFeatureTemplate -var ArcgisServiceFeatureMods arcgisServiceFeatureMods - -type arcgisServiceFeatureMods struct{} - -func (m arcgisServiceFeatureMods) RandomizeAllColumns(f *faker.Faker) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModSlice{ - ArcgisServiceFeatureMods.RandomExtent(f), - ArcgisServiceFeatureMods.RandomItemID(f), - ArcgisServiceFeatureMods.RandomSpatialReference(f), - ArcgisServiceFeatureMods.RandomURL(f), - ArcgisServiceFeatureMods.RandomAccountID(f), - } -} - -// Set the model columns to this value -func (m arcgisServiceFeatureMods) Extent(val string) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(_ context.Context, o *ArcgisServiceFeatureTemplate) { - o.Extent = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisServiceFeatureMods) ExtentFunc(f func() string) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(_ context.Context, o *ArcgisServiceFeatureTemplate) { - o.Extent = f - }) -} - -// Clear any values for the column -func (m arcgisServiceFeatureMods) UnsetExtent() ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(_ context.Context, o *ArcgisServiceFeatureTemplate) { - o.Extent = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisServiceFeatureMods) RandomExtent(f *faker.Faker) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(_ context.Context, o *ArcgisServiceFeatureTemplate) { - o.Extent = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisServiceFeatureMods) ItemID(val string) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(_ context.Context, o *ArcgisServiceFeatureTemplate) { - o.ItemID = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisServiceFeatureMods) ItemIDFunc(f func() string) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(_ context.Context, o *ArcgisServiceFeatureTemplate) { - o.ItemID = f - }) -} - -// Clear any values for the column -func (m arcgisServiceFeatureMods) UnsetItemID() ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(_ context.Context, o *ArcgisServiceFeatureTemplate) { - o.ItemID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisServiceFeatureMods) RandomItemID(f *faker.Faker) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(_ context.Context, o *ArcgisServiceFeatureTemplate) { - o.ItemID = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisServiceFeatureMods) SpatialReference(val int32) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(_ context.Context, o *ArcgisServiceFeatureTemplate) { - o.SpatialReference = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m arcgisServiceFeatureMods) SpatialReferenceFunc(f func() int32) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(_ context.Context, o *ArcgisServiceFeatureTemplate) { - o.SpatialReference = f - }) -} - -// Clear any values for the column -func (m arcgisServiceFeatureMods) UnsetSpatialReference() ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(_ context.Context, o *ArcgisServiceFeatureTemplate) { - o.SpatialReference = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisServiceFeatureMods) RandomSpatialReference(f *faker.Faker) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(_ context.Context, o *ArcgisServiceFeatureTemplate) { - o.SpatialReference = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisServiceFeatureMods) URL(val string) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(_ context.Context, o *ArcgisServiceFeatureTemplate) { - o.URL = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisServiceFeatureMods) URLFunc(f func() string) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(_ context.Context, o *ArcgisServiceFeatureTemplate) { - o.URL = f - }) -} - -// Clear any values for the column -func (m arcgisServiceFeatureMods) UnsetURL() ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(_ context.Context, o *ArcgisServiceFeatureTemplate) { - o.URL = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisServiceFeatureMods) RandomURL(f *faker.Faker) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(_ context.Context, o *ArcgisServiceFeatureTemplate) { - o.URL = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisServiceFeatureMods) AccountID(val null.Val[string]) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(_ context.Context, o *ArcgisServiceFeatureTemplate) { - o.AccountID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m arcgisServiceFeatureMods) AccountIDFunc(f func() null.Val[string]) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(_ context.Context, o *ArcgisServiceFeatureTemplate) { - o.AccountID = f - }) -} - -// Clear any values for the column -func (m arcgisServiceFeatureMods) UnsetAccountID() ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(_ context.Context, o *ArcgisServiceFeatureTemplate) { - o.AccountID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m arcgisServiceFeatureMods) RandomAccountID(f *faker.Faker) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(_ context.Context, o *ArcgisServiceFeatureTemplate) { - o.AccountID = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m arcgisServiceFeatureMods) RandomAccountIDNotNull(f *faker.Faker) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(_ context.Context, o *ArcgisServiceFeatureTemplate) { - o.AccountID = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -func (m arcgisServiceFeatureMods) WithParentsCascading() ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(ctx context.Context, o *ArcgisServiceFeatureTemplate) { - if isDone, _ := arcgisServiceFeatureWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = arcgisServiceFeatureWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewArcgisAccountWithContext(ctx, ArcgisAccountMods.WithParentsCascading()) - m.WithAccount(related).Apply(ctx, o) - } - }) -} - -func (m arcgisServiceFeatureMods) WithAccount(rel *ArcgisAccountTemplate) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(ctx context.Context, o *ArcgisServiceFeatureTemplate) { - o.r.Account = &arcgisServiceFeatureRAccountR{ - o: rel, - } - }) -} - -func (m arcgisServiceFeatureMods) WithNewAccount(mods ...ArcgisAccountMod) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(ctx context.Context, o *ArcgisServiceFeatureTemplate) { - related := o.f.NewArcgisAccountWithContext(ctx, mods...) - - m.WithAccount(related).Apply(ctx, o) - }) -} - -func (m arcgisServiceFeatureMods) WithExistingAccount(em *models.ArcgisAccount) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(ctx context.Context, o *ArcgisServiceFeatureTemplate) { - o.r.Account = &arcgisServiceFeatureRAccountR{ - o: o.f.FromExistingArcgisAccount(em), - } - }) -} - -func (m arcgisServiceFeatureMods) WithoutAccount() ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(ctx context.Context, o *ArcgisServiceFeatureTemplate) { - o.r.Account = nil - }) -} - -func (m arcgisServiceFeatureMods) WithFeatureServiceItemLayers(number int, related *ArcgisLayerTemplate) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(ctx context.Context, o *ArcgisServiceFeatureTemplate) { - o.r.FeatureServiceItemLayers = []*arcgisServiceFeatureRFeatureServiceItemLayersR{{ - number: number, - o: related, - }} - }) -} - -func (m arcgisServiceFeatureMods) WithNewFeatureServiceItemLayers(number int, mods ...ArcgisLayerMod) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(ctx context.Context, o *ArcgisServiceFeatureTemplate) { - related := o.f.NewArcgisLayerWithContext(ctx, mods...) - m.WithFeatureServiceItemLayers(number, related).Apply(ctx, o) - }) -} - -func (m arcgisServiceFeatureMods) AddFeatureServiceItemLayers(number int, related *ArcgisLayerTemplate) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(ctx context.Context, o *ArcgisServiceFeatureTemplate) { - o.r.FeatureServiceItemLayers = append(o.r.FeatureServiceItemLayers, &arcgisServiceFeatureRFeatureServiceItemLayersR{ - number: number, - o: related, - }) - }) -} - -func (m arcgisServiceFeatureMods) AddNewFeatureServiceItemLayers(number int, mods ...ArcgisLayerMod) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(ctx context.Context, o *ArcgisServiceFeatureTemplate) { - related := o.f.NewArcgisLayerWithContext(ctx, mods...) - m.AddFeatureServiceItemLayers(number, related).Apply(ctx, o) - }) -} - -func (m arcgisServiceFeatureMods) AddExistingFeatureServiceItemLayers(existingModels ...*models.ArcgisLayer) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(ctx context.Context, o *ArcgisServiceFeatureTemplate) { - for _, em := range existingModels { - o.r.FeatureServiceItemLayers = append(o.r.FeatureServiceItemLayers, &arcgisServiceFeatureRFeatureServiceItemLayersR{ - o: o.f.FromExistingArcgisLayer(em), - }) - } - }) -} - -func (m arcgisServiceFeatureMods) WithoutFeatureServiceItemLayers() ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(ctx context.Context, o *ArcgisServiceFeatureTemplate) { - o.r.FeatureServiceItemLayers = nil - }) -} - -func (m arcgisServiceFeatureMods) WithFieldseekerServiceFeatureItemOrganizations(number int, related *OrganizationTemplate) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(ctx context.Context, o *ArcgisServiceFeatureTemplate) { - o.r.FieldseekerServiceFeatureItemOrganizations = []*arcgisServiceFeatureRFieldseekerServiceFeatureItemOrganizationsR{{ - number: number, - o: related, - }} - }) -} - -func (m arcgisServiceFeatureMods) WithNewFieldseekerServiceFeatureItemOrganizations(number int, mods ...OrganizationMod) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(ctx context.Context, o *ArcgisServiceFeatureTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - m.WithFieldseekerServiceFeatureItemOrganizations(number, related).Apply(ctx, o) - }) -} - -func (m arcgisServiceFeatureMods) AddFieldseekerServiceFeatureItemOrganizations(number int, related *OrganizationTemplate) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(ctx context.Context, o *ArcgisServiceFeatureTemplate) { - o.r.FieldseekerServiceFeatureItemOrganizations = append(o.r.FieldseekerServiceFeatureItemOrganizations, &arcgisServiceFeatureRFieldseekerServiceFeatureItemOrganizationsR{ - number: number, - o: related, - }) - }) -} - -func (m arcgisServiceFeatureMods) AddNewFieldseekerServiceFeatureItemOrganizations(number int, mods ...OrganizationMod) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(ctx context.Context, o *ArcgisServiceFeatureTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - m.AddFieldseekerServiceFeatureItemOrganizations(number, related).Apply(ctx, o) - }) -} - -func (m arcgisServiceFeatureMods) AddExistingFieldseekerServiceFeatureItemOrganizations(existingModels ...*models.Organization) ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(ctx context.Context, o *ArcgisServiceFeatureTemplate) { - for _, em := range existingModels { - o.r.FieldseekerServiceFeatureItemOrganizations = append(o.r.FieldseekerServiceFeatureItemOrganizations, &arcgisServiceFeatureRFieldseekerServiceFeatureItemOrganizationsR{ - o: o.f.FromExistingOrganization(em), - }) - } - }) -} - -func (m arcgisServiceFeatureMods) WithoutFieldseekerServiceFeatureItemOrganizations() ArcgisServiceFeatureMod { - return ArcgisServiceFeatureModFunc(func(ctx context.Context, o *ArcgisServiceFeatureTemplate) { - o.r.FieldseekerServiceFeatureItemOrganizations = nil - }) -} diff --git a/db/factory/arcgis.service_map.bob.go b/db/factory/arcgis.service_map.bob.go deleted file mode 100644 index 843d707b..00000000 --- a/db/factory/arcgis.service_map.bob.go +++ /dev/null @@ -1,501 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/omit" - "github.com/jaswdr/faker/v2" -) - -type ArcgisServiceMapMod interface { - Apply(context.Context, *ArcgisServiceMapTemplate) -} - -type ArcgisServiceMapModFunc func(context.Context, *ArcgisServiceMapTemplate) - -func (f ArcgisServiceMapModFunc) Apply(ctx context.Context, n *ArcgisServiceMapTemplate) { - f(ctx, n) -} - -type ArcgisServiceMapModSlice []ArcgisServiceMapMod - -func (mods ArcgisServiceMapModSlice) Apply(ctx context.Context, n *ArcgisServiceMapTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// ArcgisServiceMapTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type ArcgisServiceMapTemplate struct { - AccountID func() string - ArcgisID func() string - Name func() string - Title func() string - URL func() string - - r arcgisServiceMapR - f *Factory - - alreadyPersisted bool -} - -type arcgisServiceMapR struct { - Account *arcgisServiceMapRAccountR -} - -type arcgisServiceMapRAccountR struct { - o *ArcgisAccountTemplate -} - -// Apply mods to the ArcgisServiceMapTemplate -func (o *ArcgisServiceMapTemplate) Apply(ctx context.Context, mods ...ArcgisServiceMapMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.ArcgisServiceMap -// according to the relationships in the template. Nothing is inserted into the db -func (t ArcgisServiceMapTemplate) setModelRels(o *models.ArcgisServiceMap) { - if t.r.Account != nil { - rel := t.r.Account.o.Build() - rel.R.ServiceMaps = append(rel.R.ServiceMaps, o) - o.AccountID = rel.ID // h2 - o.R.Account = rel - } -} - -// BuildSetter returns an *models.ArcgisServiceMapSetter -// this does nothing with the relationship templates -func (o ArcgisServiceMapTemplate) BuildSetter() *models.ArcgisServiceMapSetter { - m := &models.ArcgisServiceMapSetter{} - - if o.AccountID != nil { - val := o.AccountID() - m.AccountID = omit.From(val) - } - if o.ArcgisID != nil { - val := o.ArcgisID() - m.ArcgisID = omit.From(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omit.From(val) - } - if o.Title != nil { - val := o.Title() - m.Title = omit.From(val) - } - if o.URL != nil { - val := o.URL() - m.URL = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.ArcgisServiceMapSetter -// this does nothing with the relationship templates -func (o ArcgisServiceMapTemplate) BuildManySetter(number int) []*models.ArcgisServiceMapSetter { - m := make([]*models.ArcgisServiceMapSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.ArcgisServiceMap -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ArcgisServiceMapTemplate.Create -func (o ArcgisServiceMapTemplate) Build() *models.ArcgisServiceMap { - m := &models.ArcgisServiceMap{} - - if o.AccountID != nil { - m.AccountID = o.AccountID() - } - if o.ArcgisID != nil { - m.ArcgisID = o.ArcgisID() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Title != nil { - m.Title = o.Title() - } - if o.URL != nil { - m.URL = o.URL() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.ArcgisServiceMapSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ArcgisServiceMapTemplate.CreateMany -func (o ArcgisServiceMapTemplate) BuildMany(number int) models.ArcgisServiceMapSlice { - m := make(models.ArcgisServiceMapSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableArcgisServiceMap(m *models.ArcgisServiceMapSetter) { - if !(m.AccountID.IsValue()) { - val := random_string(nil) - m.AccountID = omit.From(val) - } - if !(m.ArcgisID.IsValue()) { - val := random_string(nil) - m.ArcgisID = omit.From(val) - } - if !(m.Name.IsValue()) { - val := random_string(nil) - m.Name = omit.From(val) - } - if !(m.Title.IsValue()) { - val := random_string(nil) - m.Title = omit.From(val) - } - if !(m.URL.IsValue()) { - val := random_string(nil) - m.URL = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.ArcgisServiceMap -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *ArcgisServiceMapTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.ArcgisServiceMap) error { - var err error - - return err -} - -// Create builds a arcgisServiceMap and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *ArcgisServiceMapTemplate) Create(ctx context.Context, exec bob.Executor) (*models.ArcgisServiceMap, error) { - var err error - opt := o.BuildSetter() - ensureCreatableArcgisServiceMap(opt) - - if o.r.Account == nil { - ArcgisServiceMapMods.WithNewAccount().Apply(ctx, o) - } - - var rel0 *models.ArcgisAccount - - if o.r.Account.o.alreadyPersisted { - rel0 = o.r.Account.o.Build() - } else { - rel0, err = o.r.Account.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.AccountID = omit.From(rel0.ID) - - m, err := models.ArcgisServiceMaps.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.Account = rel0 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a arcgisServiceMap and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *ArcgisServiceMapTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.ArcgisServiceMap { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a arcgisServiceMap 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 *ArcgisServiceMapTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.ArcgisServiceMap { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple arcgisServiceMaps and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o ArcgisServiceMapTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.ArcgisServiceMapSlice, error) { - var err error - m := make(models.ArcgisServiceMapSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple arcgisServiceMaps and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o ArcgisServiceMapTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.ArcgisServiceMapSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple arcgisServiceMaps 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 ArcgisServiceMapTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.ArcgisServiceMapSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// ArcgisServiceMap has methods that act as mods for the ArcgisServiceMapTemplate -var ArcgisServiceMapMods arcgisServiceMapMods - -type arcgisServiceMapMods struct{} - -func (m arcgisServiceMapMods) RandomizeAllColumns(f *faker.Faker) ArcgisServiceMapMod { - return ArcgisServiceMapModSlice{ - ArcgisServiceMapMods.RandomAccountID(f), - ArcgisServiceMapMods.RandomArcgisID(f), - ArcgisServiceMapMods.RandomName(f), - ArcgisServiceMapMods.RandomTitle(f), - ArcgisServiceMapMods.RandomURL(f), - } -} - -// Set the model columns to this value -func (m arcgisServiceMapMods) AccountID(val string) ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(_ context.Context, o *ArcgisServiceMapTemplate) { - o.AccountID = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisServiceMapMods) AccountIDFunc(f func() string) ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(_ context.Context, o *ArcgisServiceMapTemplate) { - o.AccountID = f - }) -} - -// Clear any values for the column -func (m arcgisServiceMapMods) UnsetAccountID() ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(_ context.Context, o *ArcgisServiceMapTemplate) { - o.AccountID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisServiceMapMods) RandomAccountID(f *faker.Faker) ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(_ context.Context, o *ArcgisServiceMapTemplate) { - o.AccountID = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisServiceMapMods) ArcgisID(val string) ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(_ context.Context, o *ArcgisServiceMapTemplate) { - o.ArcgisID = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisServiceMapMods) ArcgisIDFunc(f func() string) ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(_ context.Context, o *ArcgisServiceMapTemplate) { - o.ArcgisID = f - }) -} - -// Clear any values for the column -func (m arcgisServiceMapMods) UnsetArcgisID() ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(_ context.Context, o *ArcgisServiceMapTemplate) { - o.ArcgisID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisServiceMapMods) RandomArcgisID(f *faker.Faker) ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(_ context.Context, o *ArcgisServiceMapTemplate) { - o.ArcgisID = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisServiceMapMods) Name(val string) ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(_ context.Context, o *ArcgisServiceMapTemplate) { - o.Name = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisServiceMapMods) NameFunc(f func() string) ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(_ context.Context, o *ArcgisServiceMapTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m arcgisServiceMapMods) UnsetName() ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(_ context.Context, o *ArcgisServiceMapTemplate) { - o.Name = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisServiceMapMods) RandomName(f *faker.Faker) ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(_ context.Context, o *ArcgisServiceMapTemplate) { - o.Name = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisServiceMapMods) Title(val string) ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(_ context.Context, o *ArcgisServiceMapTemplate) { - o.Title = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisServiceMapMods) TitleFunc(f func() string) ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(_ context.Context, o *ArcgisServiceMapTemplate) { - o.Title = f - }) -} - -// Clear any values for the column -func (m arcgisServiceMapMods) UnsetTitle() ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(_ context.Context, o *ArcgisServiceMapTemplate) { - o.Title = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisServiceMapMods) RandomTitle(f *faker.Faker) ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(_ context.Context, o *ArcgisServiceMapTemplate) { - o.Title = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisServiceMapMods) URL(val string) ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(_ context.Context, o *ArcgisServiceMapTemplate) { - o.URL = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisServiceMapMods) URLFunc(f func() string) ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(_ context.Context, o *ArcgisServiceMapTemplate) { - o.URL = f - }) -} - -// Clear any values for the column -func (m arcgisServiceMapMods) UnsetURL() ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(_ context.Context, o *ArcgisServiceMapTemplate) { - o.URL = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisServiceMapMods) RandomURL(f *faker.Faker) ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(_ context.Context, o *ArcgisServiceMapTemplate) { - o.URL = func() string { - return random_string(f) - } - }) -} - -func (m arcgisServiceMapMods) WithParentsCascading() ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(ctx context.Context, o *ArcgisServiceMapTemplate) { - if isDone, _ := arcgisServiceMapWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = arcgisServiceMapWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewArcgisAccountWithContext(ctx, ArcgisAccountMods.WithParentsCascading()) - m.WithAccount(related).Apply(ctx, o) - } - }) -} - -func (m arcgisServiceMapMods) WithAccount(rel *ArcgisAccountTemplate) ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(ctx context.Context, o *ArcgisServiceMapTemplate) { - o.r.Account = &arcgisServiceMapRAccountR{ - o: rel, - } - }) -} - -func (m arcgisServiceMapMods) WithNewAccount(mods ...ArcgisAccountMod) ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(ctx context.Context, o *ArcgisServiceMapTemplate) { - related := o.f.NewArcgisAccountWithContext(ctx, mods...) - - m.WithAccount(related).Apply(ctx, o) - }) -} - -func (m arcgisServiceMapMods) WithExistingAccount(em *models.ArcgisAccount) ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(ctx context.Context, o *ArcgisServiceMapTemplate) { - o.r.Account = &arcgisServiceMapRAccountR{ - o: o.f.FromExistingArcgisAccount(em), - } - }) -} - -func (m arcgisServiceMapMods) WithoutAccount() ArcgisServiceMapMod { - return ArcgisServiceMapModFunc(func(ctx context.Context, o *ArcgisServiceMapTemplate) { - o.r.Account = nil - }) -} diff --git a/db/factory/arcgis.user_.bob.go b/db/factory/arcgis.user_.bob.go deleted file mode 100644 index 51851826..00000000 --- a/db/factory/arcgis.user_.bob.go +++ /dev/null @@ -1,984 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/omit" - "github.com/jaswdr/faker/v2" -) - -type ArcgisUserMod interface { - Apply(context.Context, *ArcgisUserTemplate) -} - -type ArcgisUserModFunc func(context.Context, *ArcgisUserTemplate) - -func (f ArcgisUserModFunc) Apply(ctx context.Context, n *ArcgisUserTemplate) { - f(ctx, n) -} - -type ArcgisUserModSlice []ArcgisUserMod - -func (mods ArcgisUserModSlice) Apply(ctx context.Context, n *ArcgisUserTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// ArcgisUserTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type ArcgisUserTemplate struct { - Access func() string - Created func() time.Time - Email func() string - FullName func() string - ID func() string - Level func() string - OrgID func() string - PublicUserID func() int32 - Region func() string - Role func() string - RoleID func() string - Username func() string - UserLicenseTypeID func() string - UserType func() string - - r arcgisuserR - f *Factory - - alreadyPersisted bool -} - -type arcgisuserR struct { - PublicUserUser *arcgisuserRPublicUserUserR - UserUserPrivileges []*arcgisuserRUserUserPrivilegesR -} - -type arcgisuserRPublicUserUserR struct { - o *UserTemplate -} -type arcgisuserRUserUserPrivilegesR struct { - number int - o *ArcgisUserPrivilegeTemplate -} - -// Apply mods to the ArcgisUserTemplate -func (o *ArcgisUserTemplate) Apply(ctx context.Context, mods ...ArcgisUserMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.ArcgisUser -// according to the relationships in the template. Nothing is inserted into the db -func (t ArcgisUserTemplate) setModelRels(o *models.ArcgisUser) { - if t.r.PublicUserUser != nil { - rel := t.r.PublicUserUser.o.Build() - rel.R.PublicUserUser = append(rel.R.PublicUserUser, o) - o.PublicUserID = rel.ID // h2 - o.R.PublicUserUser = rel - } - - if t.r.UserUserPrivileges != nil { - rel := models.ArcgisUserPrivilegeSlice{} - for _, r := range t.r.UserUserPrivileges { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.UserID = o.ID // h2 - rel.R.UserUser = o - } - rel = append(rel, related...) - } - o.R.UserUserPrivileges = rel - } -} - -// BuildSetter returns an *models.ArcgisUserSetter -// this does nothing with the relationship templates -func (o ArcgisUserTemplate) BuildSetter() *models.ArcgisUserSetter { - m := &models.ArcgisUserSetter{} - - if o.Access != nil { - val := o.Access() - m.Access = omit.From(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.Email != nil { - val := o.Email() - m.Email = omit.From(val) - } - if o.FullName != nil { - val := o.FullName() - m.FullName = omit.From(val) - } - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.Level != nil { - val := o.Level() - m.Level = omit.From(val) - } - if o.OrgID != nil { - val := o.OrgID() - m.OrgID = omit.From(val) - } - if o.PublicUserID != nil { - val := o.PublicUserID() - m.PublicUserID = omit.From(val) - } - if o.Region != nil { - val := o.Region() - m.Region = omit.From(val) - } - if o.Role != nil { - val := o.Role() - m.Role = omit.From(val) - } - if o.RoleID != nil { - val := o.RoleID() - m.RoleID = omit.From(val) - } - if o.Username != nil { - val := o.Username() - m.Username = omit.From(val) - } - if o.UserLicenseTypeID != nil { - val := o.UserLicenseTypeID() - m.UserLicenseTypeID = omit.From(val) - } - if o.UserType != nil { - val := o.UserType() - m.UserType = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.ArcgisUserSetter -// this does nothing with the relationship templates -func (o ArcgisUserTemplate) BuildManySetter(number int) []*models.ArcgisUserSetter { - m := make([]*models.ArcgisUserSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.ArcgisUser -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ArcgisUserTemplate.Create -func (o ArcgisUserTemplate) Build() *models.ArcgisUser { - m := &models.ArcgisUser{} - - if o.Access != nil { - m.Access = o.Access() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.Email != nil { - m.Email = o.Email() - } - if o.FullName != nil { - m.FullName = o.FullName() - } - if o.ID != nil { - m.ID = o.ID() - } - if o.Level != nil { - m.Level = o.Level() - } - if o.OrgID != nil { - m.OrgID = o.OrgID() - } - if o.PublicUserID != nil { - m.PublicUserID = o.PublicUserID() - } - if o.Region != nil { - m.Region = o.Region() - } - if o.Role != nil { - m.Role = o.Role() - } - if o.RoleID != nil { - m.RoleID = o.RoleID() - } - if o.Username != nil { - m.Username = o.Username() - } - if o.UserLicenseTypeID != nil { - m.UserLicenseTypeID = o.UserLicenseTypeID() - } - if o.UserType != nil { - m.UserType = o.UserType() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.ArcgisUserSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ArcgisUserTemplate.CreateMany -func (o ArcgisUserTemplate) BuildMany(number int) models.ArcgisUserSlice { - m := make(models.ArcgisUserSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableArcgisUser(m *models.ArcgisUserSetter) { - if !(m.Access.IsValue()) { - val := random_string(nil) - m.Access = omit.From(val) - } - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.Email.IsValue()) { - val := random_string(nil) - m.Email = omit.From(val) - } - if !(m.FullName.IsValue()) { - val := random_string(nil) - m.FullName = omit.From(val) - } - if !(m.ID.IsValue()) { - val := random_string(nil) - m.ID = omit.From(val) - } - if !(m.Level.IsValue()) { - val := random_string(nil) - m.Level = omit.From(val) - } - if !(m.OrgID.IsValue()) { - val := random_string(nil) - m.OrgID = omit.From(val) - } - if !(m.PublicUserID.IsValue()) { - val := random_int32(nil) - m.PublicUserID = omit.From(val) - } - if !(m.Region.IsValue()) { - val := random_string(nil) - m.Region = omit.From(val) - } - if !(m.Role.IsValue()) { - val := random_string(nil) - m.Role = omit.From(val) - } - if !(m.RoleID.IsValue()) { - val := random_string(nil) - m.RoleID = omit.From(val) - } - if !(m.Username.IsValue()) { - val := random_string(nil) - m.Username = omit.From(val) - } - if !(m.UserLicenseTypeID.IsValue()) { - val := random_string(nil) - m.UserLicenseTypeID = omit.From(val) - } - if !(m.UserType.IsValue()) { - val := random_string(nil) - m.UserType = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.ArcgisUser -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *ArcgisUserTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.ArcgisUser) error { - var err error - - isUserUserPrivilegesDone, _ := arcgisuserRelUserUserPrivilegesCtx.Value(ctx) - if !isUserUserPrivilegesDone && o.r.UserUserPrivileges != nil { - ctx = arcgisuserRelUserUserPrivilegesCtx.WithValue(ctx, true) - for _, r := range o.r.UserUserPrivileges { - if r.o.alreadyPersisted { - m.R.UserUserPrivileges = append(m.R.UserUserPrivileges, r.o.Build()) - } else { - rel1, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachUserUserPrivileges(ctx, exec, rel1...) - if err != nil { - return err - } - } - } - } - - return err -} - -// Create builds a arcgisuser and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *ArcgisUserTemplate) Create(ctx context.Context, exec bob.Executor) (*models.ArcgisUser, error) { - var err error - opt := o.BuildSetter() - ensureCreatableArcgisUser(opt) - - if o.r.PublicUserUser == nil { - ArcgisUserMods.WithNewPublicUserUser().Apply(ctx, o) - } - - var rel0 *models.User - - if o.r.PublicUserUser.o.alreadyPersisted { - rel0 = o.r.PublicUserUser.o.Build() - } else { - rel0, err = o.r.PublicUserUser.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.PublicUserID = omit.From(rel0.ID) - - m, err := models.ArcgisUsers.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.PublicUserUser = rel0 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a arcgisuser and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *ArcgisUserTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.ArcgisUser { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a arcgisuser 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 *ArcgisUserTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.ArcgisUser { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple arcgisusers and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o ArcgisUserTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.ArcgisUserSlice, error) { - var err error - m := make(models.ArcgisUserSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple arcgisusers and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o ArcgisUserTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.ArcgisUserSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple arcgisusers 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 ArcgisUserTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.ArcgisUserSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// ArcgisUser has methods that act as mods for the ArcgisUserTemplate -var ArcgisUserMods arcgisuserMods - -type arcgisuserMods struct{} - -func (m arcgisuserMods) RandomizeAllColumns(f *faker.Faker) ArcgisUserMod { - return ArcgisUserModSlice{ - ArcgisUserMods.RandomAccess(f), - ArcgisUserMods.RandomCreated(f), - ArcgisUserMods.RandomEmail(f), - ArcgisUserMods.RandomFullName(f), - ArcgisUserMods.RandomID(f), - ArcgisUserMods.RandomLevel(f), - ArcgisUserMods.RandomOrgID(f), - ArcgisUserMods.RandomPublicUserID(f), - ArcgisUserMods.RandomRegion(f), - ArcgisUserMods.RandomRole(f), - ArcgisUserMods.RandomRoleID(f), - ArcgisUserMods.RandomUsername(f), - ArcgisUserMods.RandomUserLicenseTypeID(f), - ArcgisUserMods.RandomUserType(f), - } -} - -// Set the model columns to this value -func (m arcgisuserMods) Access(val string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Access = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisuserMods) AccessFunc(f func() string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Access = f - }) -} - -// Clear any values for the column -func (m arcgisuserMods) UnsetAccess() ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Access = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisuserMods) RandomAccess(f *faker.Faker) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Access = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisuserMods) Created(val time.Time) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m arcgisuserMods) CreatedFunc(f func() time.Time) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m arcgisuserMods) UnsetCreated() ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - 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 arcgisuserMods) RandomCreated(f *faker.Faker) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisuserMods) Email(val string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Email = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisuserMods) EmailFunc(f func() string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Email = f - }) -} - -// Clear any values for the column -func (m arcgisuserMods) UnsetEmail() ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Email = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisuserMods) RandomEmail(f *faker.Faker) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Email = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisuserMods) FullName(val string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.FullName = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisuserMods) FullNameFunc(f func() string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.FullName = f - }) -} - -// Clear any values for the column -func (m arcgisuserMods) UnsetFullName() ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.FullName = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisuserMods) RandomFullName(f *faker.Faker) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.FullName = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisuserMods) ID(val string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.ID = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisuserMods) IDFunc(f func() string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m arcgisuserMods) UnsetID() ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisuserMods) RandomID(f *faker.Faker) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.ID = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisuserMods) Level(val string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Level = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisuserMods) LevelFunc(f func() string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Level = f - }) -} - -// Clear any values for the column -func (m arcgisuserMods) UnsetLevel() ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Level = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisuserMods) RandomLevel(f *faker.Faker) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Level = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisuserMods) OrgID(val string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.OrgID = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisuserMods) OrgIDFunc(f func() string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.OrgID = f - }) -} - -// Clear any values for the column -func (m arcgisuserMods) UnsetOrgID() ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.OrgID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisuserMods) RandomOrgID(f *faker.Faker) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.OrgID = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisuserMods) PublicUserID(val int32) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.PublicUserID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m arcgisuserMods) PublicUserIDFunc(f func() int32) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.PublicUserID = f - }) -} - -// Clear any values for the column -func (m arcgisuserMods) UnsetPublicUserID() ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.PublicUserID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisuserMods) RandomPublicUserID(f *faker.Faker) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.PublicUserID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisuserMods) Region(val string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Region = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisuserMods) RegionFunc(f func() string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Region = f - }) -} - -// Clear any values for the column -func (m arcgisuserMods) UnsetRegion() ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Region = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisuserMods) RandomRegion(f *faker.Faker) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Region = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisuserMods) Role(val string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Role = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisuserMods) RoleFunc(f func() string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Role = f - }) -} - -// Clear any values for the column -func (m arcgisuserMods) UnsetRole() ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Role = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisuserMods) RandomRole(f *faker.Faker) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Role = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisuserMods) RoleID(val string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.RoleID = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisuserMods) RoleIDFunc(f func() string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.RoleID = f - }) -} - -// Clear any values for the column -func (m arcgisuserMods) UnsetRoleID() ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.RoleID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisuserMods) RandomRoleID(f *faker.Faker) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.RoleID = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisuserMods) Username(val string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Username = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisuserMods) UsernameFunc(f func() string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Username = f - }) -} - -// Clear any values for the column -func (m arcgisuserMods) UnsetUsername() ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Username = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisuserMods) RandomUsername(f *faker.Faker) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.Username = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisuserMods) UserLicenseTypeID(val string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.UserLicenseTypeID = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisuserMods) UserLicenseTypeIDFunc(f func() string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.UserLicenseTypeID = f - }) -} - -// Clear any values for the column -func (m arcgisuserMods) UnsetUserLicenseTypeID() ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.UserLicenseTypeID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisuserMods) RandomUserLicenseTypeID(f *faker.Faker) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.UserLicenseTypeID = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisuserMods) UserType(val string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.UserType = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisuserMods) UserTypeFunc(f func() string) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.UserType = f - }) -} - -// Clear any values for the column -func (m arcgisuserMods) UnsetUserType() ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.UserType = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisuserMods) RandomUserType(f *faker.Faker) ArcgisUserMod { - return ArcgisUserModFunc(func(_ context.Context, o *ArcgisUserTemplate) { - o.UserType = func() string { - return random_string(f) - } - }) -} - -func (m arcgisuserMods) WithParentsCascading() ArcgisUserMod { - return ArcgisUserModFunc(func(ctx context.Context, o *ArcgisUserTemplate) { - if isDone, _ := arcgisuserWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = arcgisuserWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewUserWithContext(ctx, UserMods.WithParentsCascading()) - m.WithPublicUserUser(related).Apply(ctx, o) - } - }) -} - -func (m arcgisuserMods) WithPublicUserUser(rel *UserTemplate) ArcgisUserMod { - return ArcgisUserModFunc(func(ctx context.Context, o *ArcgisUserTemplate) { - o.r.PublicUserUser = &arcgisuserRPublicUserUserR{ - o: rel, - } - }) -} - -func (m arcgisuserMods) WithNewPublicUserUser(mods ...UserMod) ArcgisUserMod { - return ArcgisUserModFunc(func(ctx context.Context, o *ArcgisUserTemplate) { - related := o.f.NewUserWithContext(ctx, mods...) - - m.WithPublicUserUser(related).Apply(ctx, o) - }) -} - -func (m arcgisuserMods) WithExistingPublicUserUser(em *models.User) ArcgisUserMod { - return ArcgisUserModFunc(func(ctx context.Context, o *ArcgisUserTemplate) { - o.r.PublicUserUser = &arcgisuserRPublicUserUserR{ - o: o.f.FromExistingUser(em), - } - }) -} - -func (m arcgisuserMods) WithoutPublicUserUser() ArcgisUserMod { - return ArcgisUserModFunc(func(ctx context.Context, o *ArcgisUserTemplate) { - o.r.PublicUserUser = nil - }) -} - -func (m arcgisuserMods) WithUserUserPrivileges(number int, related *ArcgisUserPrivilegeTemplate) ArcgisUserMod { - return ArcgisUserModFunc(func(ctx context.Context, o *ArcgisUserTemplate) { - o.r.UserUserPrivileges = []*arcgisuserRUserUserPrivilegesR{{ - number: number, - o: related, - }} - }) -} - -func (m arcgisuserMods) WithNewUserUserPrivileges(number int, mods ...ArcgisUserPrivilegeMod) ArcgisUserMod { - return ArcgisUserModFunc(func(ctx context.Context, o *ArcgisUserTemplate) { - related := o.f.NewArcgisUserPrivilegeWithContext(ctx, mods...) - m.WithUserUserPrivileges(number, related).Apply(ctx, o) - }) -} - -func (m arcgisuserMods) AddUserUserPrivileges(number int, related *ArcgisUserPrivilegeTemplate) ArcgisUserMod { - return ArcgisUserModFunc(func(ctx context.Context, o *ArcgisUserTemplate) { - o.r.UserUserPrivileges = append(o.r.UserUserPrivileges, &arcgisuserRUserUserPrivilegesR{ - number: number, - o: related, - }) - }) -} - -func (m arcgisuserMods) AddNewUserUserPrivileges(number int, mods ...ArcgisUserPrivilegeMod) ArcgisUserMod { - return ArcgisUserModFunc(func(ctx context.Context, o *ArcgisUserTemplate) { - related := o.f.NewArcgisUserPrivilegeWithContext(ctx, mods...) - m.AddUserUserPrivileges(number, related).Apply(ctx, o) - }) -} - -func (m arcgisuserMods) AddExistingUserUserPrivileges(existingModels ...*models.ArcgisUserPrivilege) ArcgisUserMod { - return ArcgisUserModFunc(func(ctx context.Context, o *ArcgisUserTemplate) { - for _, em := range existingModels { - o.r.UserUserPrivileges = append(o.r.UserUserPrivileges, &arcgisuserRUserUserPrivilegesR{ - o: o.f.FromExistingArcgisUserPrivilege(em), - }) - } - }) -} - -func (m arcgisuserMods) WithoutUserUserPrivileges() ArcgisUserMod { - return ArcgisUserModFunc(func(ctx context.Context, o *ArcgisUserTemplate) { - o.r.UserUserPrivileges = nil - }) -} diff --git a/db/factory/arcgis.user_privilege.bob.go b/db/factory/arcgis.user_privilege.bob.go deleted file mode 100644 index 0fe57443..00000000 --- a/db/factory/arcgis.user_privilege.bob.go +++ /dev/null @@ -1,369 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/omit" - "github.com/jaswdr/faker/v2" -) - -type ArcgisUserPrivilegeMod interface { - Apply(context.Context, *ArcgisUserPrivilegeTemplate) -} - -type ArcgisUserPrivilegeModFunc func(context.Context, *ArcgisUserPrivilegeTemplate) - -func (f ArcgisUserPrivilegeModFunc) Apply(ctx context.Context, n *ArcgisUserPrivilegeTemplate) { - f(ctx, n) -} - -type ArcgisUserPrivilegeModSlice []ArcgisUserPrivilegeMod - -func (mods ArcgisUserPrivilegeModSlice) Apply(ctx context.Context, n *ArcgisUserPrivilegeTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// ArcgisUserPrivilegeTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type ArcgisUserPrivilegeTemplate struct { - UserID func() string - Privilege func() string - - r arcgisUserPrivilegeR - f *Factory - - alreadyPersisted bool -} - -type arcgisUserPrivilegeR struct { - UserUser *arcgisUserPrivilegeRUserUserR -} - -type arcgisUserPrivilegeRUserUserR struct { - o *ArcgisUserTemplate -} - -// Apply mods to the ArcgisUserPrivilegeTemplate -func (o *ArcgisUserPrivilegeTemplate) Apply(ctx context.Context, mods ...ArcgisUserPrivilegeMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.ArcgisUserPrivilege -// according to the relationships in the template. Nothing is inserted into the db -func (t ArcgisUserPrivilegeTemplate) setModelRels(o *models.ArcgisUserPrivilege) { - if t.r.UserUser != nil { - rel := t.r.UserUser.o.Build() - rel.R.UserUserPrivileges = append(rel.R.UserUserPrivileges, o) - o.UserID = rel.ID // h2 - o.R.UserUser = rel - } -} - -// BuildSetter returns an *models.ArcgisUserPrivilegeSetter -// this does nothing with the relationship templates -func (o ArcgisUserPrivilegeTemplate) BuildSetter() *models.ArcgisUserPrivilegeSetter { - m := &models.ArcgisUserPrivilegeSetter{} - - if o.UserID != nil { - val := o.UserID() - m.UserID = omit.From(val) - } - if o.Privilege != nil { - val := o.Privilege() - m.Privilege = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.ArcgisUserPrivilegeSetter -// this does nothing with the relationship templates -func (o ArcgisUserPrivilegeTemplate) BuildManySetter(number int) []*models.ArcgisUserPrivilegeSetter { - m := make([]*models.ArcgisUserPrivilegeSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.ArcgisUserPrivilege -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ArcgisUserPrivilegeTemplate.Create -func (o ArcgisUserPrivilegeTemplate) Build() *models.ArcgisUserPrivilege { - m := &models.ArcgisUserPrivilege{} - - if o.UserID != nil { - m.UserID = o.UserID() - } - if o.Privilege != nil { - m.Privilege = o.Privilege() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.ArcgisUserPrivilegeSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ArcgisUserPrivilegeTemplate.CreateMany -func (o ArcgisUserPrivilegeTemplate) BuildMany(number int) models.ArcgisUserPrivilegeSlice { - m := make(models.ArcgisUserPrivilegeSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableArcgisUserPrivilege(m *models.ArcgisUserPrivilegeSetter) { - if !(m.UserID.IsValue()) { - val := random_string(nil) - m.UserID = omit.From(val) - } - if !(m.Privilege.IsValue()) { - val := random_string(nil) - m.Privilege = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.ArcgisUserPrivilege -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *ArcgisUserPrivilegeTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.ArcgisUserPrivilege) error { - var err error - - return err -} - -// Create builds a arcgisUserPrivilege and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *ArcgisUserPrivilegeTemplate) Create(ctx context.Context, exec bob.Executor) (*models.ArcgisUserPrivilege, error) { - var err error - opt := o.BuildSetter() - ensureCreatableArcgisUserPrivilege(opt) - - if o.r.UserUser == nil { - ArcgisUserPrivilegeMods.WithNewUserUser().Apply(ctx, o) - } - - var rel0 *models.ArcgisUser - - if o.r.UserUser.o.alreadyPersisted { - rel0 = o.r.UserUser.o.Build() - } else { - rel0, err = o.r.UserUser.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.UserID = omit.From(rel0.ID) - - m, err := models.ArcgisUserPrivileges.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.UserUser = rel0 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a arcgisUserPrivilege and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *ArcgisUserPrivilegeTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.ArcgisUserPrivilege { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a arcgisUserPrivilege 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 *ArcgisUserPrivilegeTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.ArcgisUserPrivilege { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple arcgisUserPrivileges and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o ArcgisUserPrivilegeTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.ArcgisUserPrivilegeSlice, error) { - var err error - m := make(models.ArcgisUserPrivilegeSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple arcgisUserPrivileges and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o ArcgisUserPrivilegeTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.ArcgisUserPrivilegeSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple arcgisUserPrivileges 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 ArcgisUserPrivilegeTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.ArcgisUserPrivilegeSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// ArcgisUserPrivilege has methods that act as mods for the ArcgisUserPrivilegeTemplate -var ArcgisUserPrivilegeMods arcgisUserPrivilegeMods - -type arcgisUserPrivilegeMods struct{} - -func (m arcgisUserPrivilegeMods) RandomizeAllColumns(f *faker.Faker) ArcgisUserPrivilegeMod { - return ArcgisUserPrivilegeModSlice{ - ArcgisUserPrivilegeMods.RandomUserID(f), - ArcgisUserPrivilegeMods.RandomPrivilege(f), - } -} - -// Set the model columns to this value -func (m arcgisUserPrivilegeMods) UserID(val string) ArcgisUserPrivilegeMod { - return ArcgisUserPrivilegeModFunc(func(_ context.Context, o *ArcgisUserPrivilegeTemplate) { - o.UserID = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisUserPrivilegeMods) UserIDFunc(f func() string) ArcgisUserPrivilegeMod { - return ArcgisUserPrivilegeModFunc(func(_ context.Context, o *ArcgisUserPrivilegeTemplate) { - o.UserID = f - }) -} - -// Clear any values for the column -func (m arcgisUserPrivilegeMods) UnsetUserID() ArcgisUserPrivilegeMod { - return ArcgisUserPrivilegeModFunc(func(_ context.Context, o *ArcgisUserPrivilegeTemplate) { - o.UserID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisUserPrivilegeMods) RandomUserID(f *faker.Faker) ArcgisUserPrivilegeMod { - return ArcgisUserPrivilegeModFunc(func(_ context.Context, o *ArcgisUserPrivilegeTemplate) { - o.UserID = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m arcgisUserPrivilegeMods) Privilege(val string) ArcgisUserPrivilegeMod { - return ArcgisUserPrivilegeModFunc(func(_ context.Context, o *ArcgisUserPrivilegeTemplate) { - o.Privilege = func() string { return val } - }) -} - -// Set the Column from the function -func (m arcgisUserPrivilegeMods) PrivilegeFunc(f func() string) ArcgisUserPrivilegeMod { - return ArcgisUserPrivilegeModFunc(func(_ context.Context, o *ArcgisUserPrivilegeTemplate) { - o.Privilege = f - }) -} - -// Clear any values for the column -func (m arcgisUserPrivilegeMods) UnsetPrivilege() ArcgisUserPrivilegeMod { - return ArcgisUserPrivilegeModFunc(func(_ context.Context, o *ArcgisUserPrivilegeTemplate) { - o.Privilege = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m arcgisUserPrivilegeMods) RandomPrivilege(f *faker.Faker) ArcgisUserPrivilegeMod { - return ArcgisUserPrivilegeModFunc(func(_ context.Context, o *ArcgisUserPrivilegeTemplate) { - o.Privilege = func() string { - return random_string(f) - } - }) -} - -func (m arcgisUserPrivilegeMods) WithParentsCascading() ArcgisUserPrivilegeMod { - return ArcgisUserPrivilegeModFunc(func(ctx context.Context, o *ArcgisUserPrivilegeTemplate) { - if isDone, _ := arcgisUserPrivilegeWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = arcgisUserPrivilegeWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewArcgisUserWithContext(ctx, ArcgisUserMods.WithParentsCascading()) - m.WithUserUser(related).Apply(ctx, o) - } - }) -} - -func (m arcgisUserPrivilegeMods) WithUserUser(rel *ArcgisUserTemplate) ArcgisUserPrivilegeMod { - return ArcgisUserPrivilegeModFunc(func(ctx context.Context, o *ArcgisUserPrivilegeTemplate) { - o.r.UserUser = &arcgisUserPrivilegeRUserUserR{ - o: rel, - } - }) -} - -func (m arcgisUserPrivilegeMods) WithNewUserUser(mods ...ArcgisUserMod) ArcgisUserPrivilegeMod { - return ArcgisUserPrivilegeModFunc(func(ctx context.Context, o *ArcgisUserPrivilegeTemplate) { - related := o.f.NewArcgisUserWithContext(ctx, mods...) - - m.WithUserUser(related).Apply(ctx, o) - }) -} - -func (m arcgisUserPrivilegeMods) WithExistingUserUser(em *models.ArcgisUser) ArcgisUserPrivilegeMod { - return ArcgisUserPrivilegeModFunc(func(ctx context.Context, o *ArcgisUserPrivilegeTemplate) { - o.r.UserUser = &arcgisUserPrivilegeRUserUserR{ - o: o.f.FromExistingArcgisUser(em), - } - }) -} - -func (m arcgisUserPrivilegeMods) WithoutUserUser() ArcgisUserPrivilegeMod { - return ArcgisUserPrivilegeModFunc(func(ctx context.Context, o *ArcgisUserPrivilegeTemplate) { - o.r.UserUser = nil - }) -} diff --git a/db/factory/bobfactory_context.bob.go b/db/factory/bobfactory_context.bob.go deleted file mode 100644 index eb21fbcb..00000000 --- a/db/factory/bobfactory_context.bob.go +++ /dev/null @@ -1,546 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import "context" - -type contextKey string - -var ( - // Relationship Contexts for address - addressWithParentsCascadingCtx = newContextual[bool]("addressWithParentsCascading") - addressRelMailersCtx = newContextual[bool]("address.comms.mailer.comms.mailer.mailer_address_id_fkey") - addressRelResidentsCtx = newContextual[bool]("address.resident.resident.resident_address_id_fkey") - addressRelSiteCtx = newContextual[bool]("address.site.site.site_address_id_fkey") - - // Relationship Contexts for arcgis.account - arcgisAccountWithParentsCascadingCtx = newContextual[bool]("arcgisAccountWithParentsCascading") - arcgisAccountRelOrganizationCtx = newContextual[bool]("arcgis.account.organization.arcgis.account.account_organization_id_fkey") - arcgisAccountRelArcgisAccountOauthTokensCtx = newContextual[bool]("arcgis.account.arcgis.oauth_token.arcgis.oauth_token.oauth_token_arcgis_account_id_fkey") - arcgisAccountRelServiceFeaturesCtx = newContextual[bool]("arcgis.account.arcgis.service_feature.arcgis.service_feature.service_feature_account_id_fkey") - arcgisAccountRelServiceMapsCtx = newContextual[bool]("arcgis.account.arcgis.service_map.arcgis.service_map.service_map_account_id_fkey") - arcgisAccountRelArcgisAccountOrganizationsCtx = newContextual[bool]("arcgis.account.organization.organization.organization_arcgis_account_id_fkey") - - // Relationship Contexts for arcgis.address_mapping - arcgisAddressMappingWithParentsCascadingCtx = newContextual[bool]("arcgisAddressMappingWithParentsCascading") - arcgisAddressMappingRelLayerFieldCtx = newContextual[bool]("arcgis.address_mapping.arcgis.layer_field.arcgis.address_mapping.address_mapping_layer_feature_service_item_id_layer_index__fkey") - arcgisAddressMappingRelOrganizationCtx = newContextual[bool]("arcgis.address_mapping.organization.arcgis.address_mapping.address_mapping_organization_id_fkey") - - // Relationship Contexts for arcgis.layer - arcgisLayerWithParentsCascadingCtx = newContextual[bool]("arcgisLayerWithParentsCascading") - arcgisLayerRelFeatureServiceItemServiceFeatureCtx = newContextual[bool]("arcgis.layer.arcgis.service_feature.arcgis.layer.layer_feature_service_item_id_fkey") - arcgisLayerRelLayerFieldsCtx = newContextual[bool]("arcgis.layer.arcgis.layer_field.arcgis.layer_field.layer_field_layer_feature_service_item_id_layer_index_fkey") - - // Relationship Contexts for arcgis.layer_field - arcgisLayerFieldWithParentsCascadingCtx = newContextual[bool]("arcgisLayerFieldWithParentsCascading") - arcgisLayerFieldRelAddressMappingsCtx = newContextual[bool]("arcgis.address_mapping.arcgis.layer_field.arcgis.address_mapping.address_mapping_layer_feature_service_item_id_layer_index__fkey") - arcgisLayerFieldRelLayerCtx = newContextual[bool]("arcgis.layer.arcgis.layer_field.arcgis.layer_field.layer_field_layer_feature_service_item_id_layer_index_fkey") - arcgisLayerFieldRelParcelMappingsCtx = newContextual[bool]("arcgis.layer_field.arcgis.parcel_mapping.arcgis.parcel_mapping.parcel_mapping_layer_feature_service_item_id_layer_index_l_fkey") - - // Relationship Contexts for arcgis.oauth_token - arcgisOauthTokenWithParentsCascadingCtx = newContextual[bool]("arcgisOauthTokenWithParentsCascading") - arcgisOauthTokenRelArcgisAccountAccountCtx = newContextual[bool]("arcgis.account.arcgis.oauth_token.arcgis.oauth_token.oauth_token_arcgis_account_id_fkey") - arcgisOauthTokenRelUserUserCtx = newContextual[bool]("arcgis.oauth_token.user_.arcgis.oauth_token.oauth_token_user_id_fkey") - - // Relationship Contexts for arcgis.parcel_mapping - arcgisParcelMappingWithParentsCascadingCtx = newContextual[bool]("arcgisParcelMappingWithParentsCascading") - arcgisParcelMappingRelLayerFieldCtx = newContextual[bool]("arcgis.layer_field.arcgis.parcel_mapping.arcgis.parcel_mapping.parcel_mapping_layer_feature_service_item_id_layer_index_l_fkey") - arcgisParcelMappingRelOrganizationCtx = newContextual[bool]("arcgis.parcel_mapping.organization.arcgis.parcel_mapping.parcel_mapping_organization_id_fkey") - - // Relationship Contexts for arcgis.service_feature - arcgisServiceFeatureWithParentsCascadingCtx = newContextual[bool]("arcgisServiceFeatureWithParentsCascading") - arcgisServiceFeatureRelFeatureServiceItemLayersCtx = newContextual[bool]("arcgis.layer.arcgis.service_feature.arcgis.layer.layer_feature_service_item_id_fkey") - arcgisServiceFeatureRelAccountCtx = newContextual[bool]("arcgis.account.arcgis.service_feature.arcgis.service_feature.service_feature_account_id_fkey") - arcgisServiceFeatureRelFieldseekerServiceFeatureItemOrganizationsCtx = newContextual[bool]("arcgis.service_feature.organization.organization.organization_fieldseeker_service_feature_item_id_fkey") - - // Relationship Contexts for arcgis.service_map - arcgisServiceMapWithParentsCascadingCtx = newContextual[bool]("arcgisServiceMapWithParentsCascading") - arcgisServiceMapRelAccountCtx = newContextual[bool]("arcgis.account.arcgis.service_map.arcgis.service_map.service_map_account_id_fkey") - - // Relationship Contexts for arcgis.user_ - arcgisuserWithParentsCascadingCtx = newContextual[bool]("arcgisuserWithParentsCascading") - arcgisuserRelPublicUserUserCtx = newContextual[bool]("arcgis.user_.user_.arcgis.user_.user__public_user_id_fkey") - arcgisuserRelUserUserPrivilegesCtx = newContextual[bool]("arcgis.user_.arcgis.user_privilege.arcgis.user_privilege.user_privilege_user_id_fkey") - - // Relationship Contexts for arcgis.user_privilege - arcgisUserPrivilegeWithParentsCascadingCtx = newContextual[bool]("arcgisUserPrivilegeWithParentsCascading") - arcgisUserPrivilegeRelUserUserCtx = newContextual[bool]("arcgis.user_.arcgis.user_privilege.arcgis.user_privilege.user_privilege_user_id_fkey") - - // Relationship Contexts for comms.email_contact - commsEmailContactWithParentsCascadingCtx = newContextual[bool]("commsEmailContactWithParentsCascading") - commsEmailContactRelDestinationEmailLogsCtx = newContextual[bool]("comms.email_contact.comms.email_log.comms.email_log.email_log_destination_fkey") - commsEmailContactRelOrganizationsCtx = newContextual[bool]("comms.email_contact.organization.district_subscription_email.district_subscription_email_email_contact_address_fkeydistrict_subscription_email.district_subscription_email_organization_id_fkey") - commsEmailContactRelEmailAddressNotifyEmailNuisancesCtx = newContextual[bool]("comms.email_contact.publicreport.notify_email_nuisance.publicreport.notify_email_nuisance.notify_email_nuisance_email_address_fkey") - commsEmailContactRelEmailAddressNotifyEmailPoolsCtx = newContextual[bool]("comms.email_contact.publicreport.notify_email_pool.publicreport.notify_email_pool.notify_email_pool_email_address_fkey") - commsEmailContactRelEmailAddressSubscribeEmailsCtx = newContextual[bool]("comms.email_contact.publicreport.subscribe_email.publicreport.subscribe_email.subscribe_email_email_address_fkey") - - // Relationship Contexts for comms.email_log - commsEmailLogWithParentsCascadingCtx = newContextual[bool]("commsEmailLogWithParentsCascading") - commsEmailLogRelDestinationEmailContactCtx = newContextual[bool]("comms.email_contact.comms.email_log.comms.email_log.email_log_destination_fkey") - commsEmailLogRelTemplateEmailTemplateCtx = newContextual[bool]("comms.email_log.comms.email_template.comms.email_log.email_log_template_id_fkey") - - // Relationship Contexts for comms.email_template - commsEmailTemplateWithParentsCascadingCtx = newContextual[bool]("commsEmailTemplateWithParentsCascading") - commsEmailTemplateRelTemplateEmailLogsCtx = newContextual[bool]("comms.email_log.comms.email_template.comms.email_log.email_log_template_id_fkey") - - // Relationship Contexts for comms.mailer - commsMailerWithParentsCascadingCtx = newContextual[bool]("commsMailerWithParentsCascading") - commsMailerRelAddressCtx = newContextual[bool]("address.comms.mailer.comms.mailer.mailer_address_id_fkey") - commsMailerRelComplianceReportRequestsCtx = newContextual[bool]("comms.mailer.compliance_report_request.compliance_report_request_mailer.compliance_report_request_mai_compliance_report_request_id_fkeycompliance_report_request_mailer.compliance_report_request_mailer_mailer_id_fkey") - - // Relationship Contexts for comms.phone - commsPhoneWithParentsCascadingCtx = newContextual[bool]("commsPhoneWithParentsCascading") - commsPhoneRelDestinationTextJobsCtx = newContextual[bool]("comms.phone.comms.text_job.comms.text_job.text_job_destination_fkey") - commsPhoneRelDestinationTextLogsCtx = newContextual[bool]("comms.phone.comms.text_log.comms.text_log.text_log_destination_fkey") - commsPhoneRelSourceTextLogsCtx = newContextual[bool]("comms.phone.comms.text_log.comms.text_log.text_log_source_fkey") - commsPhoneRelOrganizationsCtx = newContextual[bool]("comms.phone.organization.district_subscription_phone.district_subscription_phone_organization_id_fkeydistrict_subscription_phone.district_subscription_phone_phone_e164_fkey") - commsPhoneRelPropertyOwnerPhoneE164PoolsCtx = newContextual[bool]("comms.phone.fileupload.pool.fileupload.pool.pool_property_owner_phone_e164_fkey") - commsPhoneRelResidentPhoneE164PoolsCtx = newContextual[bool]("comms.phone.fileupload.pool.fileupload.pool.pool_resident_phone_e164_fkey") - commsPhoneRelPhoneE164NotifyPhoneNuisancesCtx = newContextual[bool]("comms.phone.publicreport.notify_phone_nuisance.publicreport.notify_phone_nuisance.notify_phone_nuisance_phone_e164_fkey") - commsPhoneRelPhoneE164NotifyPhonePoolsCtx = newContextual[bool]("comms.phone.publicreport.notify_phone_pool.publicreport.notify_phone_pool.notify_phone_pool_phone_e164_fkey") - commsPhoneRelPhoneE164SubscribePhonesCtx = newContextual[bool]("comms.phone.publicreport.subscribe_phone.publicreport.subscribe_phone.subscribe_phone_phone_e164_fkey") - commsPhoneRelPhoneMobileResidentsCtx = newContextual[bool]("comms.phone.resident.resident.resident_phone_mobile_fkey") - - // Relationship Contexts for comms.text_job - commsTextJobWithParentsCascadingCtx = newContextual[bool]("commsTextJobWithParentsCascading") - commsTextJobRelDestinationPhoneCtx = newContextual[bool]("comms.phone.comms.text_job.comms.text_job.text_job_destination_fkey") - - // Relationship Contexts for comms.text_log - commsTextLogWithParentsCascadingCtx = newContextual[bool]("commsTextLogWithParentsCascading") - commsTextLogRelDestinationPhoneCtx = newContextual[bool]("comms.phone.comms.text_log.comms.text_log.text_log_destination_fkey") - commsTextLogRelSourcePhoneCtx = newContextual[bool]("comms.phone.comms.text_log.comms.text_log.text_log_source_fkey") - - // Relationship Contexts for compliance_report_request - complianceReportRequestWithParentsCascadingCtx = newContextual[bool]("complianceReportRequestWithParentsCascading") - complianceReportRequestRelCreatorUserCtx = newContextual[bool]("compliance_report_request.user_.compliance_report_request.compliance_report_request_creator_fkey") - complianceReportRequestRelLeadCtx = newContextual[bool]("compliance_report_request.lead.compliance_report_request.compliance_report_request_lead_id_fkey") - complianceReportRequestRelMailersCtx = newContextual[bool]("comms.mailer.compliance_report_request.compliance_report_request_mailer.compliance_report_request_mai_compliance_report_request_id_fkeycompliance_report_request_mailer.compliance_report_request_mailer_mailer_id_fkey") - - // Relationship Contexts for compliance_report_request_mailer - complianceReportRequestMailerWithParentsCascadingCtx = newContextual[bool]("complianceReportRequestMailerWithParentsCascading") - complianceReportRequestMailerRelComplianceReportRequestCtx = newContextual[bool]("compliance_report_request.compliance_report_request_mailer.compliance_report_request_mailer.compliance_report_request_mai_compliance_report_request_id_fkey") - complianceReportRequestMailerRelMailerCtx = newContextual[bool]("comms.mailer.compliance_report_request_mailer.compliance_report_request_mailer.compliance_report_request_mailer_mailer_id_fkey") - - // Relationship Contexts for district_subscription_email - districtSubscriptionEmailWithParentsCascadingCtx = newContextual[bool]("districtSubscriptionEmailWithParentsCascading") - districtSubscriptionEmailRelEmailContactAddressEmailContactCtx = newContextual[bool]("comms.email_contact.district_subscription_email.district_subscription_email.district_subscription_email_email_contact_address_fkey") - districtSubscriptionEmailRelOrganizationCtx = newContextual[bool]("district_subscription_email.organization.district_subscription_email.district_subscription_email_organization_id_fkey") - - // Relationship Contexts for district_subscription_phone - districtSubscriptionPhoneWithParentsCascadingCtx = newContextual[bool]("districtSubscriptionPhoneWithParentsCascading") - districtSubscriptionPhoneRelOrganizationCtx = newContextual[bool]("district_subscription_phone.organization.district_subscription_phone.district_subscription_phone_organization_id_fkey") - districtSubscriptionPhoneRelPhoneE164PhoneCtx = newContextual[bool]("comms.phone.district_subscription_phone.district_subscription_phone.district_subscription_phone_phone_e164_fkey") - - // Relationship Contexts for fieldseeker.containerrelate - fieldseekerContainerrelateWithParentsCascadingCtx = newContextual[bool]("fieldseekerContainerrelateWithParentsCascading") - fieldseekerContainerrelateRelOrganizationCtx = newContextual[bool]("fieldseeker.containerrelate.organization.fieldseeker.containerrelate.containerrelate_organization_id_fkey") - - // Relationship Contexts for fieldseeker.fieldscoutinglog - fieldseekerFieldscoutinglogWithParentsCascadingCtx = newContextual[bool]("fieldseekerFieldscoutinglogWithParentsCascading") - fieldseekerFieldscoutinglogRelOrganizationCtx = newContextual[bool]("fieldseeker.fieldscoutinglog.organization.fieldseeker.fieldscoutinglog.fieldscoutinglog_organization_id_fkey") - - // Relationship Contexts for fieldseeker.habitatrelate - fieldseekerHabitatrelateWithParentsCascadingCtx = newContextual[bool]("fieldseekerHabitatrelateWithParentsCascading") - fieldseekerHabitatrelateRelOrganizationCtx = newContextual[bool]("fieldseeker.habitatrelate.organization.fieldseeker.habitatrelate.habitatrelate_organization_id_fkey") - - // Relationship Contexts for fieldseeker.inspectionsample - fieldseekerInspectionsampleWithParentsCascadingCtx = newContextual[bool]("fieldseekerInspectionsampleWithParentsCascading") - fieldseekerInspectionsampleRelOrganizationCtx = newContextual[bool]("fieldseeker.inspectionsample.organization.fieldseeker.inspectionsample.inspectionsample_organization_id_fkey") - - // Relationship Contexts for fieldseeker.inspectionsampledetail - fieldseekerInspectionsampledetailWithParentsCascadingCtx = newContextual[bool]("fieldseekerInspectionsampledetailWithParentsCascading") - fieldseekerInspectionsampledetailRelOrganizationCtx = newContextual[bool]("fieldseeker.inspectionsampledetail.organization.fieldseeker.inspectionsampledetail.inspectionsampledetail_organization_id_fkey") - - // Relationship Contexts for fieldseeker.linelocation - fieldseekerLinelocationWithParentsCascadingCtx = newContextual[bool]("fieldseekerLinelocationWithParentsCascading") - fieldseekerLinelocationRelOrganizationCtx = newContextual[bool]("fieldseeker.linelocation.organization.fieldseeker.linelocation.linelocation_organization_id_fkey") - - // Relationship Contexts for fieldseeker.locationtracking - fieldseekerLocationtrackingWithParentsCascadingCtx = newContextual[bool]("fieldseekerLocationtrackingWithParentsCascading") - fieldseekerLocationtrackingRelOrganizationCtx = newContextual[bool]("fieldseeker.locationtracking.organization.fieldseeker.locationtracking.locationtracking_organization_id_fkey") - - // Relationship Contexts for fieldseeker.mosquitoinspection - fieldseekerMosquitoinspectionWithParentsCascadingCtx = newContextual[bool]("fieldseekerMosquitoinspectionWithParentsCascading") - fieldseekerMosquitoinspectionRelOrganizationCtx = newContextual[bool]("fieldseeker.mosquitoinspection.organization.fieldseeker.mosquitoinspection.mosquitoinspection_organization_id_fkey") - - // Relationship Contexts for fieldseeker.pointlocation - fieldseekerPointlocationWithParentsCascadingCtx = newContextual[bool]("fieldseekerPointlocationWithParentsCascading") - fieldseekerPointlocationRelOrganizationCtx = newContextual[bool]("fieldseeker.pointlocation.organization.fieldseeker.pointlocation.pointlocation_organization_id_fkey") - - // Relationship Contexts for fieldseeker.polygonlocation - fieldseekerPolygonlocationWithParentsCascadingCtx = newContextual[bool]("fieldseekerPolygonlocationWithParentsCascading") - fieldseekerPolygonlocationRelOrganizationCtx = newContextual[bool]("fieldseeker.polygonlocation.organization.fieldseeker.polygonlocation.polygonlocation_organization_id_fkey") - - // Relationship Contexts for fieldseeker.pool - fieldseekerPoolWithParentsCascadingCtx = newContextual[bool]("fieldseekerPoolWithParentsCascading") - fieldseekerPoolRelOrganizationCtx = newContextual[bool]("fieldseeker.pool.organization.fieldseeker.pool.pool_organization_id_fkey") - - // Relationship Contexts for fieldseeker.pooldetail - fieldseekerPooldetailWithParentsCascadingCtx = newContextual[bool]("fieldseekerPooldetailWithParentsCascading") - fieldseekerPooldetailRelOrganizationCtx = newContextual[bool]("fieldseeker.pooldetail.organization.fieldseeker.pooldetail.pooldetail_organization_id_fkey") - - // Relationship Contexts for fieldseeker.proposedtreatmentarea - fieldseekerProposedtreatmentareaWithParentsCascadingCtx = newContextual[bool]("fieldseekerProposedtreatmentareaWithParentsCascading") - fieldseekerProposedtreatmentareaRelOrganizationCtx = newContextual[bool]("fieldseeker.proposedtreatmentarea.organization.fieldseeker.proposedtreatmentarea.proposedtreatmentarea_organization_id_fkey") - - // Relationship Contexts for fieldseeker.qamosquitoinspection - fieldseekerQamosquitoinspectionWithParentsCascadingCtx = newContextual[bool]("fieldseekerQamosquitoinspectionWithParentsCascading") - fieldseekerQamosquitoinspectionRelOrganizationCtx = newContextual[bool]("fieldseeker.qamosquitoinspection.organization.fieldseeker.qamosquitoinspection.qamosquitoinspection_organization_id_fkey") - - // Relationship Contexts for fieldseeker.rodentlocation - fieldseekerRodentlocationWithParentsCascadingCtx = newContextual[bool]("fieldseekerRodentlocationWithParentsCascading") - fieldseekerRodentlocationRelOrganizationCtx = newContextual[bool]("fieldseeker.rodentlocation.organization.fieldseeker.rodentlocation.rodentlocation_organization_id_fkey") - - // Relationship Contexts for fieldseeker.samplecollection - fieldseekerSamplecollectionWithParentsCascadingCtx = newContextual[bool]("fieldseekerSamplecollectionWithParentsCascading") - fieldseekerSamplecollectionRelOrganizationCtx = newContextual[bool]("fieldseeker.samplecollection.organization.fieldseeker.samplecollection.samplecollection_organization_id_fkey") - - // Relationship Contexts for fieldseeker.samplelocation - fieldseekerSamplelocationWithParentsCascadingCtx = newContextual[bool]("fieldseekerSamplelocationWithParentsCascading") - fieldseekerSamplelocationRelOrganizationCtx = newContextual[bool]("fieldseeker.samplelocation.organization.fieldseeker.samplelocation.samplelocation_organization_id_fkey") - - // Relationship Contexts for fieldseeker.servicerequest - fieldseekerServicerequestWithParentsCascadingCtx = newContextual[bool]("fieldseekerServicerequestWithParentsCascading") - fieldseekerServicerequestRelOrganizationCtx = newContextual[bool]("fieldseeker.servicerequest.organization.fieldseeker.servicerequest.servicerequest_organization_id_fkey") - - // Relationship Contexts for fieldseeker.speciesabundance - fieldseekerSpeciesabundanceWithParentsCascadingCtx = newContextual[bool]("fieldseekerSpeciesabundanceWithParentsCascading") - fieldseekerSpeciesabundanceRelOrganizationCtx = newContextual[bool]("fieldseeker.speciesabundance.organization.fieldseeker.speciesabundance.speciesabundance_organization_id_fkey") - - // Relationship Contexts for fieldseeker.stormdrain - fieldseekerStormdrainWithParentsCascadingCtx = newContextual[bool]("fieldseekerStormdrainWithParentsCascading") - fieldseekerStormdrainRelOrganizationCtx = newContextual[bool]("fieldseeker.stormdrain.organization.fieldseeker.stormdrain.stormdrain_organization_id_fkey") - - // Relationship Contexts for fieldseeker.timecard - fieldseekerTimecardWithParentsCascadingCtx = newContextual[bool]("fieldseekerTimecardWithParentsCascading") - fieldseekerTimecardRelOrganizationCtx = newContextual[bool]("fieldseeker.timecard.organization.fieldseeker.timecard.timecard_organization_id_fkey") - - // Relationship Contexts for fieldseeker.trapdata - fieldseekerTrapdatumWithParentsCascadingCtx = newContextual[bool]("fieldseekerTrapdatumWithParentsCascading") - fieldseekerTrapdatumRelOrganizationCtx = newContextual[bool]("fieldseeker.trapdata.organization.fieldseeker.trapdata.trapdata_organization_id_fkey") - - // Relationship Contexts for fieldseeker.traplocation - fieldseekerTraplocationWithParentsCascadingCtx = newContextual[bool]("fieldseekerTraplocationWithParentsCascading") - fieldseekerTraplocationRelOrganizationCtx = newContextual[bool]("fieldseeker.traplocation.organization.fieldseeker.traplocation.traplocation_organization_id_fkey") - - // Relationship Contexts for fieldseeker.treatment - fieldseekerTreatmentWithParentsCascadingCtx = newContextual[bool]("fieldseekerTreatmentWithParentsCascading") - fieldseekerTreatmentRelOrganizationCtx = newContextual[bool]("fieldseeker.treatment.organization.fieldseeker.treatment.treatment_organization_id_fkey") - - // Relationship Contexts for fieldseeker.treatmentarea - fieldseekerTreatmentareaWithParentsCascadingCtx = newContextual[bool]("fieldseekerTreatmentareaWithParentsCascading") - fieldseekerTreatmentareaRelOrganizationCtx = newContextual[bool]("fieldseeker.treatmentarea.organization.fieldseeker.treatmentarea.treatmentarea_organization_id_fkey") - - // Relationship Contexts for fieldseeker.zones - fieldseekerZoneWithParentsCascadingCtx = newContextual[bool]("fieldseekerZoneWithParentsCascading") - fieldseekerZoneRelOrganizationCtx = newContextual[bool]("fieldseeker.zones.organization.fieldseeker.zones.zones_organization_id_fkey") - - // Relationship Contexts for fieldseeker.zones2 - fieldseekerZones2WithParentsCascadingCtx = newContextual[bool]("fieldseekerZones2WithParentsCascading") - fieldseekerZones2RelOrganizationCtx = newContextual[bool]("fieldseeker.zones2.organization.fieldseeker.zones2.zones2_organization_id_fkey") - - // Relationship Contexts for fieldseeker_sync - fieldseekerSyncWithParentsCascadingCtx = newContextual[bool]("fieldseekerSyncWithParentsCascading") - fieldseekerSyncRelOrganizationCtx = newContextual[bool]("fieldseeker_sync.organization.fieldseeker_sync.fieldseeker_sync_organization_id_fkey") - - // Relationship Contexts for fileupload.csv - fileuploadCSVWithParentsCascadingCtx = newContextual[bool]("fileuploadCSVWithParentsCascading") - fileuploadCSVRelFileCtx = newContextual[bool]("fileupload.csv.fileupload.file.fileupload.csv.csv_file_id_fkey") - fileuploadCSVRelCSVFileErrorCSVSCtx = newContextual[bool]("fileupload.csv.fileupload.error_csv.fileupload.error_csv.error_csv_csv_file_id_fkey") - fileuploadCSVRelCSVFilePoolsCtx = newContextual[bool]("fileupload.csv.fileupload.pool.fileupload.pool.pool_csv_file_fkey") - - // Relationship Contexts for fileupload.error_csv - fileuploadErrorCSVWithParentsCascadingCtx = newContextual[bool]("fileuploadErrorCSVWithParentsCascading") - fileuploadErrorCSVRelCSVFileCSVCtx = newContextual[bool]("fileupload.csv.fileupload.error_csv.fileupload.error_csv.error_csv_csv_file_id_fkey") - - // Relationship Contexts for fileupload.error_file - fileuploadErrorFileWithParentsCascadingCtx = newContextual[bool]("fileuploadErrorFileWithParentsCascading") - fileuploadErrorFileRelFileCtx = newContextual[bool]("fileupload.error_file.fileupload.file.fileupload.error_file.error_file_file_id_fkey") - - // Relationship Contexts for fileupload.file - fileuploadFileWithParentsCascadingCtx = newContextual[bool]("fileuploadFileWithParentsCascading") - fileuploadFileRelCSVCtx = newContextual[bool]("fileupload.csv.fileupload.file.fileupload.csv.csv_file_id_fkey") - fileuploadFileRelErrorFilesCtx = newContextual[bool]("fileupload.error_file.fileupload.file.fileupload.error_file.error_file_file_id_fkey") - fileuploadFileRelCommitterUserCtx = newContextual[bool]("fileupload.file.user_.fileupload.file.file_committer_fkey") - fileuploadFileRelCreatorUserCtx = newContextual[bool]("fileupload.file.user_.fileupload.file.file_creator_id_fkey") - fileuploadFileRelOrganizationCtx = newContextual[bool]("fileupload.file.organization.fileupload.file.file_organization_id_fkey") - fileuploadFileRelSitesCtx = newContextual[bool]("fileupload.file.site.site.site_file_id_fkey") - - // Relationship Contexts for fileupload.pool - fileuploadPoolWithParentsCascadingCtx = newContextual[bool]("fileuploadPoolWithParentsCascading") - fileuploadPoolRelCreatorUserCtx = newContextual[bool]("fileupload.pool.user_.fileupload.pool.pool_creator_id_fkey") - fileuploadPoolRelCSVFileCSVCtx = newContextual[bool]("fileupload.csv.fileupload.pool.fileupload.pool.pool_csv_file_fkey") - fileuploadPoolRelPropertyOwnerPhoneE164PhoneCtx = newContextual[bool]("comms.phone.fileupload.pool.fileupload.pool.pool_property_owner_phone_e164_fkey") - fileuploadPoolRelResidentPhoneE164PhoneCtx = newContextual[bool]("comms.phone.fileupload.pool.fileupload.pool.pool_resident_phone_e164_fkey") - - // Relationship Contexts for geography_columns - geographyColumnWithParentsCascadingCtx = newContextual[bool]("geographyColumnWithParentsCascading") - - // Relationship Contexts for geometry_columns - geometryColumnWithParentsCascadingCtx = newContextual[bool]("geometryColumnWithParentsCascading") - - // Relationship Contexts for goose_db_version - gooseDBVersionWithParentsCascadingCtx = newContextual[bool]("gooseDBVersionWithParentsCascading") - - // Relationship Contexts for h3_aggregation - h3AggregationWithParentsCascadingCtx = newContextual[bool]("h3AggregationWithParentsCascading") - h3AggregationRelOrganizationCtx = newContextual[bool]("h3_aggregation.organization.h3_aggregation.h3_aggregation_organization_id_fkey") - - // Relationship Contexts for lead - leadWithParentsCascadingCtx = newContextual[bool]("leadWithParentsCascading") - leadRelComplianceReportRequestsCtx = newContextual[bool]("compliance_report_request.lead.compliance_report_request.compliance_report_request_lead_id_fkey") - leadRelCreatorUserCtx = newContextual[bool]("lead.user_.lead.lead_creator_fkey") - leadRelOrganizationCtx = newContextual[bool]("lead.organization.lead.lead_organization_id_fkey") - leadRelSiteCtx = newContextual[bool]("lead.site.lead.lead_site_id_site_version_fkey") - - // Relationship Contexts for note_audio - noteAudioWithParentsCascadingCtx = newContextual[bool]("noteAudioWithParentsCascading") - noteAudioRelCreatorUserCtx = newContextual[bool]("note_audio.user_.note_audio.note_audio_creator_id_fkey") - noteAudioRelDeletorUserCtx = newContextual[bool]("note_audio.user_.note_audio.note_audio_deletor_id_fkey") - noteAudioRelOrganizationCtx = newContextual[bool]("note_audio.organization.note_audio.note_audio_organization_id_fkey") - noteAudioRelNoteAudioBreadcrumbsCtx = newContextual[bool]("note_audio.note_audio_breadcrumb.note_audio_breadcrumb.note_audio_breadcrumb_note_audio_version_note_audio_uuid_fkey") - noteAudioRelNoteAudioDataCtx = newContextual[bool]("note_audio.note_audio_data.note_audio_data.note_audio_data_note_audio_version_note_audio_uuid_fkey") - - // Relationship Contexts for note_audio_breadcrumb - noteAudioBreadcrumbWithParentsCascadingCtx = newContextual[bool]("noteAudioBreadcrumbWithParentsCascading") - noteAudioBreadcrumbRelNoteAudioCtx = newContextual[bool]("note_audio.note_audio_breadcrumb.note_audio_breadcrumb.note_audio_breadcrumb_note_audio_version_note_audio_uuid_fkey") - - // Relationship Contexts for note_audio_data - noteAudioDatumWithParentsCascadingCtx = newContextual[bool]("noteAudioDatumWithParentsCascading") - noteAudioDatumRelNoteAudioCtx = newContextual[bool]("note_audio.note_audio_data.note_audio_data.note_audio_data_note_audio_version_note_audio_uuid_fkey") - - // Relationship Contexts for note_image - noteImageWithParentsCascadingCtx = newContextual[bool]("noteImageWithParentsCascading") - noteImageRelCreatorUserCtx = newContextual[bool]("note_image.user_.note_image.note_image_creator_id_fkey") - noteImageRelDeletorUserCtx = newContextual[bool]("note_image.user_.note_image.note_image_deletor_id_fkey") - noteImageRelOrganizationCtx = newContextual[bool]("note_image.organization.note_image.note_image_organization_id_fkey") - noteImageRelNoteImageBreadcrumbsCtx = newContextual[bool]("note_image.note_image_breadcrumb.note_image_breadcrumb.note_image_breadcrumb_note_image_version_note_image_uuid_fkey") - noteImageRelNoteImageDataCtx = newContextual[bool]("note_image.note_image_data.note_image_data.note_image_data_note_image_version_note_image_uuid_fkey") - - // Relationship Contexts for note_image_breadcrumb - noteImageBreadcrumbWithParentsCascadingCtx = newContextual[bool]("noteImageBreadcrumbWithParentsCascading") - noteImageBreadcrumbRelNoteImageCtx = newContextual[bool]("note_image.note_image_breadcrumb.note_image_breadcrumb.note_image_breadcrumb_note_image_version_note_image_uuid_fkey") - - // Relationship Contexts for note_image_data - noteImageDatumWithParentsCascadingCtx = newContextual[bool]("noteImageDatumWithParentsCascading") - noteImageDatumRelNoteImageCtx = newContextual[bool]("note_image.note_image_data.note_image_data.note_image_data_note_image_version_note_image_uuid_fkey") - - // Relationship Contexts for notification - notificationWithParentsCascadingCtx = newContextual[bool]("notificationWithParentsCascading") - notificationRelUserUserCtx = newContextual[bool]("notification.user_.notification.notification_user_id_fkey") - - // Relationship Contexts for organization - organizationWithParentsCascadingCtx = newContextual[bool]("organizationWithParentsCascading") - organizationRelAccountsCtx = newContextual[bool]("arcgis.account.organization.arcgis.account.account_organization_id_fkey") - organizationRelAddressMappingsCtx = newContextual[bool]("arcgis.address_mapping.organization.arcgis.address_mapping.address_mapping_organization_id_fkey") - organizationRelParcelMappingsCtx = newContextual[bool]("arcgis.parcel_mapping.organization.arcgis.parcel_mapping.parcel_mapping_organization_id_fkey") - organizationRelEmailContactsCtx = newContextual[bool]("comms.email_contact.organization.district_subscription_email.district_subscription_email_email_contact_address_fkeydistrict_subscription_email.district_subscription_email_organization_id_fkey") - organizationRelPhonesCtx = newContextual[bool]("comms.phone.organization.district_subscription_phone.district_subscription_phone_organization_id_fkeydistrict_subscription_phone.district_subscription_phone_phone_e164_fkey") - organizationRelContainerrelatesCtx = newContextual[bool]("fieldseeker.containerrelate.organization.fieldseeker.containerrelate.containerrelate_organization_id_fkey") - organizationRelFieldscoutinglogsCtx = newContextual[bool]("fieldseeker.fieldscoutinglog.organization.fieldseeker.fieldscoutinglog.fieldscoutinglog_organization_id_fkey") - organizationRelHabitatrelatesCtx = newContextual[bool]("fieldseeker.habitatrelate.organization.fieldseeker.habitatrelate.habitatrelate_organization_id_fkey") - organizationRelInspectionsamplesCtx = newContextual[bool]("fieldseeker.inspectionsample.organization.fieldseeker.inspectionsample.inspectionsample_organization_id_fkey") - organizationRelInspectionsampledetailsCtx = newContextual[bool]("fieldseeker.inspectionsampledetail.organization.fieldseeker.inspectionsampledetail.inspectionsampledetail_organization_id_fkey") - organizationRelLinelocationsCtx = newContextual[bool]("fieldseeker.linelocation.organization.fieldseeker.linelocation.linelocation_organization_id_fkey") - organizationRelLocationtrackingsCtx = newContextual[bool]("fieldseeker.locationtracking.organization.fieldseeker.locationtracking.locationtracking_organization_id_fkey") - organizationRelMosquitoinspectionsCtx = newContextual[bool]("fieldseeker.mosquitoinspection.organization.fieldseeker.mosquitoinspection.mosquitoinspection_organization_id_fkey") - organizationRelPointlocationsCtx = newContextual[bool]("fieldseeker.pointlocation.organization.fieldseeker.pointlocation.pointlocation_organization_id_fkey") - organizationRelPolygonlocationsCtx = newContextual[bool]("fieldseeker.polygonlocation.organization.fieldseeker.polygonlocation.polygonlocation_organization_id_fkey") - organizationRelFieldseekerPoolCtx = newContextual[bool]("fieldseeker.pool.organization.fieldseeker.pool.pool_organization_id_fkey") - organizationRelPooldetailsCtx = newContextual[bool]("fieldseeker.pooldetail.organization.fieldseeker.pooldetail.pooldetail_organization_id_fkey") - organizationRelProposedtreatmentareasCtx = newContextual[bool]("fieldseeker.proposedtreatmentarea.organization.fieldseeker.proposedtreatmentarea.proposedtreatmentarea_organization_id_fkey") - organizationRelQamosquitoinspectionsCtx = newContextual[bool]("fieldseeker.qamosquitoinspection.organization.fieldseeker.qamosquitoinspection.qamosquitoinspection_organization_id_fkey") - organizationRelRodentlocationsCtx = newContextual[bool]("fieldseeker.rodentlocation.organization.fieldseeker.rodentlocation.rodentlocation_organization_id_fkey") - organizationRelSamplecollectionsCtx = newContextual[bool]("fieldseeker.samplecollection.organization.fieldseeker.samplecollection.samplecollection_organization_id_fkey") - organizationRelSamplelocationsCtx = newContextual[bool]("fieldseeker.samplelocation.organization.fieldseeker.samplelocation.samplelocation_organization_id_fkey") - organizationRelServicerequestsCtx = newContextual[bool]("fieldseeker.servicerequest.organization.fieldseeker.servicerequest.servicerequest_organization_id_fkey") - organizationRelSpeciesabundancesCtx = newContextual[bool]("fieldseeker.speciesabundance.organization.fieldseeker.speciesabundance.speciesabundance_organization_id_fkey") - organizationRelStormdrainsCtx = newContextual[bool]("fieldseeker.stormdrain.organization.fieldseeker.stormdrain.stormdrain_organization_id_fkey") - organizationRelTimecardsCtx = newContextual[bool]("fieldseeker.timecard.organization.fieldseeker.timecard.timecard_organization_id_fkey") - organizationRelTrapdataCtx = newContextual[bool]("fieldseeker.trapdata.organization.fieldseeker.trapdata.trapdata_organization_id_fkey") - organizationRelTraplocationsCtx = newContextual[bool]("fieldseeker.traplocation.organization.fieldseeker.traplocation.traplocation_organization_id_fkey") - organizationRelTreatmentsCtx = newContextual[bool]("fieldseeker.treatment.organization.fieldseeker.treatment.treatment_organization_id_fkey") - organizationRelTreatmentareasCtx = newContextual[bool]("fieldseeker.treatmentarea.organization.fieldseeker.treatmentarea.treatmentarea_organization_id_fkey") - organizationRelZonesCtx = newContextual[bool]("fieldseeker.zones.organization.fieldseeker.zones.zones_organization_id_fkey") - organizationRelZones2sCtx = newContextual[bool]("fieldseeker.zones2.organization.fieldseeker.zones2.zones2_organization_id_fkey") - organizationRelFieldseekerSyncsCtx = newContextual[bool]("fieldseeker_sync.organization.fieldseeker_sync.fieldseeker_sync_organization_id_fkey") - organizationRelFilesCtx = newContextual[bool]("fileupload.file.organization.fileupload.file.file_organization_id_fkey") - organizationRelH3AggregationsCtx = newContextual[bool]("h3_aggregation.organization.h3_aggregation.h3_aggregation_organization_id_fkey") - organizationRelLeadsCtx = newContextual[bool]("lead.organization.lead.lead_organization_id_fkey") - organizationRelNoteAudiosCtx = newContextual[bool]("note_audio.organization.note_audio.note_audio_organization_id_fkey") - organizationRelNoteImagesCtx = newContextual[bool]("note_image.organization.note_image.note_image_organization_id_fkey") - organizationRelArcgisAccountAccountCtx = newContextual[bool]("arcgis.account.organization.organization.organization_arcgis_account_id_fkey") - organizationRelFieldseekerServiceFeatureItemServiceFeatureCtx = newContextual[bool]("arcgis.service_feature.organization.organization.organization_fieldseeker_service_feature_item_id_fkey") - organizationRelNuisancesCtx = newContextual[bool]("organization.publicreport.nuisance.publicreport.nuisance.nuisance_organization_id_fkey") - organizationRelPublicreportPoolCtx = newContextual[bool]("organization.publicreport.pool.publicreport.pool.pool_organization_id_fkey") - organizationRelQuicksCtx = newContextual[bool]("organization.publicreport.quick.publicreport.quick.quick_organization_id_fkey") - organizationRelSignalsCtx = newContextual[bool]("organization.signal.signal.signal_organization_id_fkey") - organizationRelUserCtx = newContextual[bool]("organization.user_.user_.user__organization_id_fkey") - - // Relationship Contexts for parcel - parcelWithParentsCascadingCtx = newContextual[bool]("parcelWithParentsCascading") - parcelRelSitesCtx = newContextual[bool]("parcel.site.site.site_parcel_id_fkey") - - // Relationship Contexts for pool - poolWithParentsCascadingCtx = newContextual[bool]("poolWithParentsCascading") - poolRelCreatorUserCtx = newContextual[bool]("pool.user_.pool.pool_creator_id_fkey") - poolRelSiteCtx = newContextual[bool]("pool.site.pool.pool_site_id_site_version_fkey") - poolRelSignalPoolsCtx = newContextual[bool]("pool.signal_pool.signal_pool.signal_pool_pool_id_fkey") - - // Relationship Contexts for publicreport.image - publicreportImageWithParentsCascadingCtx = newContextual[bool]("publicreportImageWithParentsCascading") - publicreportImageRelImageExifsCtx = newContextual[bool]("publicreport.image.publicreport.image_exif.publicreport.image_exif.image_exif_image_id_fkey") - publicreportImageRelNuisancesCtx = newContextual[bool]("publicreport.image.publicreport.nuisance.publicreport.nuisance_image.nuisance_image_image_id_fkeypublicreport.nuisance_image.nuisance_image_nuisance_id_fkey") - publicreportImageRelPoolsCtx = newContextual[bool]("publicreport.image.publicreport.pool.publicreport.pool_image.pool_image_image_id_fkeypublicreport.pool_image.pool_image_pool_id_fkey") - publicreportImageRelQuicksCtx = newContextual[bool]("publicreport.image.publicreport.quick.publicreport.quick_image.quick_image_image_id_fkeypublicreport.quick_image.quick_image_quick_id_fkey") - - // Relationship Contexts for publicreport.image_exif - publicreportImageExifWithParentsCascadingCtx = newContextual[bool]("publicreportImageExifWithParentsCascading") - publicreportImageExifRelImageCtx = newContextual[bool]("publicreport.image.publicreport.image_exif.publicreport.image_exif.image_exif_image_id_fkey") - - // Relationship Contexts for publicreport.notify_email_nuisance - publicreportNotifyEmailNuisanceWithParentsCascadingCtx = newContextual[bool]("publicreportNotifyEmailNuisanceWithParentsCascading") - publicreportNotifyEmailNuisanceRelEmailAddressEmailContactCtx = newContextual[bool]("comms.email_contact.publicreport.notify_email_nuisance.publicreport.notify_email_nuisance.notify_email_nuisance_email_address_fkey") - publicreportNotifyEmailNuisanceRelNuisanceCtx = newContextual[bool]("publicreport.notify_email_nuisance.publicreport.nuisance.publicreport.notify_email_nuisance.notify_email_nuisance_nuisance_id_fkey") - - // Relationship Contexts for publicreport.notify_email_pool - publicreportNotifyEmailPoolWithParentsCascadingCtx = newContextual[bool]("publicreportNotifyEmailPoolWithParentsCascading") - publicreportNotifyEmailPoolRelEmailAddressEmailContactCtx = newContextual[bool]("comms.email_contact.publicreport.notify_email_pool.publicreport.notify_email_pool.notify_email_pool_email_address_fkey") - publicreportNotifyEmailPoolRelPoolCtx = newContextual[bool]("publicreport.notify_email_pool.publicreport.pool.publicreport.notify_email_pool.notify_email_pool_pool_id_fkey") - - // Relationship Contexts for publicreport.notify_phone_nuisance - publicreportNotifyPhoneNuisanceWithParentsCascadingCtx = newContextual[bool]("publicreportNotifyPhoneNuisanceWithParentsCascading") - publicreportNotifyPhoneNuisanceRelNuisanceCtx = newContextual[bool]("publicreport.notify_phone_nuisance.publicreport.nuisance.publicreport.notify_phone_nuisance.notify_phone_nuisance_nuisance_id_fkey") - publicreportNotifyPhoneNuisanceRelPhoneE164PhoneCtx = newContextual[bool]("comms.phone.publicreport.notify_phone_nuisance.publicreport.notify_phone_nuisance.notify_phone_nuisance_phone_e164_fkey") - - // Relationship Contexts for publicreport.notify_phone_pool - publicreportNotifyPhonePoolWithParentsCascadingCtx = newContextual[bool]("publicreportNotifyPhonePoolWithParentsCascading") - publicreportNotifyPhonePoolRelPhoneE164PhoneCtx = newContextual[bool]("comms.phone.publicreport.notify_phone_pool.publicreport.notify_phone_pool.notify_phone_pool_phone_e164_fkey") - publicreportNotifyPhonePoolRelPoolCtx = newContextual[bool]("publicreport.notify_phone_pool.publicreport.pool.publicreport.notify_phone_pool.notify_phone_pool_pool_id_fkey") - - // Relationship Contexts for publicreport.nuisance - publicreportNuisanceWithParentsCascadingCtx = newContextual[bool]("publicreportNuisanceWithParentsCascading") - publicreportNuisanceRelNotifyEmailNuisancesCtx = newContextual[bool]("publicreport.notify_email_nuisance.publicreport.nuisance.publicreport.notify_email_nuisance.notify_email_nuisance_nuisance_id_fkey") - publicreportNuisanceRelNotifyPhoneNuisancesCtx = newContextual[bool]("publicreport.notify_phone_nuisance.publicreport.nuisance.publicreport.notify_phone_nuisance.notify_phone_nuisance_nuisance_id_fkey") - publicreportNuisanceRelOrganizationCtx = newContextual[bool]("organization.publicreport.nuisance.publicreport.nuisance.nuisance_organization_id_fkey") - publicreportNuisanceRelImagesCtx = newContextual[bool]("publicreport.image.publicreport.nuisance.publicreport.nuisance_image.nuisance_image_image_id_fkeypublicreport.nuisance_image.nuisance_image_nuisance_id_fkey") - - // Relationship Contexts for publicreport.nuisance_image - publicreportNuisanceImageWithParentsCascadingCtx = newContextual[bool]("publicreportNuisanceImageWithParentsCascading") - publicreportNuisanceImageRelImageCtx = newContextual[bool]("publicreport.image.publicreport.nuisance_image.publicreport.nuisance_image.nuisance_image_image_id_fkey") - publicreportNuisanceImageRelNuisanceCtx = newContextual[bool]("publicreport.nuisance.publicreport.nuisance_image.publicreport.nuisance_image.nuisance_image_nuisance_id_fkey") - - // Relationship Contexts for publicreport.pool - publicreportPoolWithParentsCascadingCtx = newContextual[bool]("publicreportPoolWithParentsCascading") - publicreportPoolRelNotifyEmailPoolsCtx = newContextual[bool]("publicreport.notify_email_pool.publicreport.pool.publicreport.notify_email_pool.notify_email_pool_pool_id_fkey") - publicreportPoolRelNotifyPhonePoolsCtx = newContextual[bool]("publicreport.notify_phone_pool.publicreport.pool.publicreport.notify_phone_pool.notify_phone_pool_pool_id_fkey") - publicreportPoolRelOrganizationCtx = newContextual[bool]("organization.publicreport.pool.publicreport.pool.pool_organization_id_fkey") - publicreportPoolRelImagesCtx = newContextual[bool]("publicreport.image.publicreport.pool.publicreport.pool_image.pool_image_image_id_fkeypublicreport.pool_image.pool_image_pool_id_fkey") - - // Relationship Contexts for publicreport.pool_image - publicreportPoolImageWithParentsCascadingCtx = newContextual[bool]("publicreportPoolImageWithParentsCascading") - publicreportPoolImageRelImageCtx = newContextual[bool]("publicreport.image.publicreport.pool_image.publicreport.pool_image.pool_image_image_id_fkey") - publicreportPoolImageRelPoolCtx = newContextual[bool]("publicreport.pool.publicreport.pool_image.publicreport.pool_image.pool_image_pool_id_fkey") - - // Relationship Contexts for publicreport.quick - publicreportQuickWithParentsCascadingCtx = newContextual[bool]("publicreportQuickWithParentsCascading") - publicreportQuickRelOrganizationCtx = newContextual[bool]("organization.publicreport.quick.publicreport.quick.quick_organization_id_fkey") - publicreportQuickRelImagesCtx = newContextual[bool]("publicreport.image.publicreport.quick.publicreport.quick_image.quick_image_image_id_fkeypublicreport.quick_image.quick_image_quick_id_fkey") - - // Relationship Contexts for publicreport.quick_image - publicreportQuickImageWithParentsCascadingCtx = newContextual[bool]("publicreportQuickImageWithParentsCascading") - publicreportQuickImageRelImageCtx = newContextual[bool]("publicreport.image.publicreport.quick_image.publicreport.quick_image.quick_image_image_id_fkey") - publicreportQuickImageRelQuickCtx = newContextual[bool]("publicreport.quick.publicreport.quick_image.publicreport.quick_image.quick_image_quick_id_fkey") - - // Relationship Contexts for publicreport.report_location - publicreportReportLocationWithParentsCascadingCtx = newContextual[bool]("publicreportReportLocationWithParentsCascading") - - // Relationship Contexts for publicreport.subscribe_email - publicreportSubscribeEmailWithParentsCascadingCtx = newContextual[bool]("publicreportSubscribeEmailWithParentsCascading") - publicreportSubscribeEmailRelEmailAddressEmailContactCtx = newContextual[bool]("comms.email_contact.publicreport.subscribe_email.publicreport.subscribe_email.subscribe_email_email_address_fkey") - - // Relationship Contexts for publicreport.subscribe_phone - publicreportSubscribePhoneWithParentsCascadingCtx = newContextual[bool]("publicreportSubscribePhoneWithParentsCascading") - publicreportSubscribePhoneRelPhoneE164PhoneCtx = newContextual[bool]("comms.phone.publicreport.subscribe_phone.publicreport.subscribe_phone.subscribe_phone_phone_e164_fkey") - - // Relationship Contexts for raster_columns - rasterColumnWithParentsCascadingCtx = newContextual[bool]("rasterColumnWithParentsCascading") - - // Relationship Contexts for raster_overviews - rasterOverviewWithParentsCascadingCtx = newContextual[bool]("rasterOverviewWithParentsCascading") - - // Relationship Contexts for resident - residentWithParentsCascadingCtx = newContextual[bool]("residentWithParentsCascading") - residentRelAddressCtx = newContextual[bool]("address.resident.resident.resident_address_id_fkey") - residentRelCreatorUserCtx = newContextual[bool]("resident.user_.resident.resident_creator_fkey") - residentRelPhoneMobilePhoneCtx = newContextual[bool]("comms.phone.resident.resident.resident_phone_mobile_fkey") - residentRelSiteCtx = newContextual[bool]("resident.site.resident.resident_site_id_site_version_fkey") - - // Relationship Contexts for sessions - sessionWithParentsCascadingCtx = newContextual[bool]("sessionWithParentsCascading") - - // Relationship Contexts for signal - signalWithParentsCascadingCtx = newContextual[bool]("signalWithParentsCascading") - signalRelAddressorUserCtx = newContextual[bool]("signal.user_.signal.signal_addressor_fkey") - signalRelCreatorUserCtx = newContextual[bool]("signal.user_.signal.signal_creator_fkey") - signalRelOrganizationCtx = newContextual[bool]("organization.signal.signal.signal_organization_id_fkey") - signalRelSignalPoolsCtx = newContextual[bool]("signal.signal_pool.signal_pool.signal_pool_signal_id_fkey") - - // Relationship Contexts for signal_pool - signalPoolWithParentsCascadingCtx = newContextual[bool]("signalPoolWithParentsCascading") - signalPoolRelPoolCtx = newContextual[bool]("pool.signal_pool.signal_pool.signal_pool_pool_id_fkey") - signalPoolRelSignalCtx = newContextual[bool]("signal.signal_pool.signal_pool.signal_pool_signal_id_fkey") - - // Relationship Contexts for site - siteWithParentsCascadingCtx = newContextual[bool]("siteWithParentsCascading") - siteRelLeadsCtx = newContextual[bool]("lead.site.lead.lead_site_id_site_version_fkey") - siteRelPoolsCtx = newContextual[bool]("pool.site.pool.pool_site_id_site_version_fkey") - siteRelResidentsCtx = newContextual[bool]("resident.site.resident.resident_site_id_site_version_fkey") - siteRelAddressCtx = newContextual[bool]("address.site.site.site_address_id_fkey") - siteRelCreatorUserCtx = newContextual[bool]("site.user_.site.site_creator_id_fkey") - siteRelFileCtx = newContextual[bool]("fileupload.file.site.site.site_file_id_fkey") - siteRelParcelCtx = newContextual[bool]("parcel.site.site.site_parcel_id_fkey") - - // Relationship Contexts for spatial_ref_sys - spatialRefSyWithParentsCascadingCtx = newContextual[bool]("spatialRefSyWithParentsCascading") - - // Relationship Contexts for user_ - userWithParentsCascadingCtx = newContextual[bool]("userWithParentsCascading") - userRelUserOauthTokensCtx = newContextual[bool]("arcgis.oauth_token.user_.arcgis.oauth_token.oauth_token_user_id_fkey") - userRelPublicUserUserCtx = newContextual[bool]("arcgis.user_.user_.arcgis.user_.user__public_user_id_fkey") - userRelCreatorComplianceReportRequestsCtx = newContextual[bool]("compliance_report_request.user_.compliance_report_request.compliance_report_request_creator_fkey") - userRelCommitterFilesCtx = newContextual[bool]("fileupload.file.user_.fileupload.file.file_committer_fkey") - userRelCreatorFilesCtx = newContextual[bool]("fileupload.file.user_.fileupload.file.file_creator_id_fkey") - userRelFileuploadPoolCtx = newContextual[bool]("fileupload.pool.user_.fileupload.pool.pool_creator_id_fkey") - userRelCreatorLeadsCtx = newContextual[bool]("lead.user_.lead.lead_creator_fkey") - userRelCreatorNoteAudiosCtx = newContextual[bool]("note_audio.user_.note_audio.note_audio_creator_id_fkey") - userRelDeletorNoteAudiosCtx = newContextual[bool]("note_audio.user_.note_audio.note_audio_deletor_id_fkey") - userRelCreatorNoteImagesCtx = newContextual[bool]("note_image.user_.note_image.note_image_creator_id_fkey") - userRelDeletorNoteImagesCtx = newContextual[bool]("note_image.user_.note_image.note_image_deletor_id_fkey") - userRelUserNotificationsCtx = newContextual[bool]("notification.user_.notification.notification_user_id_fkey") - userRelCreatorPoolsCtx = newContextual[bool]("pool.user_.pool.pool_creator_id_fkey") - userRelCreatorResidentsCtx = newContextual[bool]("resident.user_.resident.resident_creator_fkey") - userRelAddressorSignalsCtx = newContextual[bool]("signal.user_.signal.signal_addressor_fkey") - userRelCreatorSignalsCtx = newContextual[bool]("signal.user_.signal.signal_creator_fkey") - userRelCreatorSitesCtx = newContextual[bool]("site.user_.site.site_creator_id_fkey") - userRelOrganizationCtx = newContextual[bool]("organization.user_.user_.user__organization_id_fkey") -) - -// Contextual is a convienience wrapper around context.WithValue and context.Value -type contextual[V any] struct { - key contextKey -} - -func newContextual[V any](key string) contextual[V] { - return contextual[V]{key: contextKey(key)} -} - -func (k contextual[V]) WithValue(ctx context.Context, val V) context.Context { - return context.WithValue(ctx, k.key, val) -} - -func (k contextual[V]) Value(ctx context.Context) (V, bool) { - v, ok := ctx.Value(k.key).(V) - return v, ok -} diff --git a/db/factory/bobfactory_main.bob.go b/db/factory/bobfactory_main.bob.go deleted file mode 100644 index 75593eea..00000000 --- a/db/factory/bobfactory_main.bob.go +++ /dev/null @@ -1,5388 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - "time" - - "github.com/Gleipnir-Technology/bob/types" - "github.com/Gleipnir-Technology/bob/types/pgtypes" - 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/google/uuid" - "github.com/lib/pq" - "github.com/shopspring/decimal" -) - -type Factory struct { - baseAddressMods AddressModSlice - baseArcgisAccountMods ArcgisAccountModSlice - baseArcgisAddressMappingMods ArcgisAddressMappingModSlice - baseArcgisLayerMods ArcgisLayerModSlice - baseArcgisLayerFieldMods ArcgisLayerFieldModSlice - baseArcgisOauthTokenMods ArcgisOauthTokenModSlice - baseArcgisParcelMappingMods ArcgisParcelMappingModSlice - baseArcgisServiceFeatureMods ArcgisServiceFeatureModSlice - baseArcgisServiceMapMods ArcgisServiceMapModSlice - baseArcgisUserMods ArcgisUserModSlice - baseArcgisUserPrivilegeMods ArcgisUserPrivilegeModSlice - baseCommsEmailContactMods CommsEmailContactModSlice - baseCommsEmailLogMods CommsEmailLogModSlice - baseCommsEmailTemplateMods CommsEmailTemplateModSlice - baseCommsMailerMods CommsMailerModSlice - baseCommsPhoneMods CommsPhoneModSlice - baseCommsTextJobMods CommsTextJobModSlice - baseCommsTextLogMods CommsTextLogModSlice - baseComplianceReportRequestMods ComplianceReportRequestModSlice - baseComplianceReportRequestMailerMods ComplianceReportRequestMailerModSlice - baseDistrictSubscriptionEmailMods DistrictSubscriptionEmailModSlice - baseDistrictSubscriptionPhoneMods DistrictSubscriptionPhoneModSlice - baseFieldseekerContainerrelateMods FieldseekerContainerrelateModSlice - baseFieldseekerFieldscoutinglogMods FieldseekerFieldscoutinglogModSlice - baseFieldseekerHabitatrelateMods FieldseekerHabitatrelateModSlice - baseFieldseekerInspectionsampleMods FieldseekerInspectionsampleModSlice - baseFieldseekerInspectionsampledetailMods FieldseekerInspectionsampledetailModSlice - baseFieldseekerLinelocationMods FieldseekerLinelocationModSlice - baseFieldseekerLocationtrackingMods FieldseekerLocationtrackingModSlice - baseFieldseekerMosquitoinspectionMods FieldseekerMosquitoinspectionModSlice - baseFieldseekerPointlocationMods FieldseekerPointlocationModSlice - baseFieldseekerPolygonlocationMods FieldseekerPolygonlocationModSlice - baseFieldseekerPoolMods FieldseekerPoolModSlice - baseFieldseekerPooldetailMods FieldseekerPooldetailModSlice - baseFieldseekerProposedtreatmentareaMods FieldseekerProposedtreatmentareaModSlice - baseFieldseekerQamosquitoinspectionMods FieldseekerQamosquitoinspectionModSlice - baseFieldseekerRodentlocationMods FieldseekerRodentlocationModSlice - baseFieldseekerSamplecollectionMods FieldseekerSamplecollectionModSlice - baseFieldseekerSamplelocationMods FieldseekerSamplelocationModSlice - baseFieldseekerServicerequestMods FieldseekerServicerequestModSlice - baseFieldseekerSpeciesabundanceMods FieldseekerSpeciesabundanceModSlice - baseFieldseekerStormdrainMods FieldseekerStormdrainModSlice - baseFieldseekerTimecardMods FieldseekerTimecardModSlice - baseFieldseekerTrapdatumMods FieldseekerTrapdatumModSlice - baseFieldseekerTraplocationMods FieldseekerTraplocationModSlice - baseFieldseekerTreatmentMods FieldseekerTreatmentModSlice - baseFieldseekerTreatmentareaMods FieldseekerTreatmentareaModSlice - baseFieldseekerZoneMods FieldseekerZoneModSlice - baseFieldseekerZones2Mods FieldseekerZones2ModSlice - baseFieldseekerSyncMods FieldseekerSyncModSlice - baseFileuploadCSVMods FileuploadCSVModSlice - baseFileuploadErrorCSVMods FileuploadErrorCSVModSlice - baseFileuploadErrorFileMods FileuploadErrorFileModSlice - baseFileuploadFileMods FileuploadFileModSlice - baseFileuploadPoolMods FileuploadPoolModSlice - baseGeographyColumnMods GeographyColumnModSlice - baseGeometryColumnMods GeometryColumnModSlice - baseGooseDBVersionMods GooseDBVersionModSlice - baseH3AggregationMods H3AggregationModSlice - baseLeadMods LeadModSlice - baseNoteAudioMods NoteAudioModSlice - baseNoteAudioBreadcrumbMods NoteAudioBreadcrumbModSlice - baseNoteAudioDatumMods NoteAudioDatumModSlice - baseNoteImageMods NoteImageModSlice - baseNoteImageBreadcrumbMods NoteImageBreadcrumbModSlice - baseNoteImageDatumMods NoteImageDatumModSlice - baseNotificationMods NotificationModSlice - baseOrganizationMods OrganizationModSlice - baseParcelMods ParcelModSlice - basePoolMods PoolModSlice - basePublicreportImageMods PublicreportImageModSlice - basePublicreportImageExifMods PublicreportImageExifModSlice - basePublicreportNotifyEmailNuisanceMods PublicreportNotifyEmailNuisanceModSlice - basePublicreportNotifyEmailPoolMods PublicreportNotifyEmailPoolModSlice - basePublicreportNotifyPhoneNuisanceMods PublicreportNotifyPhoneNuisanceModSlice - basePublicreportNotifyPhonePoolMods PublicreportNotifyPhonePoolModSlice - basePublicreportNuisanceMods PublicreportNuisanceModSlice - basePublicreportNuisanceImageMods PublicreportNuisanceImageModSlice - basePublicreportPoolMods PublicreportPoolModSlice - basePublicreportPoolImageMods PublicreportPoolImageModSlice - basePublicreportQuickMods PublicreportQuickModSlice - basePublicreportQuickImageMods PublicreportQuickImageModSlice - basePublicreportReportLocationMods PublicreportReportLocationModSlice - basePublicreportSubscribeEmailMods PublicreportSubscribeEmailModSlice - basePublicreportSubscribePhoneMods PublicreportSubscribePhoneModSlice - baseRasterColumnMods RasterColumnModSlice - baseRasterOverviewMods RasterOverviewModSlice - baseResidentMods ResidentModSlice - baseSessionMods SessionModSlice - baseSignalMods SignalModSlice - baseSignalPoolMods SignalPoolModSlice - baseSiteMods SiteModSlice - baseSpatialRefSyMods SpatialRefSyModSlice - baseUserMods UserModSlice -} - -func New() *Factory { - return &Factory{} -} - -func (f *Factory) NewAddress(mods ...AddressMod) *AddressTemplate { - return f.NewAddressWithContext(context.Background(), mods...) -} - -func (f *Factory) NewAddressWithContext(ctx context.Context, mods ...AddressMod) *AddressTemplate { - o := &AddressTemplate{f: f} - - if f != nil { - f.baseAddressMods.Apply(ctx, o) - } - - AddressModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingAddress(m *models.Address) *AddressTemplate { - o := &AddressTemplate{f: f, alreadyPersisted: true} - - o.Country = func() enums.Countrytype { return m.Country } - o.Created = func() time.Time { return m.Created } - o.Geom = func() string { return m.Geom } - o.H3cell = func() string { return m.H3cell } - o.ID = func() int32 { return m.ID } - o.Locality = func() string { return m.Locality } - o.PostalCode = func() string { return m.PostalCode } - o.Street = func() string { return m.Street } - o.Unit = func() string { return m.Unit } - o.Region = func() string { return m.Region } - o.Number = func() string { return m.Number } - - ctx := context.Background() - if len(m.R.Mailers) > 0 { - AddressMods.AddExistingMailers(m.R.Mailers...).Apply(ctx, o) - } - if len(m.R.Residents) > 0 { - AddressMods.AddExistingResidents(m.R.Residents...).Apply(ctx, o) - } - if m.R.Site != nil { - AddressMods.WithExistingSite(m.R.Site).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewArcgisAccount(mods ...ArcgisAccountMod) *ArcgisAccountTemplate { - return f.NewArcgisAccountWithContext(context.Background(), mods...) -} - -func (f *Factory) NewArcgisAccountWithContext(ctx context.Context, mods ...ArcgisAccountMod) *ArcgisAccountTemplate { - o := &ArcgisAccountTemplate{f: f} - - if f != nil { - f.baseArcgisAccountMods.Apply(ctx, o) - } - - ArcgisAccountModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingArcgisAccount(m *models.ArcgisAccount) *ArcgisAccountTemplate { - o := &ArcgisAccountTemplate{f: f, alreadyPersisted: true} - - o.ID = func() string { return m.ID } - o.Name = func() string { return m.Name } - o.OrganizationID = func() int32 { return m.OrganizationID } - o.URLFeatures = func() null.Val[string] { return m.URLFeatures } - o.URLInsights = func() null.Val[string] { return m.URLInsights } - o.URLGeometry = func() null.Val[string] { return m.URLGeometry } - o.URLNotebooks = func() null.Val[string] { return m.URLNotebooks } - o.URLTiles = func() null.Val[string] { return m.URLTiles } - - ctx := context.Background() - if m.R.Organization != nil { - ArcgisAccountMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - if len(m.R.ArcgisAccountOauthTokens) > 0 { - ArcgisAccountMods.AddExistingArcgisAccountOauthTokens(m.R.ArcgisAccountOauthTokens...).Apply(ctx, o) - } - if len(m.R.ServiceFeatures) > 0 { - ArcgisAccountMods.AddExistingServiceFeatures(m.R.ServiceFeatures...).Apply(ctx, o) - } - if len(m.R.ServiceMaps) > 0 { - ArcgisAccountMods.AddExistingServiceMaps(m.R.ServiceMaps...).Apply(ctx, o) - } - if len(m.R.ArcgisAccountOrganizations) > 0 { - ArcgisAccountMods.AddExistingArcgisAccountOrganizations(m.R.ArcgisAccountOrganizations...).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewArcgisAddressMapping(mods ...ArcgisAddressMappingMod) *ArcgisAddressMappingTemplate { - return f.NewArcgisAddressMappingWithContext(context.Background(), mods...) -} - -func (f *Factory) NewArcgisAddressMappingWithContext(ctx context.Context, mods ...ArcgisAddressMappingMod) *ArcgisAddressMappingTemplate { - o := &ArcgisAddressMappingTemplate{f: f} - - if f != nil { - f.baseArcgisAddressMappingMods.Apply(ctx, o) - } - - ArcgisAddressMappingModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingArcgisAddressMapping(m *models.ArcgisAddressMapping) *ArcgisAddressMappingTemplate { - o := &ArcgisAddressMappingTemplate{f: f, alreadyPersisted: true} - - o.Destination = func() enums.ArcgisMappingdestinationaddress { return m.Destination } - o.LayerFeatureServiceItemID = func() string { return m.LayerFeatureServiceItemID } - o.LayerIndex = func() int32 { return m.LayerIndex } - o.LayerFieldName = func() string { return m.LayerFieldName } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.LayerField != nil { - ArcgisAddressMappingMods.WithExistingLayerField(m.R.LayerField).Apply(ctx, o) - } - if m.R.Organization != nil { - ArcgisAddressMappingMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewArcgisLayer(mods ...ArcgisLayerMod) *ArcgisLayerTemplate { - return f.NewArcgisLayerWithContext(context.Background(), mods...) -} - -func (f *Factory) NewArcgisLayerWithContext(ctx context.Context, mods ...ArcgisLayerMod) *ArcgisLayerTemplate { - o := &ArcgisLayerTemplate{f: f} - - if f != nil { - f.baseArcgisLayerMods.Apply(ctx, o) - } - - ArcgisLayerModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingArcgisLayer(m *models.ArcgisLayer) *ArcgisLayerTemplate { - o := &ArcgisLayerTemplate{f: f, alreadyPersisted: true} - - o.Extent = func() string { return m.Extent } - o.FeatureServiceItemID = func() string { return m.FeatureServiceItemID } - o.Index = func() int32 { return m.Index } - - ctx := context.Background() - if m.R.FeatureServiceItemServiceFeature != nil { - ArcgisLayerMods.WithExistingFeatureServiceItemServiceFeature(m.R.FeatureServiceItemServiceFeature).Apply(ctx, o) - } - if len(m.R.LayerFields) > 0 { - ArcgisLayerMods.AddExistingLayerFields(m.R.LayerFields...).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewArcgisLayerField(mods ...ArcgisLayerFieldMod) *ArcgisLayerFieldTemplate { - return f.NewArcgisLayerFieldWithContext(context.Background(), mods...) -} - -func (f *Factory) NewArcgisLayerFieldWithContext(ctx context.Context, mods ...ArcgisLayerFieldMod) *ArcgisLayerFieldTemplate { - o := &ArcgisLayerFieldTemplate{f: f} - - if f != nil { - f.baseArcgisLayerFieldMods.Apply(ctx, o) - } - - ArcgisLayerFieldModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingArcgisLayerField(m *models.ArcgisLayerField) *ArcgisLayerFieldTemplate { - o := &ArcgisLayerFieldTemplate{f: f, alreadyPersisted: true} - - o.LayerFeatureServiceItemID = func() string { return m.LayerFeatureServiceItemID } - o.LayerIndex = func() int32 { return m.LayerIndex } - o.Name = func() string { return m.Name } - o.Type = func() enums.ArcgisFieldtype { return m.Type } - - ctx := context.Background() - if len(m.R.AddressMappings) > 0 { - ArcgisLayerFieldMods.AddExistingAddressMappings(m.R.AddressMappings...).Apply(ctx, o) - } - if m.R.Layer != nil { - ArcgisLayerFieldMods.WithExistingLayer(m.R.Layer).Apply(ctx, o) - } - if len(m.R.ParcelMappings) > 0 { - ArcgisLayerFieldMods.AddExistingParcelMappings(m.R.ParcelMappings...).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewArcgisOauthToken(mods ...ArcgisOauthTokenMod) *ArcgisOauthTokenTemplate { - return f.NewArcgisOauthTokenWithContext(context.Background(), mods...) -} - -func (f *Factory) NewArcgisOauthTokenWithContext(ctx context.Context, mods ...ArcgisOauthTokenMod) *ArcgisOauthTokenTemplate { - o := &ArcgisOauthTokenTemplate{f: f} - - if f != nil { - f.baseArcgisOauthTokenMods.Apply(ctx, o) - } - - ArcgisOauthTokenModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingArcgisOauthToken(m *models.ArcgisOauthToken) *ArcgisOauthTokenTemplate { - o := &ArcgisOauthTokenTemplate{f: f, alreadyPersisted: true} - - o.AccessToken = func() string { return m.AccessToken } - o.AccessTokenExpires = func() time.Time { return m.AccessTokenExpires } - o.ArcgisAccountID = func() null.Val[string] { return m.ArcgisAccountID } - o.ArcgisID = func() null.Val[string] { return m.ArcgisID } - o.ArcgisLicenseTypeID = func() null.Val[string] { return m.ArcgisLicenseTypeID } - o.Created = func() time.Time { return m.Created } - o.ID = func() int32 { return m.ID } - o.InvalidatedAt = func() null.Val[time.Time] { return m.InvalidatedAt } - o.RefreshToken = func() string { return m.RefreshToken } - o.RefreshTokenExpires = func() time.Time { return m.RefreshTokenExpires } - o.UserID = func() int32 { return m.UserID } - o.Username = func() string { return m.Username } - - ctx := context.Background() - if m.R.ArcgisAccountAccount != nil { - ArcgisOauthTokenMods.WithExistingArcgisAccountAccount(m.R.ArcgisAccountAccount).Apply(ctx, o) - } - if m.R.UserUser != nil { - ArcgisOauthTokenMods.WithExistingUserUser(m.R.UserUser).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewArcgisParcelMapping(mods ...ArcgisParcelMappingMod) *ArcgisParcelMappingTemplate { - return f.NewArcgisParcelMappingWithContext(context.Background(), mods...) -} - -func (f *Factory) NewArcgisParcelMappingWithContext(ctx context.Context, mods ...ArcgisParcelMappingMod) *ArcgisParcelMappingTemplate { - o := &ArcgisParcelMappingTemplate{f: f} - - if f != nil { - f.baseArcgisParcelMappingMods.Apply(ctx, o) - } - - ArcgisParcelMappingModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingArcgisParcelMapping(m *models.ArcgisParcelMapping) *ArcgisParcelMappingTemplate { - o := &ArcgisParcelMappingTemplate{f: f, alreadyPersisted: true} - - o.Destination = func() enums.ArcgisMappingdestinationparcel { return m.Destination } - o.LayerFeatureServiceItemID = func() string { return m.LayerFeatureServiceItemID } - o.LayerIndex = func() int32 { return m.LayerIndex } - o.LayerFieldName = func() string { return m.LayerFieldName } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.LayerField != nil { - ArcgisParcelMappingMods.WithExistingLayerField(m.R.LayerField).Apply(ctx, o) - } - if m.R.Organization != nil { - ArcgisParcelMappingMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewArcgisServiceFeature(mods ...ArcgisServiceFeatureMod) *ArcgisServiceFeatureTemplate { - return f.NewArcgisServiceFeatureWithContext(context.Background(), mods...) -} - -func (f *Factory) NewArcgisServiceFeatureWithContext(ctx context.Context, mods ...ArcgisServiceFeatureMod) *ArcgisServiceFeatureTemplate { - o := &ArcgisServiceFeatureTemplate{f: f} - - if f != nil { - f.baseArcgisServiceFeatureMods.Apply(ctx, o) - } - - ArcgisServiceFeatureModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingArcgisServiceFeature(m *models.ArcgisServiceFeature) *ArcgisServiceFeatureTemplate { - o := &ArcgisServiceFeatureTemplate{f: f, alreadyPersisted: true} - - o.Extent = func() string { return m.Extent } - o.ItemID = func() string { return m.ItemID } - o.SpatialReference = func() int32 { return m.SpatialReference } - o.URL = func() string { return m.URL } - o.AccountID = func() null.Val[string] { return m.AccountID } - - ctx := context.Background() - if len(m.R.FeatureServiceItemLayers) > 0 { - ArcgisServiceFeatureMods.AddExistingFeatureServiceItemLayers(m.R.FeatureServiceItemLayers...).Apply(ctx, o) - } - if m.R.Account != nil { - ArcgisServiceFeatureMods.WithExistingAccount(m.R.Account).Apply(ctx, o) - } - if len(m.R.FieldseekerServiceFeatureItemOrganizations) > 0 { - ArcgisServiceFeatureMods.AddExistingFieldseekerServiceFeatureItemOrganizations(m.R.FieldseekerServiceFeatureItemOrganizations...).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewArcgisServiceMap(mods ...ArcgisServiceMapMod) *ArcgisServiceMapTemplate { - return f.NewArcgisServiceMapWithContext(context.Background(), mods...) -} - -func (f *Factory) NewArcgisServiceMapWithContext(ctx context.Context, mods ...ArcgisServiceMapMod) *ArcgisServiceMapTemplate { - o := &ArcgisServiceMapTemplate{f: f} - - if f != nil { - f.baseArcgisServiceMapMods.Apply(ctx, o) - } - - ArcgisServiceMapModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingArcgisServiceMap(m *models.ArcgisServiceMap) *ArcgisServiceMapTemplate { - o := &ArcgisServiceMapTemplate{f: f, alreadyPersisted: true} - - o.AccountID = func() string { return m.AccountID } - o.ArcgisID = func() string { return m.ArcgisID } - o.Name = func() string { return m.Name } - o.Title = func() string { return m.Title } - o.URL = func() string { return m.URL } - - ctx := context.Background() - if m.R.Account != nil { - ArcgisServiceMapMods.WithExistingAccount(m.R.Account).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewArcgisUser(mods ...ArcgisUserMod) *ArcgisUserTemplate { - return f.NewArcgisUserWithContext(context.Background(), mods...) -} - -func (f *Factory) NewArcgisUserWithContext(ctx context.Context, mods ...ArcgisUserMod) *ArcgisUserTemplate { - o := &ArcgisUserTemplate{f: f} - - if f != nil { - f.baseArcgisUserMods.Apply(ctx, o) - } - - ArcgisUserModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingArcgisUser(m *models.ArcgisUser) *ArcgisUserTemplate { - o := &ArcgisUserTemplate{f: f, alreadyPersisted: true} - - o.Access = func() string { return m.Access } - o.Created = func() time.Time { return m.Created } - o.Email = func() string { return m.Email } - o.FullName = func() string { return m.FullName } - o.ID = func() string { return m.ID } - o.Level = func() string { return m.Level } - o.OrgID = func() string { return m.OrgID } - o.PublicUserID = func() int32 { return m.PublicUserID } - o.Region = func() string { return m.Region } - o.Role = func() string { return m.Role } - o.RoleID = func() string { return m.RoleID } - o.Username = func() string { return m.Username } - o.UserLicenseTypeID = func() string { return m.UserLicenseTypeID } - o.UserType = func() string { return m.UserType } - - ctx := context.Background() - if m.R.PublicUserUser != nil { - ArcgisUserMods.WithExistingPublicUserUser(m.R.PublicUserUser).Apply(ctx, o) - } - if len(m.R.UserUserPrivileges) > 0 { - ArcgisUserMods.AddExistingUserUserPrivileges(m.R.UserUserPrivileges...).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewArcgisUserPrivilege(mods ...ArcgisUserPrivilegeMod) *ArcgisUserPrivilegeTemplate { - return f.NewArcgisUserPrivilegeWithContext(context.Background(), mods...) -} - -func (f *Factory) NewArcgisUserPrivilegeWithContext(ctx context.Context, mods ...ArcgisUserPrivilegeMod) *ArcgisUserPrivilegeTemplate { - o := &ArcgisUserPrivilegeTemplate{f: f} - - if f != nil { - f.baseArcgisUserPrivilegeMods.Apply(ctx, o) - } - - ArcgisUserPrivilegeModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingArcgisUserPrivilege(m *models.ArcgisUserPrivilege) *ArcgisUserPrivilegeTemplate { - o := &ArcgisUserPrivilegeTemplate{f: f, alreadyPersisted: true} - - o.UserID = func() string { return m.UserID } - o.Privilege = func() string { return m.Privilege } - - ctx := context.Background() - if m.R.UserUser != nil { - ArcgisUserPrivilegeMods.WithExistingUserUser(m.R.UserUser).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewCommsEmailContact(mods ...CommsEmailContactMod) *CommsEmailContactTemplate { - return f.NewCommsEmailContactWithContext(context.Background(), mods...) -} - -func (f *Factory) NewCommsEmailContactWithContext(ctx context.Context, mods ...CommsEmailContactMod) *CommsEmailContactTemplate { - o := &CommsEmailContactTemplate{f: f} - - if f != nil { - f.baseCommsEmailContactMods.Apply(ctx, o) - } - - CommsEmailContactModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingCommsEmailContact(m *models.CommsEmailContact) *CommsEmailContactTemplate { - o := &CommsEmailContactTemplate{f: f, alreadyPersisted: true} - - o.Address = func() string { return m.Address } - o.Confirmed = func() bool { return m.Confirmed } - o.IsSubscribed = func() bool { return m.IsSubscribed } - o.PublicID = func() string { return m.PublicID } - - ctx := context.Background() - if len(m.R.DestinationEmailLogs) > 0 { - CommsEmailContactMods.AddExistingDestinationEmailLogs(m.R.DestinationEmailLogs...).Apply(ctx, o) - } - if len(m.R.Organizations) > 0 { - CommsEmailContactMods.AddExistingOrganizations(m.R.Organizations...).Apply(ctx, o) - } - if len(m.R.EmailAddressNotifyEmailNuisances) > 0 { - CommsEmailContactMods.AddExistingEmailAddressNotifyEmailNuisances(m.R.EmailAddressNotifyEmailNuisances...).Apply(ctx, o) - } - if len(m.R.EmailAddressNotifyEmailPools) > 0 { - CommsEmailContactMods.AddExistingEmailAddressNotifyEmailPools(m.R.EmailAddressNotifyEmailPools...).Apply(ctx, o) - } - if len(m.R.EmailAddressSubscribeEmails) > 0 { - CommsEmailContactMods.AddExistingEmailAddressSubscribeEmails(m.R.EmailAddressSubscribeEmails...).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewCommsEmailLog(mods ...CommsEmailLogMod) *CommsEmailLogTemplate { - return f.NewCommsEmailLogWithContext(context.Background(), mods...) -} - -func (f *Factory) NewCommsEmailLogWithContext(ctx context.Context, mods ...CommsEmailLogMod) *CommsEmailLogTemplate { - o := &CommsEmailLogTemplate{f: f} - - if f != nil { - f.baseCommsEmailLogMods.Apply(ctx, o) - } - - CommsEmailLogModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingCommsEmailLog(m *models.CommsEmailLog) *CommsEmailLogTemplate { - o := &CommsEmailLogTemplate{f: f, alreadyPersisted: true} - - o.ID = func() int32 { return m.ID } - o.Created = func() time.Time { return m.Created } - o.DeliveryStatus = func() string { return m.DeliveryStatus } - o.Destination = func() string { return m.Destination } - o.PublicID = func() string { return m.PublicID } - o.SentAt = func() null.Val[time.Time] { return m.SentAt } - o.Source = func() string { return m.Source } - o.Subject = func() string { return m.Subject } - o.TemplateID = func() int32 { return m.TemplateID } - o.TemplateData = func() pgtypes.HStore { return m.TemplateData } - o.Type = func() enums.CommsMessagetypeemail { return m.Type } - - ctx := context.Background() - if m.R.DestinationEmailContact != nil { - CommsEmailLogMods.WithExistingDestinationEmailContact(m.R.DestinationEmailContact).Apply(ctx, o) - } - if m.R.TemplateEmailTemplate != nil { - CommsEmailLogMods.WithExistingTemplateEmailTemplate(m.R.TemplateEmailTemplate).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewCommsEmailTemplate(mods ...CommsEmailTemplateMod) *CommsEmailTemplateTemplate { - return f.NewCommsEmailTemplateWithContext(context.Background(), mods...) -} - -func (f *Factory) NewCommsEmailTemplateWithContext(ctx context.Context, mods ...CommsEmailTemplateMod) *CommsEmailTemplateTemplate { - o := &CommsEmailTemplateTemplate{f: f} - - if f != nil { - f.baseCommsEmailTemplateMods.Apply(ctx, o) - } - - CommsEmailTemplateModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingCommsEmailTemplate(m *models.CommsEmailTemplate) *CommsEmailTemplateTemplate { - o := &CommsEmailTemplateTemplate{f: f, alreadyPersisted: true} - - o.ContentHTML = func() string { return m.ContentHTML } - o.ContentTXT = func() string { return m.ContentTXT } - o.ContentHashHTML = func() string { return m.ContentHashHTML } - o.ContentHashTXT = func() string { return m.ContentHashTXT } - o.Created = func() time.Time { return m.Created } - o.ID = func() int32 { return m.ID } - o.Superceded = func() null.Val[time.Time] { return m.Superceded } - o.MessageType = func() enums.CommsMessagetypeemail { return m.MessageType } - - ctx := context.Background() - if len(m.R.TemplateEmailLogs) > 0 { - CommsEmailTemplateMods.AddExistingTemplateEmailLogs(m.R.TemplateEmailLogs...).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewCommsMailer(mods ...CommsMailerMod) *CommsMailerTemplate { - return f.NewCommsMailerWithContext(context.Background(), mods...) -} - -func (f *Factory) NewCommsMailerWithContext(ctx context.Context, mods ...CommsMailerMod) *CommsMailerTemplate { - o := &CommsMailerTemplate{f: f} - - if f != nil { - f.baseCommsMailerMods.Apply(ctx, o) - } - - CommsMailerModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingCommsMailer(m *models.CommsMailer) *CommsMailerTemplate { - o := &CommsMailerTemplate{f: f, alreadyPersisted: true} - - o.AddressID = func() int32 { return m.AddressID } - o.Created = func() time.Time { return m.Created } - o.ID = func() int32 { return m.ID } - o.Recipient = func() string { return m.Recipient } - o.UUID = func() uuid.UUID { return m.UUID } - - ctx := context.Background() - if m.R.Address != nil { - CommsMailerMods.WithExistingAddress(m.R.Address).Apply(ctx, o) - } - if len(m.R.ComplianceReportRequests) > 0 { - CommsMailerMods.AddExistingComplianceReportRequests(m.R.ComplianceReportRequests...).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewCommsPhone(mods ...CommsPhoneMod) *CommsPhoneTemplate { - return f.NewCommsPhoneWithContext(context.Background(), mods...) -} - -func (f *Factory) NewCommsPhoneWithContext(ctx context.Context, mods ...CommsPhoneMod) *CommsPhoneTemplate { - o := &CommsPhoneTemplate{f: f} - - if f != nil { - f.baseCommsPhoneMods.Apply(ctx, o) - } - - CommsPhoneModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingCommsPhone(m *models.CommsPhone) *CommsPhoneTemplate { - o := &CommsPhoneTemplate{f: f, alreadyPersisted: true} - - o.E164 = func() string { return m.E164 } - o.IsSubscribed = func() bool { return m.IsSubscribed } - o.Status = func() enums.CommsPhonestatustype { return m.Status } - - ctx := context.Background() - if len(m.R.DestinationTextJobs) > 0 { - CommsPhoneMods.AddExistingDestinationTextJobs(m.R.DestinationTextJobs...).Apply(ctx, o) - } - if len(m.R.DestinationTextLogs) > 0 { - CommsPhoneMods.AddExistingDestinationTextLogs(m.R.DestinationTextLogs...).Apply(ctx, o) - } - if len(m.R.SourceTextLogs) > 0 { - CommsPhoneMods.AddExistingSourceTextLogs(m.R.SourceTextLogs...).Apply(ctx, o) - } - if len(m.R.Organizations) > 0 { - CommsPhoneMods.AddExistingOrganizations(m.R.Organizations...).Apply(ctx, o) - } - if len(m.R.PropertyOwnerPhoneE164Pools) > 0 { - CommsPhoneMods.AddExistingPropertyOwnerPhoneE164Pools(m.R.PropertyOwnerPhoneE164Pools...).Apply(ctx, o) - } - if len(m.R.ResidentPhoneE164Pools) > 0 { - CommsPhoneMods.AddExistingResidentPhoneE164Pools(m.R.ResidentPhoneE164Pools...).Apply(ctx, o) - } - if len(m.R.PhoneE164NotifyPhoneNuisances) > 0 { - CommsPhoneMods.AddExistingPhoneE164NotifyPhoneNuisances(m.R.PhoneE164NotifyPhoneNuisances...).Apply(ctx, o) - } - if len(m.R.PhoneE164NotifyPhonePools) > 0 { - CommsPhoneMods.AddExistingPhoneE164NotifyPhonePools(m.R.PhoneE164NotifyPhonePools...).Apply(ctx, o) - } - if len(m.R.PhoneE164SubscribePhones) > 0 { - CommsPhoneMods.AddExistingPhoneE164SubscribePhones(m.R.PhoneE164SubscribePhones...).Apply(ctx, o) - } - if len(m.R.PhoneMobileResidents) > 0 { - CommsPhoneMods.AddExistingPhoneMobileResidents(m.R.PhoneMobileResidents...).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewCommsTextJob(mods ...CommsTextJobMod) *CommsTextJobTemplate { - return f.NewCommsTextJobWithContext(context.Background(), mods...) -} - -func (f *Factory) NewCommsTextJobWithContext(ctx context.Context, mods ...CommsTextJobMod) *CommsTextJobTemplate { - o := &CommsTextJobTemplate{f: f} - - if f != nil { - f.baseCommsTextJobMods.Apply(ctx, o) - } - - CommsTextJobModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingCommsTextJob(m *models.CommsTextJob) *CommsTextJobTemplate { - o := &CommsTextJobTemplate{f: f, alreadyPersisted: true} - - o.Content = func() string { return m.Content } - o.Created = func() time.Time { return m.Created } - o.Destination = func() string { return m.Destination } - o.ID = func() int32 { return m.ID } - o.Type = func() enums.CommsTextjobtype { return m.Type } - o.Source = func() enums.CommsTextjobsource { return m.Source } - o.Completed = func() null.Val[time.Time] { return m.Completed } - - ctx := context.Background() - if m.R.DestinationPhone != nil { - CommsTextJobMods.WithExistingDestinationPhone(m.R.DestinationPhone).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewCommsTextLog(mods ...CommsTextLogMod) *CommsTextLogTemplate { - return f.NewCommsTextLogWithContext(context.Background(), mods...) -} - -func (f *Factory) NewCommsTextLogWithContext(ctx context.Context, mods ...CommsTextLogMod) *CommsTextLogTemplate { - o := &CommsTextLogTemplate{f: f} - - if f != nil { - f.baseCommsTextLogMods.Apply(ctx, o) - } - - CommsTextLogModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingCommsTextLog(m *models.CommsTextLog) *CommsTextLogTemplate { - o := &CommsTextLogTemplate{f: f, alreadyPersisted: true} - - o.Content = func() string { return m.Content } - o.Created = func() time.Time { return m.Created } - o.Destination = func() string { return m.Destination } - o.ID = func() int32 { return m.ID } - o.IsWelcome = func() bool { return m.IsWelcome } - o.Origin = func() enums.CommsTextorigin { return m.Origin } - o.Source = func() string { return m.Source } - o.TwilioSid = func() null.Val[string] { return m.TwilioSid } - o.TwilioStatus = func() string { return m.TwilioStatus } - o.IsVisibleToLLM = func() bool { return m.IsVisibleToLLM } - - ctx := context.Background() - if m.R.DestinationPhone != nil { - CommsTextLogMods.WithExistingDestinationPhone(m.R.DestinationPhone).Apply(ctx, o) - } - if m.R.SourcePhone != nil { - CommsTextLogMods.WithExistingSourcePhone(m.R.SourcePhone).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewComplianceReportRequest(mods ...ComplianceReportRequestMod) *ComplianceReportRequestTemplate { - return f.NewComplianceReportRequestWithContext(context.Background(), mods...) -} - -func (f *Factory) NewComplianceReportRequestWithContext(ctx context.Context, mods ...ComplianceReportRequestMod) *ComplianceReportRequestTemplate { - o := &ComplianceReportRequestTemplate{f: f} - - if f != nil { - f.baseComplianceReportRequestMods.Apply(ctx, o) - } - - ComplianceReportRequestModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingComplianceReportRequest(m *models.ComplianceReportRequest) *ComplianceReportRequestTemplate { - o := &ComplianceReportRequestTemplate{f: f, alreadyPersisted: true} - - o.Created = func() time.Time { return m.Created } - o.Creator = func() int32 { return m.Creator } - o.ID = func() int32 { return m.ID } - o.PublicID = func() string { return m.PublicID } - o.LeadID = func() null.Val[int32] { return m.LeadID } - - ctx := context.Background() - if m.R.CreatorUser != nil { - ComplianceReportRequestMods.WithExistingCreatorUser(m.R.CreatorUser).Apply(ctx, o) - } - if m.R.Lead != nil { - ComplianceReportRequestMods.WithExistingLead(m.R.Lead).Apply(ctx, o) - } - if len(m.R.Mailers) > 0 { - ComplianceReportRequestMods.AddExistingMailers(m.R.Mailers...).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewComplianceReportRequestMailer(mods ...ComplianceReportRequestMailerMod) *ComplianceReportRequestMailerTemplate { - return f.NewComplianceReportRequestMailerWithContext(context.Background(), mods...) -} - -func (f *Factory) NewComplianceReportRequestMailerWithContext(ctx context.Context, mods ...ComplianceReportRequestMailerMod) *ComplianceReportRequestMailerTemplate { - o := &ComplianceReportRequestMailerTemplate{f: f} - - if f != nil { - f.baseComplianceReportRequestMailerMods.Apply(ctx, o) - } - - ComplianceReportRequestMailerModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingComplianceReportRequestMailer(m *models.ComplianceReportRequestMailer) *ComplianceReportRequestMailerTemplate { - o := &ComplianceReportRequestMailerTemplate{f: f, alreadyPersisted: true} - - o.ComplianceReportRequestID = func() int32 { return m.ComplianceReportRequestID } - o.MailerID = func() int32 { return m.MailerID } - - ctx := context.Background() - if m.R.ComplianceReportRequest != nil { - ComplianceReportRequestMailerMods.WithExistingComplianceReportRequest(m.R.ComplianceReportRequest).Apply(ctx, o) - } - if m.R.Mailer != nil { - ComplianceReportRequestMailerMods.WithExistingMailer(m.R.Mailer).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewDistrictSubscriptionEmail(mods ...DistrictSubscriptionEmailMod) *DistrictSubscriptionEmailTemplate { - return f.NewDistrictSubscriptionEmailWithContext(context.Background(), mods...) -} - -func (f *Factory) NewDistrictSubscriptionEmailWithContext(ctx context.Context, mods ...DistrictSubscriptionEmailMod) *DistrictSubscriptionEmailTemplate { - o := &DistrictSubscriptionEmailTemplate{f: f} - - if f != nil { - f.baseDistrictSubscriptionEmailMods.Apply(ctx, o) - } - - DistrictSubscriptionEmailModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingDistrictSubscriptionEmail(m *models.DistrictSubscriptionEmail) *DistrictSubscriptionEmailTemplate { - o := &DistrictSubscriptionEmailTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.EmailContactAddress = func() string { return m.EmailContactAddress } - - ctx := context.Background() - if m.R.EmailContactAddressEmailContact != nil { - DistrictSubscriptionEmailMods.WithExistingEmailContactAddressEmailContact(m.R.EmailContactAddressEmailContact).Apply(ctx, o) - } - if m.R.Organization != nil { - DistrictSubscriptionEmailMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewDistrictSubscriptionPhone(mods ...DistrictSubscriptionPhoneMod) *DistrictSubscriptionPhoneTemplate { - return f.NewDistrictSubscriptionPhoneWithContext(context.Background(), mods...) -} - -func (f *Factory) NewDistrictSubscriptionPhoneWithContext(ctx context.Context, mods ...DistrictSubscriptionPhoneMod) *DistrictSubscriptionPhoneTemplate { - o := &DistrictSubscriptionPhoneTemplate{f: f} - - if f != nil { - f.baseDistrictSubscriptionPhoneMods.Apply(ctx, o) - } - - DistrictSubscriptionPhoneModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingDistrictSubscriptionPhone(m *models.DistrictSubscriptionPhone) *DistrictSubscriptionPhoneTemplate { - o := &DistrictSubscriptionPhoneTemplate{f: f, alreadyPersisted: true} - - o.OrganizationID = func() int32 { return m.OrganizationID } - o.PhoneE164 = func() string { return m.PhoneE164 } - - ctx := context.Background() - if m.R.Organization != nil { - DistrictSubscriptionPhoneMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - if m.R.PhoneE164Phone != nil { - DistrictSubscriptionPhoneMods.WithExistingPhoneE164Phone(m.R.PhoneE164Phone).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerContainerrelate(mods ...FieldseekerContainerrelateMod) *FieldseekerContainerrelateTemplate { - return f.NewFieldseekerContainerrelateWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerContainerrelateWithContext(ctx context.Context, mods ...FieldseekerContainerrelateMod) *FieldseekerContainerrelateTemplate { - o := &FieldseekerContainerrelateTemplate{f: f} - - if f != nil { - f.baseFieldseekerContainerrelateMods.Apply(ctx, o) - } - - FieldseekerContainerrelateModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerContainerrelate(m *models.FieldseekerContainerrelate) *FieldseekerContainerrelateTemplate { - o := &FieldseekerContainerrelateTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Inspsampleid = func() null.Val[uuid.UUID] { return m.Inspsampleid } - o.Mosquitoinspid = func() null.Val[uuid.UUID] { return m.Mosquitoinspid } - o.Treatmentid = func() null.Val[uuid.UUID] { return m.Treatmentid } - o.Containertype = func() null.Val[string] { return m.Containertype } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerContainerrelateMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerFieldscoutinglog(mods ...FieldseekerFieldscoutinglogMod) *FieldseekerFieldscoutinglogTemplate { - return f.NewFieldseekerFieldscoutinglogWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerFieldscoutinglogWithContext(ctx context.Context, mods ...FieldseekerFieldscoutinglogMod) *FieldseekerFieldscoutinglogTemplate { - o := &FieldseekerFieldscoutinglogTemplate{f: f} - - if f != nil { - f.baseFieldseekerFieldscoutinglogMods.Apply(ctx, o) - } - - FieldseekerFieldscoutinglogModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerFieldscoutinglog(m *models.FieldseekerFieldscoutinglog) *FieldseekerFieldscoutinglogTemplate { - o := &FieldseekerFieldscoutinglogTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.Status = func() null.Val[int16] { return m.Status } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerFieldscoutinglogMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerHabitatrelate(mods ...FieldseekerHabitatrelateMod) *FieldseekerHabitatrelateTemplate { - return f.NewFieldseekerHabitatrelateWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerHabitatrelateWithContext(ctx context.Context, mods ...FieldseekerHabitatrelateMod) *FieldseekerHabitatrelateTemplate { - o := &FieldseekerHabitatrelateTemplate{f: f} - - if f != nil { - f.baseFieldseekerHabitatrelateMods.Apply(ctx, o) - } - - FieldseekerHabitatrelateModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerHabitatrelate(m *models.FieldseekerHabitatrelate) *FieldseekerHabitatrelateTemplate { - o := &FieldseekerHabitatrelateTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.ForeignID = func() null.Val[uuid.UUID] { return m.ForeignID } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Habitattype = func() null.Val[string] { return m.Habitattype } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerHabitatrelateMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerInspectionsample(mods ...FieldseekerInspectionsampleMod) *FieldseekerInspectionsampleTemplate { - return f.NewFieldseekerInspectionsampleWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerInspectionsampleWithContext(ctx context.Context, mods ...FieldseekerInspectionsampleMod) *FieldseekerInspectionsampleTemplate { - o := &FieldseekerInspectionsampleTemplate{f: f} - - if f != nil { - f.baseFieldseekerInspectionsampleMods.Apply(ctx, o) - } - - FieldseekerInspectionsampleModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerInspectionsample(m *models.FieldseekerInspectionsample) *FieldseekerInspectionsampleTemplate { - o := &FieldseekerInspectionsampleTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.InspID = func() null.Val[uuid.UUID] { return m.InspID } - o.Sampleid = func() null.Val[string] { return m.Sampleid } - o.Processed = func() null.Val[int16] { return m.Processed } - o.Idbytech = func() null.Val[string] { return m.Idbytech } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerInspectionsampleMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerInspectionsampledetail(mods ...FieldseekerInspectionsampledetailMod) *FieldseekerInspectionsampledetailTemplate { - return f.NewFieldseekerInspectionsampledetailWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerInspectionsampledetailWithContext(ctx context.Context, mods ...FieldseekerInspectionsampledetailMod) *FieldseekerInspectionsampledetailTemplate { - o := &FieldseekerInspectionsampledetailTemplate{f: f} - - if f != nil { - f.baseFieldseekerInspectionsampledetailMods.Apply(ctx, o) - } - - FieldseekerInspectionsampledetailModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerInspectionsampledetail(m *models.FieldseekerInspectionsampledetail) *FieldseekerInspectionsampledetailTemplate { - o := &FieldseekerInspectionsampledetailTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.InspsampleID = func() null.Val[uuid.UUID] { return m.InspsampleID } - o.Fieldspecies = func() null.Val[string] { return m.Fieldspecies } - o.Flarvcount = func() null.Val[int16] { return m.Flarvcount } - o.Fpupcount = func() null.Val[int16] { return m.Fpupcount } - o.Feggcount = func() null.Val[int16] { return m.Feggcount } - o.Flstages = func() null.Val[string] { return m.Flstages } - o.Fdomstage = func() null.Val[string] { return m.Fdomstage } - o.Fadultact = func() null.Val[string] { return m.Fadultact } - o.Labspecies = func() null.Val[string] { return m.Labspecies } - o.Llarvcount = func() null.Val[int16] { return m.Llarvcount } - o.Lpupcount = func() null.Val[int16] { return m.Lpupcount } - o.Leggcount = func() null.Val[int16] { return m.Leggcount } - o.Ldomstage = func() null.Val[string] { return m.Ldomstage } - o.Comments = func() null.Val[string] { return m.Comments } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Processed = func() null.Val[int16] { return m.Processed } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerInspectionsampledetailMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerLinelocation(mods ...FieldseekerLinelocationMod) *FieldseekerLinelocationTemplate { - return f.NewFieldseekerLinelocationWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerLinelocationWithContext(ctx context.Context, mods ...FieldseekerLinelocationMod) *FieldseekerLinelocationTemplate { - o := &FieldseekerLinelocationTemplate{f: f} - - if f != nil { - f.baseFieldseekerLinelocationMods.Apply(ctx, o) - } - - FieldseekerLinelocationModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerLinelocation(m *models.FieldseekerLinelocation) *FieldseekerLinelocationTemplate { - o := &FieldseekerLinelocationTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.Name = func() null.Val[string] { return m.Name } - o.Zone = func() null.Val[string] { return m.Zone } - o.Habitat = func() null.Val[string] { return m.Habitat } - o.Priority = func() null.Val[string] { return m.Priority } - o.Usetype = func() null.Val[string] { return m.Usetype } - o.Active = func() null.Val[int16] { return m.Active } - o.Description = func() null.Val[string] { return m.Description } - o.Accessdesc = func() null.Val[string] { return m.Accessdesc } - o.Comments = func() null.Val[string] { return m.Comments } - o.Symbology = func() null.Val[string] { return m.Symbology } - o.Externalid = func() null.Val[string] { return m.Externalid } - o.Acres = func() null.Val[float64] { return m.Acres } - o.Nextactiondatescheduled = func() null.Val[time.Time] { return m.Nextactiondatescheduled } - o.Larvinspectinterval = func() null.Val[int16] { return m.Larvinspectinterval } - o.LengthFT = func() null.Val[float64] { return m.LengthFT } - o.WidthFT = func() null.Val[float64] { return m.WidthFT } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Locationnumber = func() null.Val[int32] { return m.Locationnumber } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Lastinspectdate = func() null.Val[time.Time] { return m.Lastinspectdate } - o.Lastinspectbreeding = func() null.Val[string] { return m.Lastinspectbreeding } - o.Lastinspectavglarvae = func() null.Val[float64] { return m.Lastinspectavglarvae } - o.Lastinspectavgpupae = func() null.Val[float64] { return m.Lastinspectavgpupae } - o.Lastinspectlstages = func() null.Val[string] { return m.Lastinspectlstages } - o.Lastinspectactiontaken = func() null.Val[string] { return m.Lastinspectactiontaken } - o.Lastinspectfieldspecies = func() null.Val[string] { return m.Lastinspectfieldspecies } - o.Lasttreatdate = func() null.Val[time.Time] { 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.Hectares = func() null.Val[float64] { return m.Hectares } - o.Lastinspectactivity = func() null.Val[string] { return m.Lastinspectactivity } - o.Lasttreatactivity = func() null.Val[string] { return m.Lasttreatactivity } - o.LengthMeters = func() null.Val[float64] { return m.LengthMeters } - o.WidthMeters = func() null.Val[float64] { return m.WidthMeters } - o.Lastinspectconditions = func() null.Val[string] { return m.Lastinspectconditions } - o.Waterorigin = func() null.Val[string] { return m.Waterorigin } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } - o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerLinelocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerLocationtracking(mods ...FieldseekerLocationtrackingMod) *FieldseekerLocationtrackingTemplate { - return f.NewFieldseekerLocationtrackingWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerLocationtrackingWithContext(ctx context.Context, mods ...FieldseekerLocationtrackingMod) *FieldseekerLocationtrackingTemplate { - o := &FieldseekerLocationtrackingTemplate{f: f} - - if f != nil { - f.baseFieldseekerLocationtrackingMods.Apply(ctx, o) - } - - FieldseekerLocationtrackingModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerLocationtracking(m *models.FieldseekerLocationtracking) *FieldseekerLocationtrackingTemplate { - o := &FieldseekerLocationtrackingTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.Accuracy = func() null.Val[float64] { return m.Accuracy } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.Fieldtech = func() null.Val[string] { return m.Fieldtech } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerLocationtrackingMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerMosquitoinspection(mods ...FieldseekerMosquitoinspectionMod) *FieldseekerMosquitoinspectionTemplate { - return f.NewFieldseekerMosquitoinspectionWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerMosquitoinspectionWithContext(ctx context.Context, mods ...FieldseekerMosquitoinspectionMod) *FieldseekerMosquitoinspectionTemplate { - o := &FieldseekerMosquitoinspectionTemplate{f: f} - - if f != nil { - f.baseFieldseekerMosquitoinspectionMods.Apply(ctx, o) - } - - FieldseekerMosquitoinspectionModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerMosquitoinspection(m *models.FieldseekerMosquitoinspection) *FieldseekerMosquitoinspectionTemplate { - o := &FieldseekerMosquitoinspectionTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.Numdips = func() null.Val[int16] { return m.Numdips } - o.Activity = func() null.Val[string] { return m.Activity } - o.Breeding = func() null.Val[string] { return m.Breeding } - o.Totlarvae = func() null.Val[int16] { return m.Totlarvae } - o.Totpupae = func() null.Val[int16] { return m.Totpupae } - o.Eggs = func() null.Val[int16] { return m.Eggs } - o.Posdips = func() null.Val[int16] { return m.Posdips } - o.Adultact = func() null.Val[string] { return m.Adultact } - o.Lstages = func() null.Val[string] { return m.Lstages } - o.Domstage = func() null.Val[string] { return m.Domstage } - o.Actiontaken = func() null.Val[string] { return m.Actiontaken } - o.Comments = func() null.Val[string] { return m.Comments } - o.Avetemp = func() null.Val[float64] { return m.Avetemp } - o.Windspeed = func() null.Val[float64] { return m.Windspeed } - o.Raingauge = func() null.Val[float64] { return m.Raingauge } - o.Startdatetime = func() null.Val[time.Time] { return m.Startdatetime } - o.Enddatetime = func() null.Val[time.Time] { return m.Enddatetime } - o.Winddir = func() null.Val[string] { return m.Winddir } - o.Avglarvae = func() null.Val[float64] { return m.Avglarvae } - o.Avgpupae = func() null.Val[float64] { return m.Avgpupae } - o.Reviewed = func() null.Val[int16] { return m.Reviewed } - o.Reviewedby = func() null.Val[string] { return m.Reviewedby } - o.Revieweddate = func() null.Val[time.Time] { return m.Revieweddate } - o.Locationname = func() null.Val[string] { return m.Locationname } - o.Zone = func() null.Val[string] { return m.Zone } - o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Personalcontact = func() null.Val[int16] { return m.Personalcontact } - o.Tirecount = func() null.Val[int16] { return m.Tirecount } - o.Cbcount = func() null.Val[int16] { return m.Cbcount } - o.Containercount = func() null.Val[int16] { return m.Containercount } - o.Fieldspecies = func() null.Val[string] { return m.Fieldspecies } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Linelocid = func() null.Val[uuid.UUID] { return m.Linelocid } - o.Pointlocid = func() null.Val[uuid.UUID] { return m.Pointlocid } - o.Polygonlocid = func() null.Val[uuid.UUID] { return m.Polygonlocid } - o.Srid = func() null.Val[uuid.UUID] { return m.Srid } - o.Fieldtech = func() null.Val[string] { return m.Fieldtech } - o.Larvaepresent = func() null.Val[int16] { return m.Larvaepresent } - o.Pupaepresent = func() null.Val[int16] { return m.Pupaepresent } - o.Sdid = func() null.Val[uuid.UUID] { return m.Sdid } - o.Sitecond = func() null.Val[string] { return m.Sitecond } - o.Positivecontainercount = func() null.Val[int16] { return m.Positivecontainercount } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } - o.Visualmonitoring = func() null.Val[int16] { return m.Visualmonitoring } - o.Vmcomments = func() null.Val[string] { return m.Vmcomments } - o.Adminaction = func() null.Val[string] { return m.Adminaction } - o.Ptaid = func() null.Val[uuid.UUID] { return m.Ptaid } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerMosquitoinspectionMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerPointlocation(mods ...FieldseekerPointlocationMod) *FieldseekerPointlocationTemplate { - return f.NewFieldseekerPointlocationWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerPointlocationWithContext(ctx context.Context, mods ...FieldseekerPointlocationMod) *FieldseekerPointlocationTemplate { - o := &FieldseekerPointlocationTemplate{f: f} - - if f != nil { - f.baseFieldseekerPointlocationMods.Apply(ctx, o) - } - - FieldseekerPointlocationModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerPointlocation(m *models.FieldseekerPointlocation) *FieldseekerPointlocationTemplate { - o := &FieldseekerPointlocationTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.Name = func() null.Val[string] { return m.Name } - o.Zone = func() null.Val[string] { return m.Zone } - o.Habitat = func() null.Val[string] { return m.Habitat } - o.Priority = func() null.Val[string] { return m.Priority } - o.Usetype = func() null.Val[string] { return m.Usetype } - o.Active = func() null.Val[int16] { return m.Active } - o.Description = func() null.Val[string] { return m.Description } - o.Accessdesc = func() null.Val[string] { return m.Accessdesc } - o.Comments = func() null.Val[string] { return m.Comments } - o.Symbology = func() null.Val[string] { return m.Symbology } - o.Externalid = func() null.Val[string] { return m.Externalid } - o.Nextactiondatescheduled = func() null.Val[time.Time] { return m.Nextactiondatescheduled } - o.Larvinspectinterval = func() null.Val[int16] { return m.Larvinspectinterval } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Locationnumber = func() null.Val[int32] { return m.Locationnumber } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.Stype = func() null.Val[string] { return m.Stype } - o.Lastinspectdate = func() null.Val[time.Time] { return m.Lastinspectdate } - o.Lastinspectbreeding = func() null.Val[string] { return m.Lastinspectbreeding } - o.Lastinspectavglarvae = func() null.Val[float64] { return m.Lastinspectavglarvae } - o.Lastinspectavgpupae = func() null.Val[float64] { return m.Lastinspectavgpupae } - o.Lastinspectlstages = func() null.Val[string] { return m.Lastinspectlstages } - o.Lastinspectactiontaken = func() null.Val[string] { return m.Lastinspectactiontaken } - o.Lastinspectfieldspecies = func() null.Val[string] { return m.Lastinspectfieldspecies } - o.Lasttreatdate = func() null.Val[time.Time] { 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.Lastinspectactivity = func() null.Val[string] { return m.Lastinspectactivity } - o.Lasttreatactivity = func() null.Val[string] { return m.Lasttreatactivity } - o.Lastinspectconditions = func() null.Val[string] { return m.Lastinspectconditions } - 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.Assignedtech = func() null.Val[string] { return m.Assignedtech } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } - o.DeactivateReason = func() null.Val[string] { return m.DeactivateReason } - o.Scalarpriority = func() null.Val[int32] { return m.Scalarpriority } - o.Sourcestatus = func() null.Val[string] { return m.Sourcestatus } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - o.H3cell = func() null.Val[string] { return m.H3cell } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerPointlocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerPolygonlocation(mods ...FieldseekerPolygonlocationMod) *FieldseekerPolygonlocationTemplate { - return f.NewFieldseekerPolygonlocationWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerPolygonlocationWithContext(ctx context.Context, mods ...FieldseekerPolygonlocationMod) *FieldseekerPolygonlocationTemplate { - o := &FieldseekerPolygonlocationTemplate{f: f} - - if f != nil { - f.baseFieldseekerPolygonlocationMods.Apply(ctx, o) - } - - FieldseekerPolygonlocationModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerPolygonlocation(m *models.FieldseekerPolygonlocation) *FieldseekerPolygonlocationTemplate { - o := &FieldseekerPolygonlocationTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.Name = func() null.Val[string] { return m.Name } - o.Zone = func() null.Val[string] { return m.Zone } - o.Habitat = func() null.Val[string] { return m.Habitat } - o.Priority = func() null.Val[string] { return m.Priority } - o.Usetype = func() null.Val[string] { return m.Usetype } - o.Active = func() null.Val[int16] { return m.Active } - o.Description = func() null.Val[string] { return m.Description } - o.Accessdesc = func() null.Val[string] { return m.Accessdesc } - o.Comments = func() null.Val[string] { return m.Comments } - o.Symbology = func() null.Val[string] { return m.Symbology } - o.Externalid = func() null.Val[string] { return m.Externalid } - o.Acres = func() null.Val[float64] { return m.Acres } - o.Nextactiondatescheduled = func() null.Val[time.Time] { return m.Nextactiondatescheduled } - o.Larvinspectinterval = func() null.Val[int16] { return m.Larvinspectinterval } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Locationnumber = func() null.Val[int32] { return m.Locationnumber } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.Lastinspectdate = func() null.Val[time.Time] { return m.Lastinspectdate } - o.Lastinspectbreeding = func() null.Val[string] { return m.Lastinspectbreeding } - o.Lastinspectavglarvae = func() null.Val[float64] { return m.Lastinspectavglarvae } - o.Lastinspectavgpupae = func() null.Val[float64] { return m.Lastinspectavgpupae } - o.Lastinspectlstages = func() null.Val[string] { return m.Lastinspectlstages } - o.Lastinspectactiontaken = func() null.Val[string] { return m.Lastinspectactiontaken } - o.Lastinspectfieldspecies = func() null.Val[string] { return m.Lastinspectfieldspecies } - o.Lasttreatdate = func() null.Val[time.Time] { 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.Hectares = func() null.Val[float64] { return m.Hectares } - o.Lastinspectactivity = func() null.Val[string] { return m.Lastinspectactivity } - o.Lasttreatactivity = func() null.Val[string] { return m.Lasttreatactivity } - o.Lastinspectconditions = func() null.Val[string] { return m.Lastinspectconditions } - o.Waterorigin = func() null.Val[string] { return m.Waterorigin } - o.Filter = func() null.Val[string] { return m.Filter } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } - o.ShapeArea = func() null.Val[float64] { return m.ShapeArea } - o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerPolygonlocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerPool(mods ...FieldseekerPoolMod) *FieldseekerPoolTemplate { - return f.NewFieldseekerPoolWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerPoolWithContext(ctx context.Context, mods ...FieldseekerPoolMod) *FieldseekerPoolTemplate { - o := &FieldseekerPoolTemplate{f: f} - - if f != nil { - f.baseFieldseekerPoolMods.Apply(ctx, o) - } - - FieldseekerPoolModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerPool(m *models.FieldseekerPool) *FieldseekerPoolTemplate { - o := &FieldseekerPoolTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.TrapdataID = func() null.Val[uuid.UUID] { return m.TrapdataID } - o.Datesent = func() null.Val[time.Time] { return m.Datesent } - o.Survtech = func() null.Val[string] { return m.Survtech } - o.Datetested = func() null.Val[time.Time] { return m.Datetested } - o.Testtech = func() null.Val[string] { return m.Testtech } - o.Comments = func() null.Val[string] { return m.Comments } - o.Sampleid = func() null.Val[string] { return m.Sampleid } - o.Processed = func() null.Val[int16] { return m.Processed } - o.LabID = func() null.Val[uuid.UUID] { return m.LabID } - o.Testmethod = func() null.Val[string] { return m.Testmethod } - o.Diseasetested = func() null.Val[string] { return m.Diseasetested } - o.Diseasepos = func() null.Val[string] { return m.Diseasepos } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Lab = func() null.Val[string] { return m.Lab } - o.Poolyear = func() null.Val[int16] { return m.Poolyear } - o.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync } - 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.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerPoolMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerPooldetail(mods ...FieldseekerPooldetailMod) *FieldseekerPooldetailTemplate { - return f.NewFieldseekerPooldetailWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerPooldetailWithContext(ctx context.Context, mods ...FieldseekerPooldetailMod) *FieldseekerPooldetailTemplate { - o := &FieldseekerPooldetailTemplate{f: f} - - if f != nil { - f.baseFieldseekerPooldetailMods.Apply(ctx, o) - } - - FieldseekerPooldetailModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerPooldetail(m *models.FieldseekerPooldetail) *FieldseekerPooldetailTemplate { - o := &FieldseekerPooldetailTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.TrapdataID = func() null.Val[uuid.UUID] { return m.TrapdataID } - o.PoolID = func() null.Val[uuid.UUID] { return m.PoolID } - o.Species = func() null.Val[string] { return m.Species } - o.Females = func() null.Val[int16] { return m.Females } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerPooldetailMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerProposedtreatmentarea(mods ...FieldseekerProposedtreatmentareaMod) *FieldseekerProposedtreatmentareaTemplate { - return f.NewFieldseekerProposedtreatmentareaWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerProposedtreatmentareaWithContext(ctx context.Context, mods ...FieldseekerProposedtreatmentareaMod) *FieldseekerProposedtreatmentareaTemplate { - o := &FieldseekerProposedtreatmentareaTemplate{f: f} - - if f != nil { - f.baseFieldseekerProposedtreatmentareaMods.Apply(ctx, o) - } - - FieldseekerProposedtreatmentareaModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerProposedtreatmentarea(m *models.FieldseekerProposedtreatmentarea) *FieldseekerProposedtreatmentareaTemplate { - o := &FieldseekerProposedtreatmentareaTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.Method = func() null.Val[string] { return m.Method } - o.Comments = func() null.Val[string] { return m.Comments } - o.Zone = func() null.Val[string] { return m.Zone } - o.Reviewed = func() null.Val[int16] { return m.Reviewed } - o.Reviewedby = func() null.Val[string] { return m.Reviewedby } - o.Revieweddate = func() null.Val[time.Time] { return m.Revieweddate } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Completeddate = func() null.Val[time.Time] { return m.Completeddate } - o.Completedby = func() null.Val[string] { return m.Completedby } - o.Completed = func() null.Val[int16] { return m.Completed } - o.Issprayroute = func() null.Val[int16] { return m.Issprayroute } - o.Name = func() null.Val[string] { return m.Name } - o.Acres = func() null.Val[float64] { return m.Acres } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.Exported = func() null.Val[int16] { return m.Exported } - o.Targetproduct = func() null.Val[string] { return m.Targetproduct } - o.Targetapprate = func() null.Val[float64] { return m.Targetapprate } - o.Hectares = func() null.Val[float64] { return m.Hectares } - o.Lasttreatactivity = func() null.Val[string] { return m.Lasttreatactivity } - o.Lasttreatdate = func() null.Val[time.Time] { 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.Priority = func() null.Val[string] { return m.Priority } - o.Duedate = func() null.Val[time.Time] { return m.Duedate } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Targetspecies = func() null.Val[string] { return m.Targetspecies } - o.ShapeArea = func() null.Val[float64] { return m.ShapeArea } - o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerProposedtreatmentareaMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerQamosquitoinspection(mods ...FieldseekerQamosquitoinspectionMod) *FieldseekerQamosquitoinspectionTemplate { - return f.NewFieldseekerQamosquitoinspectionWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerQamosquitoinspectionWithContext(ctx context.Context, mods ...FieldseekerQamosquitoinspectionMod) *FieldseekerQamosquitoinspectionTemplate { - o := &FieldseekerQamosquitoinspectionTemplate{f: f} - - if f != nil { - f.baseFieldseekerQamosquitoinspectionMods.Apply(ctx, o) - } - - FieldseekerQamosquitoinspectionModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerQamosquitoinspection(m *models.FieldseekerQamosquitoinspection) *FieldseekerQamosquitoinspectionTemplate { - o := &FieldseekerQamosquitoinspectionTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.Posdips = func() null.Val[int16] { return m.Posdips } - o.Actiontaken = func() null.Val[string] { return m.Actiontaken } - o.Comments = func() null.Val[string] { return m.Comments } - o.Avetemp = func() null.Val[float64] { return m.Avetemp } - o.Windspeed = func() null.Val[float64] { return m.Windspeed } - o.Raingauge = func() null.Val[float64] { return m.Raingauge } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.Startdatetime = func() null.Val[time.Time] { return m.Startdatetime } - o.Enddatetime = func() null.Val[time.Time] { return m.Enddatetime } - o.Winddir = func() null.Val[string] { return m.Winddir } - o.Reviewed = func() null.Val[int16] { return m.Reviewed } - o.Reviewedby = func() null.Val[string] { return m.Reviewedby } - o.Revieweddate = func() null.Val[time.Time] { return m.Revieweddate } - o.Locationname = func() null.Val[string] { return m.Locationname } - o.Zone = func() null.Val[string] { return m.Zone } - o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.LR = func() null.Val[int16] { return m.LR } - o.Negdips = func() null.Val[int16] { return m.Negdips } - o.Totalacres = func() null.Val[float64] { return m.Totalacres } - o.Acresbreeding = func() null.Val[float64] { return m.Acresbreeding } - o.Fish = func() null.Val[int16] { return m.Fish } - o.Sitetype = func() null.Val[string] { return m.Sitetype } - o.Breedingpotential = func() null.Val[string] { return m.Breedingpotential } - o.Movingwater = func() null.Val[int16] { return m.Movingwater } - o.Nowaterever = func() null.Val[int16] { return m.Nowaterever } - o.Mosquitohabitat = func() null.Val[string] { return m.Mosquitohabitat } - 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.Potential = func() null.Val[int16] { return m.Potential } - o.Larvaepresent = func() null.Val[int16] { return m.Larvaepresent } - o.Larvaeinsidetreatedarea = func() null.Val[int16] { return m.Larvaeinsidetreatedarea } - o.Larvaeoutsidetreatedarea = func() null.Val[int16] { return m.Larvaeoutsidetreatedarea } - o.Larvaereason = func() null.Val[string] { return m.Larvaereason } - o.Aquaticorganisms = func() null.Val[string] { return m.Aquaticorganisms } - o.Vegetation = func() null.Val[string] { return m.Vegetation } - o.Sourcereduction = func() null.Val[string] { return m.Sourcereduction } - o.Waterpresent = func() null.Val[int16] { return m.Waterpresent } - 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.Soilconditions = func() null.Val[string] { return m.Soilconditions } - o.Waterduration = func() null.Val[string] { return m.Waterduration } - o.Watersource = func() null.Val[string] { return m.Watersource } - o.Waterconditions = func() null.Val[string] { return m.Waterconditions } - o.Adultactivity = func() null.Val[int16] { return m.Adultactivity } - o.Linelocid = func() null.Val[uuid.UUID] { return m.Linelocid } - o.Pointlocid = func() null.Val[uuid.UUID] { return m.Pointlocid } - o.Polygonlocid = func() null.Val[uuid.UUID] { return m.Polygonlocid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Fieldtech = func() null.Val[string] { return m.Fieldtech } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerQamosquitoinspectionMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerRodentlocation(mods ...FieldseekerRodentlocationMod) *FieldseekerRodentlocationTemplate { - return f.NewFieldseekerRodentlocationWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerRodentlocationWithContext(ctx context.Context, mods ...FieldseekerRodentlocationMod) *FieldseekerRodentlocationTemplate { - o := &FieldseekerRodentlocationTemplate{f: f} - - if f != nil { - f.baseFieldseekerRodentlocationMods.Apply(ctx, o) - } - - FieldseekerRodentlocationModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerRodentlocation(m *models.FieldseekerRodentlocation) *FieldseekerRodentlocationTemplate { - o := &FieldseekerRodentlocationTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.Locationname = func() null.Val[string] { return m.Locationname } - o.Zone = func() null.Val[string] { return m.Zone } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Habitat = func() null.Val[string] { return m.Habitat } - o.Priority = func() null.Val[string] { return m.Priority } - o.Usetype = func() null.Val[string] { return m.Usetype } - o.Active = func() null.Val[int16] { return m.Active } - o.Description = func() null.Val[string] { return m.Description } - o.Accessdesc = func() null.Val[string] { return m.Accessdesc } - o.Comments = func() null.Val[string] { return m.Comments } - o.Symbology = func() null.Val[string] { return m.Symbology } - o.Externalid = func() null.Val[string] { return m.Externalid } - o.Nextactiondatescheduled = func() null.Val[time.Time] { return m.Nextactiondatescheduled } - o.Locationnumber = func() null.Val[int32] { return m.Locationnumber } - o.Lastinspectdate = func() null.Val[time.Time] { return m.Lastinspectdate } - o.Lastinspectspecies = func() null.Val[string] { return m.Lastinspectspecies } - o.Lastinspectaction = func() null.Val[string] { return m.Lastinspectaction } - o.Lastinspectconditions = func() null.Val[string] { return m.Lastinspectconditions } - o.Lastinspectrodentevidence = func() null.Val[string] { return m.Lastinspectrodentevidence } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerRodentlocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerSamplecollection(mods ...FieldseekerSamplecollectionMod) *FieldseekerSamplecollectionTemplate { - return f.NewFieldseekerSamplecollectionWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerSamplecollectionWithContext(ctx context.Context, mods ...FieldseekerSamplecollectionMod) *FieldseekerSamplecollectionTemplate { - o := &FieldseekerSamplecollectionTemplate{f: f} - - if f != nil { - f.baseFieldseekerSamplecollectionMods.Apply(ctx, o) - } - - FieldseekerSamplecollectionModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerSamplecollection(m *models.FieldseekerSamplecollection) *FieldseekerSamplecollectionTemplate { - o := &FieldseekerSamplecollectionTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.LocID = func() null.Val[uuid.UUID] { return m.LocID } - o.Startdatetime = func() null.Val[time.Time] { return m.Startdatetime } - o.Enddatetime = func() null.Val[time.Time] { return m.Enddatetime } - o.Sitecond = func() null.Val[string] { return m.Sitecond } - o.Sampleid = func() null.Val[string] { return m.Sampleid } - o.Survtech = func() null.Val[string] { return m.Survtech } - o.Datesent = func() null.Val[time.Time] { return m.Datesent } - o.Datetested = func() null.Val[time.Time] { return m.Datetested } - o.Testtech = func() null.Val[string] { return m.Testtech } - o.Comments = func() null.Val[string] { return m.Comments } - o.Processed = func() null.Val[int16] { return m.Processed } - o.Sampletype = func() null.Val[string] { return m.Sampletype } - o.Samplecond = func() null.Val[string] { return m.Samplecond } - o.Species = func() null.Val[string] { return m.Species } - o.Sex = func() null.Val[string] { return m.Sex } - o.Avetemp = func() null.Val[float64] { return m.Avetemp } - o.Windspeed = func() null.Val[float64] { return m.Windspeed } - o.Winddir = func() null.Val[string] { return m.Winddir } - o.Raingauge = func() null.Val[float64] { return m.Raingauge } - o.Activity = func() null.Val[string] { return m.Activity } - o.Testmethod = func() null.Val[string] { return m.Testmethod } - o.Diseasetested = func() null.Val[string] { return m.Diseasetested } - o.Diseasepos = func() null.Val[string] { return m.Diseasepos } - o.Reviewed = func() null.Val[int16] { return m.Reviewed } - o.Reviewedby = func() null.Val[string] { return m.Reviewedby } - o.Revieweddate = func() null.Val[time.Time] { return m.Revieweddate } - o.Locationname = func() null.Val[string] { return m.Locationname } - o.Zone = func() null.Val[string] { return m.Zone } - o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Lab = func() null.Val[string] { return m.Lab } - o.Fieldtech = func() null.Val[string] { return m.Fieldtech } - o.Flockid = func() null.Val[uuid.UUID] { return m.Flockid } - o.Samplecount = func() null.Val[int16] { return m.Samplecount } - o.Chickenid = func() null.Val[uuid.UUID] { return m.Chickenid } - o.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerSamplecollectionMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerSamplelocation(mods ...FieldseekerSamplelocationMod) *FieldseekerSamplelocationTemplate { - return f.NewFieldseekerSamplelocationWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerSamplelocationWithContext(ctx context.Context, mods ...FieldseekerSamplelocationMod) *FieldseekerSamplelocationTemplate { - o := &FieldseekerSamplelocationTemplate{f: f} - - if f != nil { - f.baseFieldseekerSamplelocationMods.Apply(ctx, o) - } - - FieldseekerSamplelocationModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerSamplelocation(m *models.FieldseekerSamplelocation) *FieldseekerSamplelocationTemplate { - o := &FieldseekerSamplelocationTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.Name = func() null.Val[string] { return m.Name } - o.Zone = func() null.Val[string] { return m.Zone } - o.Habitat = func() null.Val[string] { return m.Habitat } - o.Priority = func() null.Val[string] { return m.Priority } - o.Usetype = func() null.Val[string] { return m.Usetype } - o.Active = func() null.Val[int16] { return m.Active } - o.Description = func() null.Val[string] { return m.Description } - o.Accessdesc = func() null.Val[string] { return m.Accessdesc } - o.Comments = func() null.Val[string] { return m.Comments } - o.Externalid = func() null.Val[string] { return m.Externalid } - o.Nextactiondatescheduled = func() null.Val[time.Time] { return m.Nextactiondatescheduled } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Locationnumber = func() null.Val[int32] { return m.Locationnumber } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerSamplelocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerServicerequest(mods ...FieldseekerServicerequestMod) *FieldseekerServicerequestTemplate { - return f.NewFieldseekerServicerequestWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerServicerequestWithContext(ctx context.Context, mods ...FieldseekerServicerequestMod) *FieldseekerServicerequestTemplate { - o := &FieldseekerServicerequestTemplate{f: f} - - if f != nil { - f.baseFieldseekerServicerequestMods.Apply(ctx, o) - } - - FieldseekerServicerequestModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerServicerequest(m *models.FieldseekerServicerequest) *FieldseekerServicerequestTemplate { - o := &FieldseekerServicerequestTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.Recdatetime = func() null.Val[time.Time] { return m.Recdatetime } - o.Source = func() null.Val[string] { return m.Source } - o.Entrytech = func() null.Val[string] { return m.Entrytech } - o.Priority = func() null.Val[string] { return m.Priority } - o.Supervisor = func() null.Val[string] { return m.Supervisor } - o.Assignedtech = func() null.Val[string] { return m.Assignedtech } - o.Status = func() null.Val[string] { return m.Status } - o.Clranon = func() null.Val[int16] { return m.Clranon } - o.Clrfname = func() null.Val[string] { return m.Clrfname } - o.Clrphone1 = func() null.Val[string] { return m.Clrphone1 } - o.Clrphone2 = func() null.Val[string] { return m.Clrphone2 } - o.Clremail = func() null.Val[string] { return m.Clremail } - o.Clrcompany = func() null.Val[string] { return m.Clrcompany } - o.Clraddr1 = func() null.Val[string] { return m.Clraddr1 } - o.Clraddr2 = func() null.Val[string] { return m.Clraddr2 } - o.Clrcity = func() null.Val[string] { return m.Clrcity } - o.Clrstate = func() null.Val[string] { return m.Clrstate } - o.Clrzip = func() null.Val[string] { return m.Clrzip } - o.Clrother = func() null.Val[string] { return m.Clrother } - o.Clrcontpref = func() null.Val[string] { return m.Clrcontpref } - o.Reqcompany = func() null.Val[string] { return m.Reqcompany } - 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.Reqstate = func() null.Val[string] { return m.Reqstate } - o.Reqzip = func() null.Val[string] { return m.Reqzip } - o.Reqcrossst = func() null.Val[string] { return m.Reqcrossst } - o.Reqsubdiv = func() null.Val[string] { return m.Reqsubdiv } - o.Reqmapgrid = func() null.Val[string] { return m.Reqmapgrid } - o.Reqpermission = func() null.Val[int16] { return m.Reqpermission } - o.Reqtarget = func() null.Val[string] { return m.Reqtarget } - o.Reqdescr = func() null.Val[string] { return m.Reqdescr } - o.Reqnotesfortech = func() null.Val[string] { return m.Reqnotesfortech } - o.Reqnotesforcust = func() null.Val[string] { return m.Reqnotesforcust } - o.Reqfldnotes = func() null.Val[string] { return m.Reqfldnotes } - o.Reqprogramactions = func() null.Val[string] { return m.Reqprogramactions } - o.Datetimeclosed = func() null.Val[time.Time] { return m.Datetimeclosed } - o.Techclosed = func() null.Val[string] { return m.Techclosed } - o.SRNumber = func() null.Val[int32] { return m.SRNumber } - o.Reviewed = func() null.Val[int16] { return m.Reviewed } - o.Reviewedby = func() null.Val[string] { return m.Reviewedby } - o.Revieweddate = func() null.Val[time.Time] { return m.Revieweddate } - o.Accepted = func() null.Val[int16] { return m.Accepted } - o.Accepteddate = func() null.Val[time.Time] { return m.Accepteddate } - o.Rejectedby = func() null.Val[string] { return m.Rejectedby } - o.Rejecteddate = func() null.Val[time.Time] { return m.Rejecteddate } - o.Rejectedreason = func() null.Val[string] { return m.Rejectedreason } - o.Duedate = func() null.Val[time.Time] { return m.Duedate } - o.Acceptedby = func() null.Val[string] { return m.Acceptedby } - o.Comments = func() null.Val[string] { return m.Comments } - o.Estcompletedate = func() null.Val[time.Time] { return m.Estcompletedate } - o.Nextaction = func() null.Val[string] { return m.Nextaction } - o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Firstresponsedate = func() null.Val[time.Time] { return m.Firstresponsedate } - o.Responsedaycount = func() null.Val[int16] { return m.Responsedaycount } - o.Allowed = func() null.Val[string] { return m.Allowed } - o.Xvalue = func() null.Val[string] { return m.Xvalue } - o.Yvalue = func() null.Val[string] { return m.Yvalue } - o.Validx = func() null.Val[string] { return m.Validx } - o.Validy = func() null.Val[string] { return m.Validy } - o.Externalid = func() null.Val[string] { return m.Externalid } - o.Externalerror = func() null.Val[string] { return m.Externalerror } - o.Pointlocid = func() null.Val[uuid.UUID] { return m.Pointlocid } - o.Notified = func() null.Val[int16] { return m.Notified } - o.Notifieddate = func() null.Val[time.Time] { return m.Notifieddate } - o.Scheduled = func() null.Val[int16] { return m.Scheduled } - o.Scheduleddate = func() null.Val[time.Time] { return m.Scheduleddate } - o.Dog = func() null.Val[int32] { return m.Dog } - o.SchedulePeriod = func() null.Val[string] { return m.SchedulePeriod } - o.ScheduleNotes = func() null.Val[string] { return m.ScheduleNotes } - o.Spanish = func() null.Val[int32] { return m.Spanish } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Issuesreported = func() null.Val[string] { return m.Issuesreported } - o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } - o.Notificationtimestamp = func() null.Val[string] { return m.Notificationtimestamp } - o.Zone = func() null.Val[string] { return m.Zone } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - o.H3cell = func() null.Val[string] { return m.H3cell } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerServicerequestMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerSpeciesabundance(mods ...FieldseekerSpeciesabundanceMod) *FieldseekerSpeciesabundanceTemplate { - return f.NewFieldseekerSpeciesabundanceWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerSpeciesabundanceWithContext(ctx context.Context, mods ...FieldseekerSpeciesabundanceMod) *FieldseekerSpeciesabundanceTemplate { - o := &FieldseekerSpeciesabundanceTemplate{f: f} - - if f != nil { - f.baseFieldseekerSpeciesabundanceMods.Apply(ctx, o) - } - - FieldseekerSpeciesabundanceModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerSpeciesabundance(m *models.FieldseekerSpeciesabundance) *FieldseekerSpeciesabundanceTemplate { - o := &FieldseekerSpeciesabundanceTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.TrapdataID = func() null.Val[uuid.UUID] { return m.TrapdataID } - o.Species = func() null.Val[string] { return m.Species } - o.Males = func() null.Val[int16] { return m.Males } - o.Unknown = func() null.Val[int16] { return m.Unknown } - o.Bloodedfem = func() null.Val[int16] { return m.Bloodedfem } - o.Gravidfem = func() null.Val[int16] { return m.Gravidfem } - o.Larvae = func() null.Val[int16] { return m.Larvae } - o.Poolstogen = func() null.Val[int16] { return m.Poolstogen } - o.Processed = func() null.Val[int16] { return m.Processed } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Pupae = func() null.Val[int16] { return m.Pupae } - o.Eggs = func() null.Val[int16] { return m.Eggs } - o.Females = func() null.Val[int32] { return m.Females } - o.Total = func() null.Val[int32] { return m.Total } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Yearweek = func() null.Val[int32] { return m.Yearweek } - o.Globalzscore = func() null.Val[float64] { return m.Globalzscore } - o.R7score = func() null.Val[float64] { return m.R7score } - o.R8score = func() null.Val[float64] { return m.R8score } - o.H3R7 = func() null.Val[string] { return m.H3R7 } - o.H3R8 = func() null.Val[string] { return m.H3R8 } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerSpeciesabundanceMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerStormdrain(mods ...FieldseekerStormdrainMod) *FieldseekerStormdrainTemplate { - return f.NewFieldseekerStormdrainWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerStormdrainWithContext(ctx context.Context, mods ...FieldseekerStormdrainMod) *FieldseekerStormdrainTemplate { - o := &FieldseekerStormdrainTemplate{f: f} - - if f != nil { - f.baseFieldseekerStormdrainMods.Apply(ctx, o) - } - - FieldseekerStormdrainModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerStormdrain(m *models.FieldseekerStormdrain) *FieldseekerStormdrainTemplate { - o := &FieldseekerStormdrainTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.Nexttreatmentdate = func() null.Val[time.Time] { return m.Nexttreatmentdate } - o.Lasttreatdate = func() null.Val[time.Time] { return m.Lasttreatdate } - o.Lastaction = func() null.Val[string] { return m.Lastaction } - o.Symbology = func() null.Val[string] { return m.Symbology } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Laststatus = func() null.Val[string] { return m.Laststatus } - o.Zone = func() null.Val[string] { return m.Zone } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Type = func() null.Val[string] { return m.Type } - o.Jurisdiction = func() null.Val[string] { return m.Jurisdiction } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerStormdrainMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerTimecard(mods ...FieldseekerTimecardMod) *FieldseekerTimecardTemplate { - return f.NewFieldseekerTimecardWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerTimecardWithContext(ctx context.Context, mods ...FieldseekerTimecardMod) *FieldseekerTimecardTemplate { - o := &FieldseekerTimecardTemplate{f: f} - - if f != nil { - f.baseFieldseekerTimecardMods.Apply(ctx, o) - } - - FieldseekerTimecardModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerTimecard(m *models.FieldseekerTimecard) *FieldseekerTimecardTemplate { - o := &FieldseekerTimecardTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.Activity = func() null.Val[string] { return m.Activity } - o.Startdatetime = func() null.Val[time.Time] { return m.Startdatetime } - o.Enddatetime = func() null.Val[time.Time] { return m.Enddatetime } - o.Comments = func() null.Val[string] { return m.Comments } - o.Externalid = func() null.Val[string] { return m.Externalid } - o.Equiptype = func() null.Val[string] { return m.Equiptype } - o.Locationname = func() null.Val[string] { return m.Locationname } - o.Zone = func() null.Val[string] { return m.Zone } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Linelocid = func() null.Val[uuid.UUID] { return m.Linelocid } - o.Pointlocid = func() null.Val[uuid.UUID] { return m.Pointlocid } - o.Polygonlocid = func() null.Val[uuid.UUID] { return m.Polygonlocid } - o.Lclocid = func() null.Val[uuid.UUID] { return m.Lclocid } - o.Samplelocid = func() null.Val[uuid.UUID] { return m.Samplelocid } - o.Srid = func() null.Val[uuid.UUID] { return m.Srid } - o.Traplocid = func() null.Val[uuid.UUID] { return m.Traplocid } - o.Fieldtech = func() null.Val[string] { return m.Fieldtech } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Rodentlocid = func() null.Val[uuid.UUID] { return m.Rodentlocid } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerTimecardMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerTrapdatum(mods ...FieldseekerTrapdatumMod) *FieldseekerTrapdatumTemplate { - return f.NewFieldseekerTrapdatumWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerTrapdatumWithContext(ctx context.Context, mods ...FieldseekerTrapdatumMod) *FieldseekerTrapdatumTemplate { - o := &FieldseekerTrapdatumTemplate{f: f} - - if f != nil { - f.baseFieldseekerTrapdatumMods.Apply(ctx, o) - } - - FieldseekerTrapdatumModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerTrapdatum(m *models.FieldseekerTrapdatum) *FieldseekerTrapdatumTemplate { - o := &FieldseekerTrapdatumTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.Traptype = func() null.Val[string] { return m.Traptype } - o.Trapactivitytype = func() null.Val[string] { return m.Trapactivitytype } - o.Startdatetime = func() null.Val[time.Time] { return m.Startdatetime } - o.Enddatetime = func() null.Val[time.Time] { return m.Enddatetime } - o.Comments = func() null.Val[string] { return m.Comments } - o.Idbytech = func() null.Val[string] { return m.Idbytech } - o.Sortbytech = func() null.Val[string] { return m.Sortbytech } - o.Processed = func() null.Val[int16] { return m.Processed } - o.Sitecond = func() null.Val[string] { return m.Sitecond } - o.Locationname = func() null.Val[string] { return m.Locationname } - 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[time.Time] { return m.Revieweddate } - o.Trapcondition = func() null.Val[string] { return m.Trapcondition } - o.Trapnights = func() null.Val[int16] { return m.Trapnights } - o.Zone = func() null.Val[string] { return m.Zone } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Srid = func() null.Val[uuid.UUID] { return m.Srid } - o.Fieldtech = func() null.Val[string] { return m.Fieldtech } - o.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync } - o.LocID = func() null.Val[uuid.UUID] { return m.LocID } - 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.Avetemp = func() null.Val[float64] { return m.Avetemp } - o.Raingauge = func() null.Val[float64] { return m.Raingauge } - o.LR = func() null.Val[int16] { return m.LR } - o.Field = func() null.Val[int32] { return m.Field } - o.Vectorsurvtrapdataid = func() null.Val[string] { return m.Vectorsurvtrapdataid } - o.Vectorsurvtraplocationid = func() null.Val[string] { return m.Vectorsurvtraplocationid } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Lure = func() null.Val[string] { return m.Lure } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - o.H3cell = func() null.Val[string] { return m.H3cell } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerTrapdatumMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerTraplocation(mods ...FieldseekerTraplocationMod) *FieldseekerTraplocationTemplate { - return f.NewFieldseekerTraplocationWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerTraplocationWithContext(ctx context.Context, mods ...FieldseekerTraplocationMod) *FieldseekerTraplocationTemplate { - o := &FieldseekerTraplocationTemplate{f: f} - - if f != nil { - f.baseFieldseekerTraplocationMods.Apply(ctx, o) - } - - FieldseekerTraplocationModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerTraplocation(m *models.FieldseekerTraplocation) *FieldseekerTraplocationTemplate { - o := &FieldseekerTraplocationTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.Name = func() null.Val[string] { return m.Name } - o.Zone = func() null.Val[string] { return m.Zone } - o.Habitat = func() null.Val[string] { return m.Habitat } - o.Priority = func() null.Val[string] { return m.Priority } - o.Usetype = func() null.Val[string] { return m.Usetype } - o.Active = func() null.Val[int16] { return m.Active } - o.Description = func() null.Val[string] { return m.Description } - o.Accessdesc = func() null.Val[string] { return m.Accessdesc } - o.Comments = func() null.Val[string] { return m.Comments } - o.Externalid = func() null.Val[string] { return m.Externalid } - o.Nextactiondatescheduled = func() null.Val[time.Time] { return m.Nextactiondatescheduled } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Locationnumber = func() null.Val[int32] { return m.Locationnumber } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Gatewaysync = func() null.Val[int16] { return m.Gatewaysync } - o.Route = func() null.Val[int32] { return m.Route } - o.SetDow = func() null.Val[int32] { return m.SetDow } - o.RouteOrder = func() null.Val[int32] { return m.RouteOrder } - o.Vectorsurvsiteid = func() null.Val[string] { return m.Vectorsurvsiteid } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.H3R7 = func() null.Val[string] { return m.H3R7 } - o.H3R8 = func() null.Val[string] { return m.H3R8 } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - o.H3cell = func() null.Val[string] { return m.H3cell } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerTraplocationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerTreatment(mods ...FieldseekerTreatmentMod) *FieldseekerTreatmentTemplate { - return f.NewFieldseekerTreatmentWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerTreatmentWithContext(ctx context.Context, mods ...FieldseekerTreatmentMod) *FieldseekerTreatmentTemplate { - o := &FieldseekerTreatmentTemplate{f: f} - - if f != nil { - f.baseFieldseekerTreatmentMods.Apply(ctx, o) - } - - FieldseekerTreatmentModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerTreatment(m *models.FieldseekerTreatment) *FieldseekerTreatmentTemplate { - o := &FieldseekerTreatmentTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.Activity = func() null.Val[string] { return m.Activity } - o.Treatarea = func() null.Val[float64] { return m.Treatarea } - o.Areaunit = func() null.Val[string] { return m.Areaunit } - o.Product = func() null.Val[string] { return m.Product } - o.Qty = func() null.Val[float64] { return m.Qty } - o.Qtyunit = func() null.Val[string] { return m.Qtyunit } - o.Method = func() null.Val[string] { return m.Method } - o.Equiptype = func() null.Val[string] { return m.Equiptype } - o.Comments = func() null.Val[string] { return m.Comments } - o.Avetemp = func() null.Val[float64] { return m.Avetemp } - o.Windspeed = func() null.Val[float64] { return m.Windspeed } - o.Winddir = func() null.Val[string] { return m.Winddir } - o.Raingauge = func() null.Val[float64] { return m.Raingauge } - o.Startdatetime = func() null.Val[time.Time] { return m.Startdatetime } - o.Enddatetime = func() null.Val[time.Time] { return m.Enddatetime } - o.InspID = func() null.Val[uuid.UUID] { return m.InspID } - o.Reviewed = func() null.Val[int16] { return m.Reviewed } - o.Reviewedby = func() null.Val[string] { return m.Reviewedby } - o.Revieweddate = func() null.Val[time.Time] { return m.Revieweddate } - o.Locationname = func() null.Val[string] { return m.Locationname } - o.Zone = func() null.Val[string] { return m.Zone } - o.Warningoverride = func() null.Val[int16] { return m.Warningoverride } - o.Recordstatus = func() null.Val[int16] { return m.Recordstatus } - o.Zone2 = func() null.Val[string] { return m.Zone2 } - o.Treatacres = func() null.Val[float64] { return m.Treatacres } - o.Tirecount = func() null.Val[int16] { return m.Tirecount } - o.Cbcount = func() null.Val[int16] { return m.Cbcount } - o.Containercount = func() null.Val[int16] { return m.Containercount } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.Treatmentlength = func() null.Val[float64] { return m.Treatmentlength } - o.Treatmenthours = func() null.Val[float64] { return m.Treatmenthours } - o.Treatmentlengthunits = func() null.Val[string] { return m.Treatmentlengthunits } - o.Linelocid = func() null.Val[uuid.UUID] { return m.Linelocid } - o.Pointlocid = func() null.Val[uuid.UUID] { return m.Pointlocid } - o.Polygonlocid = func() null.Val[uuid.UUID] { return m.Polygonlocid } - o.Srid = func() null.Val[uuid.UUID] { return m.Srid } - o.Sdid = func() null.Val[uuid.UUID] { return m.Sdid } - o.Barrierrouteid = func() null.Val[uuid.UUID] { return m.Barrierrouteid } - o.Ulvrouteid = func() null.Val[uuid.UUID] { return m.Ulvrouteid } - o.Fieldtech = func() null.Val[string] { return m.Fieldtech } - o.Ptaid = func() null.Val[uuid.UUID] { return m.Ptaid } - o.Flowrate = func() null.Val[float64] { return m.Flowrate } - o.Habitat = func() null.Val[string] { return m.Habitat } - o.Treathectares = func() null.Val[float64] { return m.Treathectares } - o.Invloc = func() null.Val[string] { return m.Invloc } - o.TempSitecond = func() null.Val[string] { return m.TempSitecond } - o.Sitecond = func() null.Val[string] { return m.Sitecond } - o.Totalcostprodcut = func() null.Val[float64] { return m.Totalcostprodcut } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.Targetspecies = func() null.Val[string] { return m.Targetspecies } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - o.H3cell = func() null.Val[string] { return m.H3cell } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerTreatmentMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerTreatmentarea(mods ...FieldseekerTreatmentareaMod) *FieldseekerTreatmentareaTemplate { - return f.NewFieldseekerTreatmentareaWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerTreatmentareaWithContext(ctx context.Context, mods ...FieldseekerTreatmentareaMod) *FieldseekerTreatmentareaTemplate { - o := &FieldseekerTreatmentareaTemplate{f: f} - - if f != nil { - f.baseFieldseekerTreatmentareaMods.Apply(ctx, o) - } - - FieldseekerTreatmentareaModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerTreatmentarea(m *models.FieldseekerTreatmentarea) *FieldseekerTreatmentareaTemplate { - o := &FieldseekerTreatmentareaTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.TreatID = func() null.Val[uuid.UUID] { return m.TreatID } - o.SessionID = func() null.Val[uuid.UUID] { return m.SessionID } - o.Treatdate = func() null.Val[time.Time] { return m.Treatdate } - o.Comments = func() null.Val[string] { return m.Comments } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Notified = func() null.Val[int16] { return m.Notified } - o.Type = func() null.Val[string] { return m.Type } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.ShapeArea = func() null.Val[float64] { return m.ShapeArea } - o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerTreatmentareaMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerZone(mods ...FieldseekerZoneMod) *FieldseekerZoneTemplate { - return f.NewFieldseekerZoneWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerZoneWithContext(ctx context.Context, mods ...FieldseekerZoneMod) *FieldseekerZoneTemplate { - o := &FieldseekerZoneTemplate{f: f} - - if f != nil { - f.baseFieldseekerZoneMods.Apply(ctx, o) - } - - FieldseekerZoneModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerZone(m *models.FieldseekerZone) *FieldseekerZoneTemplate { - o := &FieldseekerZoneTemplate{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.Name = func() null.Val[string] { return m.Name } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Active = func() null.Val[int32] { return m.Active } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.ShapeArea = func() null.Val[float64] { return m.ShapeArea } - o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerZoneMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerZones2(mods ...FieldseekerZones2Mod) *FieldseekerZones2Template { - return f.NewFieldseekerZones2WithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerZones2WithContext(ctx context.Context, mods ...FieldseekerZones2Mod) *FieldseekerZones2Template { - o := &FieldseekerZones2Template{f: f} - - if f != nil { - f.baseFieldseekerZones2Mods.Apply(ctx, o) - } - - FieldseekerZones2ModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerZones2(m *models.FieldseekerZones2) *FieldseekerZones2Template { - o := &FieldseekerZones2Template{f: f, alreadyPersisted: true} - - o.Objectid = func() int64 { return m.Objectid } - o.Name = func() null.Val[string] { return m.Name } - o.Globalid = func() uuid.UUID { return m.Globalid } - o.CreatedUser = func() null.Val[string] { return m.CreatedUser } - o.CreatedDate = func() null.Val[time.Time] { return m.CreatedDate } - o.LastEditedUser = func() null.Val[string] { return m.LastEditedUser } - o.LastEditedDate = func() null.Val[time.Time] { return m.LastEditedDate } - o.Creationdate = func() null.Val[time.Time] { return m.Creationdate } - o.Creator = func() null.Val[string] { return m.Creator } - o.Editdate = func() null.Val[time.Time] { return m.Editdate } - o.Editor = func() null.Val[string] { return m.Editor } - o.ShapeArea = func() null.Val[float64] { return m.ShapeArea } - o.ShapeLength = func() null.Val[float64] { return m.ShapeLength } - o.Geometry = func() types.JSON[json.RawMessage] { return m.Geometry } - o.Geospatial = func() null.Val[string] { return m.Geospatial } - o.Version = func() int32 { return m.Version } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerZones2Mods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFieldseekerSync(mods ...FieldseekerSyncMod) *FieldseekerSyncTemplate { - return f.NewFieldseekerSyncWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFieldseekerSyncWithContext(ctx context.Context, mods ...FieldseekerSyncMod) *FieldseekerSyncTemplate { - o := &FieldseekerSyncTemplate{f: f} - - if f != nil { - f.baseFieldseekerSyncMods.Apply(ctx, o) - } - - FieldseekerSyncModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFieldseekerSync(m *models.FieldseekerSync) *FieldseekerSyncTemplate { - o := &FieldseekerSyncTemplate{f: f, alreadyPersisted: true} - - o.ID = func() int32 { return m.ID } - o.Created = func() time.Time { return m.Created } - o.RecordsCreated = func() int32 { return m.RecordsCreated } - o.RecordsUpdated = func() int32 { return m.RecordsUpdated } - o.RecordsUnchanged = func() int32 { return m.RecordsUnchanged } - o.OrganizationID = func() int32 { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - FieldseekerSyncMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFileuploadCSV(mods ...FileuploadCSVMod) *FileuploadCSVTemplate { - return f.NewFileuploadCSVWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFileuploadCSVWithContext(ctx context.Context, mods ...FileuploadCSVMod) *FileuploadCSVTemplate { - o := &FileuploadCSVTemplate{f: f} - - if f != nil { - f.baseFileuploadCSVMods.Apply(ctx, o) - } - - FileuploadCSVModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFileuploadCSV(m *models.FileuploadCSV) *FileuploadCSVTemplate { - o := &FileuploadCSVTemplate{f: f, alreadyPersisted: true} - - o.Committed = func() null.Val[time.Time] { return m.Committed } - o.FileID = func() int32 { return m.FileID } - o.Rowcount = func() int32 { return m.Rowcount } - o.Type = func() enums.FileuploadCsvtype { return m.Type } - - ctx := context.Background() - if m.R.File != nil { - FileuploadCSVMods.WithExistingFile(m.R.File).Apply(ctx, o) - } - if len(m.R.CSVFileErrorCSVS) > 0 { - FileuploadCSVMods.AddExistingCSVFileErrorCSVS(m.R.CSVFileErrorCSVS...).Apply(ctx, o) - } - if len(m.R.CSVFilePools) > 0 { - FileuploadCSVMods.AddExistingCSVFilePools(m.R.CSVFilePools...).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFileuploadErrorCSV(mods ...FileuploadErrorCSVMod) *FileuploadErrorCSVTemplate { - return f.NewFileuploadErrorCSVWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFileuploadErrorCSVWithContext(ctx context.Context, mods ...FileuploadErrorCSVMod) *FileuploadErrorCSVTemplate { - o := &FileuploadErrorCSVTemplate{f: f} - - if f != nil { - f.baseFileuploadErrorCSVMods.Apply(ctx, o) - } - - FileuploadErrorCSVModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFileuploadErrorCSV(m *models.FileuploadErrorCSV) *FileuploadErrorCSVTemplate { - o := &FileuploadErrorCSVTemplate{f: f, alreadyPersisted: true} - - o.Col = func() int32 { return m.Col } - o.CSVFileID = func() int32 { return m.CSVFileID } - o.ID = func() int32 { return m.ID } - o.Line = func() int32 { return m.Line } - o.Message = func() string { return m.Message } - - ctx := context.Background() - if m.R.CSVFileCSV != nil { - FileuploadErrorCSVMods.WithExistingCSVFileCSV(m.R.CSVFileCSV).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFileuploadErrorFile(mods ...FileuploadErrorFileMod) *FileuploadErrorFileTemplate { - return f.NewFileuploadErrorFileWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFileuploadErrorFileWithContext(ctx context.Context, mods ...FileuploadErrorFileMod) *FileuploadErrorFileTemplate { - o := &FileuploadErrorFileTemplate{f: f} - - if f != nil { - f.baseFileuploadErrorFileMods.Apply(ctx, o) - } - - FileuploadErrorFileModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFileuploadErrorFile(m *models.FileuploadErrorFile) *FileuploadErrorFileTemplate { - o := &FileuploadErrorFileTemplate{f: f, alreadyPersisted: true} - - o.FileID = func() int32 { return m.FileID } - o.ID = func() int32 { return m.ID } - o.Message = func() string { return m.Message } - - ctx := context.Background() - if m.R.File != nil { - FileuploadErrorFileMods.WithExistingFile(m.R.File).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFileuploadFile(mods ...FileuploadFileMod) *FileuploadFileTemplate { - return f.NewFileuploadFileWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFileuploadFileWithContext(ctx context.Context, mods ...FileuploadFileMod) *FileuploadFileTemplate { - o := &FileuploadFileTemplate{f: f} - - if f != nil { - f.baseFileuploadFileMods.Apply(ctx, o) - } - - FileuploadFileModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFileuploadFile(m *models.FileuploadFile) *FileuploadFileTemplate { - o := &FileuploadFileTemplate{f: f, alreadyPersisted: true} - - o.ID = func() int32 { return m.ID } - o.ContentType = func() string { return m.ContentType } - 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.Name = func() string { return m.Name } - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Status = func() enums.FileuploadFilestatustype { return m.Status } - o.SizeBytes = func() int32 { return m.SizeBytes } - o.FileUUID = func() uuid.UUID { return m.FileUUID } - o.Committer = func() null.Val[int32] { return m.Committer } - - ctx := context.Background() - if m.R.CSV != nil { - FileuploadFileMods.WithExistingCSV(m.R.CSV).Apply(ctx, o) - } - if len(m.R.ErrorFiles) > 0 { - FileuploadFileMods.AddExistingErrorFiles(m.R.ErrorFiles...).Apply(ctx, o) - } - if m.R.CommitterUser != nil { - FileuploadFileMods.WithExistingCommitterUser(m.R.CommitterUser).Apply(ctx, o) - } - if m.R.CreatorUser != nil { - FileuploadFileMods.WithExistingCreatorUser(m.R.CreatorUser).Apply(ctx, o) - } - if m.R.Organization != nil { - FileuploadFileMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - if len(m.R.Sites) > 0 { - FileuploadFileMods.AddExistingSites(m.R.Sites...).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewFileuploadPool(mods ...FileuploadPoolMod) *FileuploadPoolTemplate { - return f.NewFileuploadPoolWithContext(context.Background(), mods...) -} - -func (f *Factory) NewFileuploadPoolWithContext(ctx context.Context, mods ...FileuploadPoolMod) *FileuploadPoolTemplate { - o := &FileuploadPoolTemplate{f: f} - - if f != nil { - f.baseFileuploadPoolMods.Apply(ctx, o) - } - - FileuploadPoolModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingFileuploadPool(m *models.FileuploadPool) *FileuploadPoolTemplate { - o := &FileuploadPoolTemplate{f: f, alreadyPersisted: true} - - o.AddressPostalCode = func() string { return m.AddressPostalCode } - o.AddressStreet = func() string { return m.AddressStreet } - o.Committed = func() bool { return m.Committed } - o.Created = func() time.Time { return m.Created } - o.CreatorID = func() int32 { return m.CreatorID } - o.CSVFile = func() int32 { return m.CSVFile } - o.Deleted = func() null.Val[time.Time] { return m.Deleted } - o.Geom = func() null.Val[string] { return m.Geom } - o.H3cell = func() null.Val[string] { return m.H3cell } - o.ID = func() int32 { return m.ID } - o.IsInDistrict = func() bool { return m.IsInDistrict } - o.IsNew = func() bool { return m.IsNew } - o.Notes = func() string { return m.Notes } - o.PropertyOwnerName = func() string { return m.PropertyOwnerName } - o.PropertyOwnerPhoneE164 = func() null.Val[string] { return m.PropertyOwnerPhoneE164 } - o.ResidentOwned = func() null.Val[bool] { return m.ResidentOwned } - o.ResidentPhoneE164 = func() null.Val[string] { return m.ResidentPhoneE164 } - o.LineNumber = func() int32 { return m.LineNumber } - o.Tags = func() pgtypes.HStore { return m.Tags } - o.AddressNumber = func() string { return m.AddressNumber } - o.AddressLocality = func() string { return m.AddressLocality } - o.AddressRegion = func() string { return m.AddressRegion } - o.Condition = func() enums.Poolconditiontype { return m.Condition } - - ctx := context.Background() - if m.R.CreatorUser != nil { - FileuploadPoolMods.WithExistingCreatorUser(m.R.CreatorUser).Apply(ctx, o) - } - if m.R.CSVFileCSV != nil { - FileuploadPoolMods.WithExistingCSVFileCSV(m.R.CSVFileCSV).Apply(ctx, o) - } - if m.R.PropertyOwnerPhoneE164Phone != nil { - FileuploadPoolMods.WithExistingPropertyOwnerPhoneE164Phone(m.R.PropertyOwnerPhoneE164Phone).Apply(ctx, o) - } - if m.R.ResidentPhoneE164Phone != nil { - FileuploadPoolMods.WithExistingResidentPhoneE164Phone(m.R.ResidentPhoneE164Phone).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewGeographyColumn(mods ...GeographyColumnMod) *GeographyColumnTemplate { - return f.NewGeographyColumnWithContext(context.Background(), mods...) -} - -func (f *Factory) NewGeographyColumnWithContext(ctx context.Context, mods ...GeographyColumnMod) *GeographyColumnTemplate { - o := &GeographyColumnTemplate{f: f} - - if f != nil { - f.baseGeographyColumnMods.Apply(ctx, o) - } - - GeographyColumnModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingGeographyColumn(m *models.GeographyColumn) *GeographyColumnTemplate { - o := &GeographyColumnTemplate{f: f, alreadyPersisted: true} - - o.FTableCatalog = func() null.Val[string] { return m.FTableCatalog } - o.FTableSchema = func() null.Val[string] { return m.FTableSchema } - o.FTableName = func() null.Val[string] { return m.FTableName } - o.FGeographyColumn = func() null.Val[string] { return m.FGeographyColumn } - o.CoordDimension = func() null.Val[int32] { return m.CoordDimension } - o.Srid = func() null.Val[int32] { return m.Srid } - o.Type = func() null.Val[string] { return m.Type } - - return o -} - -func (f *Factory) NewGeometryColumn(mods ...GeometryColumnMod) *GeometryColumnTemplate { - return f.NewGeometryColumnWithContext(context.Background(), mods...) -} - -func (f *Factory) NewGeometryColumnWithContext(ctx context.Context, mods ...GeometryColumnMod) *GeometryColumnTemplate { - o := &GeometryColumnTemplate{f: f} - - if f != nil { - f.baseGeometryColumnMods.Apply(ctx, o) - } - - GeometryColumnModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingGeometryColumn(m *models.GeometryColumn) *GeometryColumnTemplate { - o := &GeometryColumnTemplate{f: f, alreadyPersisted: true} - - o.FTableCatalog = func() null.Val[string] { return m.FTableCatalog } - o.FTableSchema = func() null.Val[string] { return m.FTableSchema } - o.FTableName = func() null.Val[string] { return m.FTableName } - o.FGeometryColumn = func() null.Val[string] { return m.FGeometryColumn } - o.CoordDimension = func() null.Val[int32] { return m.CoordDimension } - o.Srid = func() null.Val[int32] { return m.Srid } - o.Type = func() null.Val[string] { return m.Type } - - return o -} - -func (f *Factory) NewGooseDBVersion(mods ...GooseDBVersionMod) *GooseDBVersionTemplate { - return f.NewGooseDBVersionWithContext(context.Background(), mods...) -} - -func (f *Factory) NewGooseDBVersionWithContext(ctx context.Context, mods ...GooseDBVersionMod) *GooseDBVersionTemplate { - o := &GooseDBVersionTemplate{f: f} - - if f != nil { - f.baseGooseDBVersionMods.Apply(ctx, o) - } - - GooseDBVersionModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingGooseDBVersion(m *models.GooseDBVersion) *GooseDBVersionTemplate { - o := &GooseDBVersionTemplate{f: f, alreadyPersisted: true} - - o.ID = func() int32 { return m.ID } - o.VersionID = func() int64 { return m.VersionID } - o.IsApplied = func() bool { return m.IsApplied } - o.Tstamp = func() time.Time { return m.Tstamp } - - return o -} - -func (f *Factory) NewH3Aggregation(mods ...H3AggregationMod) *H3AggregationTemplate { - return f.NewH3AggregationWithContext(context.Background(), mods...) -} - -func (f *Factory) NewH3AggregationWithContext(ctx context.Context, mods ...H3AggregationMod) *H3AggregationTemplate { - o := &H3AggregationTemplate{f: f} - - if f != nil { - f.baseH3AggregationMods.Apply(ctx, o) - } - - H3AggregationModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingH3Aggregation(m *models.H3Aggregation) *H3AggregationTemplate { - o := &H3AggregationTemplate{f: f, alreadyPersisted: true} - - o.ID = func() int32 { return m.ID } - o.Cell = func() string { return m.Cell } - o.Count = func() int32 { return m.Count } - o.Geometry = func() null.Val[string] { return m.Geometry } - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Resolution = func() int32 { return m.Resolution } - o.Type = func() enums.H3aggregationtype { return m.Type } - - ctx := context.Background() - if m.R.Organization != nil { - H3AggregationMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewLead(mods ...LeadMod) *LeadTemplate { - return f.NewLeadWithContext(context.Background(), mods...) -} - -func (f *Factory) NewLeadWithContext(ctx context.Context, mods ...LeadMod) *LeadTemplate { - o := &LeadTemplate{f: f} - - if f != nil { - f.baseLeadMods.Apply(ctx, o) - } - - LeadModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingLead(m *models.Lead) *LeadTemplate { - o := &LeadTemplate{f: f, alreadyPersisted: true} - - o.Created = func() time.Time { return m.Created } - o.Creator = func() int32 { return m.Creator } - o.ID = func() int32 { return m.ID } - o.OrganizationID = func() int32 { return m.OrganizationID } - o.SiteID = func() null.Val[int32] { return m.SiteID } - o.SiteVersion = func() null.Val[int32] { return m.SiteVersion } - o.Type = func() enums.Leadtype { return m.Type } - - ctx := context.Background() - if len(m.R.ComplianceReportRequests) > 0 { - LeadMods.AddExistingComplianceReportRequests(m.R.ComplianceReportRequests...).Apply(ctx, o) - } - if m.R.CreatorUser != nil { - LeadMods.WithExistingCreatorUser(m.R.CreatorUser).Apply(ctx, o) - } - if m.R.Organization != nil { - LeadMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - if m.R.Site != nil { - LeadMods.WithExistingSite(m.R.Site).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewNoteAudio(mods ...NoteAudioMod) *NoteAudioTemplate { - return f.NewNoteAudioWithContext(context.Background(), mods...) -} - -func (f *Factory) NewNoteAudioWithContext(ctx context.Context, mods ...NoteAudioMod) *NoteAudioTemplate { - o := &NoteAudioTemplate{f: f} - - if f != nil { - f.baseNoteAudioMods.Apply(ctx, o) - } - - NoteAudioModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingNoteAudio(m *models.NoteAudio) *NoteAudioTemplate { - o := &NoteAudioTemplate{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.Duration = func() float32 { return m.Duration } - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Transcription = func() null.Val[string] { return m.Transcription } - o.TranscriptionUserEdited = func() bool { return m.TranscriptionUserEdited } - o.Version = func() int32 { return m.Version } - o.UUID = func() uuid.UUID { return m.UUID } - - ctx := context.Background() - if m.R.CreatorUser != nil { - NoteAudioMods.WithExistingCreatorUser(m.R.CreatorUser).Apply(ctx, o) - } - if m.R.DeletorUser != nil { - NoteAudioMods.WithExistingDeletorUser(m.R.DeletorUser).Apply(ctx, o) - } - if m.R.Organization != nil { - NoteAudioMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - if len(m.R.NoteAudioBreadcrumbs) > 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) NewNoteAudioBreadcrumb(mods ...NoteAudioBreadcrumbMod) *NoteAudioBreadcrumbTemplate { - return f.NewNoteAudioBreadcrumbWithContext(context.Background(), mods...) -} - -func (f *Factory) NewNoteAudioBreadcrumbWithContext(ctx context.Context, mods ...NoteAudioBreadcrumbMod) *NoteAudioBreadcrumbTemplate { - o := &NoteAudioBreadcrumbTemplate{f: f} - - if f != nil { - f.baseNoteAudioBreadcrumbMods.Apply(ctx, o) - } - - NoteAudioBreadcrumbModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingNoteAudioBreadcrumb(m *models.NoteAudioBreadcrumb) *NoteAudioBreadcrumbTemplate { - o := &NoteAudioBreadcrumbTemplate{f: f, alreadyPersisted: true} - - 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.NoteAudio != nil { - NoteAudioBreadcrumbMods.WithExistingNoteAudio(m.R.NoteAudio).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewNoteAudioDatum(mods ...NoteAudioDatumMod) *NoteAudioDatumTemplate { - return f.NewNoteAudioDatumWithContext(context.Background(), mods...) -} - -func (f *Factory) NewNoteAudioDatumWithContext(ctx context.Context, mods ...NoteAudioDatumMod) *NoteAudioDatumTemplate { - o := &NoteAudioDatumTemplate{f: f} - - if f != nil { - f.baseNoteAudioDatumMods.Apply(ctx, o) - } - - NoteAudioDatumModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingNoteAudioDatum(m *models.NoteAudioDatum) *NoteAudioDatumTemplate { - o := &NoteAudioDatumTemplate{f: f, alreadyPersisted: true} - - 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.NoteAudio != nil { - NoteAudioDatumMods.WithExistingNoteAudio(m.R.NoteAudio).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewNoteImage(mods ...NoteImageMod) *NoteImageTemplate { - return f.NewNoteImageWithContext(context.Background(), mods...) -} - -func (f *Factory) NewNoteImageWithContext(ctx context.Context, mods ...NoteImageMod) *NoteImageTemplate { - o := &NoteImageTemplate{f: f} - - if f != nil { - f.baseNoteImageMods.Apply(ctx, o) - } - - NoteImageModSlice(mods).Apply(ctx, o) - - return o -} - -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.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 { - 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) NewNoteImageBreadcrumb(mods ...NoteImageBreadcrumbMod) *NoteImageBreadcrumbTemplate { - return f.NewNoteImageBreadcrumbWithContext(context.Background(), mods...) -} - -func (f *Factory) NewNoteImageBreadcrumbWithContext(ctx context.Context, mods ...NoteImageBreadcrumbMod) *NoteImageBreadcrumbTemplate { - o := &NoteImageBreadcrumbTemplate{f: f} - - if f != nil { - f.baseNoteImageBreadcrumbMods.Apply(ctx, o) - } - - NoteImageBreadcrumbModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingNoteImageBreadcrumb(m *models.NoteImageBreadcrumb) *NoteImageBreadcrumbTemplate { - o := &NoteImageBreadcrumbTemplate{f: f, alreadyPersisted: true} - - 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.NoteImage != nil { - NoteImageBreadcrumbMods.WithExistingNoteImage(m.R.NoteImage).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewNoteImageDatum(mods ...NoteImageDatumMod) *NoteImageDatumTemplate { - return f.NewNoteImageDatumWithContext(context.Background(), mods...) -} - -func (f *Factory) NewNoteImageDatumWithContext(ctx context.Context, mods ...NoteImageDatumMod) *NoteImageDatumTemplate { - o := &NoteImageDatumTemplate{f: f} - - if f != nil { - f.baseNoteImageDatumMods.Apply(ctx, o) - } - - NoteImageDatumModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingNoteImageDatum(m *models.NoteImageDatum) *NoteImageDatumTemplate { - o := &NoteImageDatumTemplate{f: f, alreadyPersisted: true} - - 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.NoteImage != nil { - NoteImageDatumMods.WithExistingNoteImage(m.R.NoteImage).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewNotification(mods ...NotificationMod) *NotificationTemplate { - return f.NewNotificationWithContext(context.Background(), mods...) -} - -func (f *Factory) NewNotificationWithContext(ctx context.Context, mods ...NotificationMod) *NotificationTemplate { - o := &NotificationTemplate{f: f} - - if f != nil { - f.baseNotificationMods.Apply(ctx, o) - } - - NotificationModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingNotification(m *models.Notification) *NotificationTemplate { - o := &NotificationTemplate{f: f, alreadyPersisted: true} - - o.ID = func() int32 { return m.ID } - o.Created = func() time.Time { return m.Created } - o.Link = func() string { return m.Link } - o.Message = func() string { return m.Message } - o.Type = func() enums.Notificationtype { return m.Type } - o.UserID = func() int32 { return m.UserID } - o.ResolvedAt = func() null.Val[time.Time] { return m.ResolvedAt } - - ctx := context.Background() - if m.R.UserUser != nil { - NotificationMods.WithExistingUserUser(m.R.UserUser).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewOrganization(mods ...OrganizationMod) *OrganizationTemplate { - return f.NewOrganizationWithContext(context.Background(), mods...) -} - -func (f *Factory) NewOrganizationWithContext(ctx context.Context, mods ...OrganizationMod) *OrganizationTemplate { - o := &OrganizationTemplate{f: f} - - if f != nil { - f.baseOrganizationMods.Apply(ctx, o) - } - - OrganizationModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingOrganization(m *models.Organization) *OrganizationTemplate { - o := &OrganizationTemplate{f: f, alreadyPersisted: true} - - o.ID = func() int32 { return m.ID } - o.Name = func() string { return m.Name } - o.ImportDistrictGid = func() null.Val[int32] { return m.ImportDistrictGid } - o.Website = func() null.Val[string] { return m.Website } - o.LogoUUID = func() null.Val[uuid.UUID] { return m.LogoUUID } - o.Slug = func() null.Val[string] { return m.Slug } - o.GeneralManagerName = func() null.Val[string] { return m.GeneralManagerName } - o.MailingAddressCity = func() null.Val[string] { return m.MailingAddressCity } - o.MailingAddressPostalCode = func() null.Val[string] { return m.MailingAddressPostalCode } - o.MailingAddressStreet = func() null.Val[string] { return m.MailingAddressStreet } - o.OfficeAddressCity = func() null.Val[string] { return m.OfficeAddressCity } - o.OfficeAddressPostalCode = func() null.Val[string] { return m.OfficeAddressPostalCode } - o.OfficeAddressStreet = func() null.Val[string] { return m.OfficeAddressStreet } - o.ServiceAreaGeometry = func() null.Val[string] { return m.ServiceAreaGeometry } - o.ServiceAreaSquareMeters = func() null.Val[decimal.Decimal] { return m.ServiceAreaSquareMeters } - o.ServiceAreaCentroid = func() null.Val[string] { return m.ServiceAreaCentroid } - o.ServiceAreaExtent = func() null.Val[string] { return m.ServiceAreaExtent } - o.OfficeFax = func() null.Val[string] { return m.OfficeFax } - o.OfficePhone = func() null.Val[string] { return m.OfficePhone } - o.ServiceAreaXmin = func() null.Val[float64] { return m.ServiceAreaXmin } - o.ServiceAreaYmin = func() null.Val[float64] { return m.ServiceAreaYmin } - o.ServiceAreaXmax = func() null.Val[float64] { return m.ServiceAreaXmax } - o.ServiceAreaYmax = func() null.Val[float64] { return m.ServiceAreaYmax } - o.ServiceAreaCentroidGeojson = func() null.Val[string] { return m.ServiceAreaCentroidGeojson } - o.ServiceAreaCentroidX = func() null.Val[float64] { return m.ServiceAreaCentroidX } - o.ServiceAreaCentroidY = func() null.Val[float64] { return m.ServiceAreaCentroidY } - o.MailingAddressCountry = func() null.Val[string] { return m.MailingAddressCountry } - o.MailingAddressState = func() null.Val[string] { return m.MailingAddressState } - o.OfficeAddressCountry = func() null.Val[string] { return m.OfficeAddressCountry } - o.OfficeAddressState = func() null.Val[string] { return m.OfficeAddressState } - o.ArcgisAccountID = func() null.Val[string] { return m.ArcgisAccountID } - o.FieldseekerServiceFeatureItemID = func() null.Val[string] { return m.FieldseekerServiceFeatureItemID } - - ctx := context.Background() - if len(m.R.Accounts) > 0 { - OrganizationMods.AddExistingAccounts(m.R.Accounts...).Apply(ctx, o) - } - if len(m.R.AddressMappings) > 0 { - OrganizationMods.AddExistingAddressMappings(m.R.AddressMappings...).Apply(ctx, o) - } - if len(m.R.ParcelMappings) > 0 { - OrganizationMods.AddExistingParcelMappings(m.R.ParcelMappings...).Apply(ctx, o) - } - if len(m.R.EmailContacts) > 0 { - OrganizationMods.AddExistingEmailContacts(m.R.EmailContacts...).Apply(ctx, o) - } - if len(m.R.Phones) > 0 { - OrganizationMods.AddExistingPhones(m.R.Phones...).Apply(ctx, o) - } - 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.FieldseekerPool) > 0 { - OrganizationMods.AddExistingFieldseekerPool(m.R.FieldseekerPool...).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.Files) > 0 { - OrganizationMods.AddExistingFiles(m.R.Files...).Apply(ctx, o) - } - if len(m.R.H3Aggregations) > 0 { - OrganizationMods.AddExistingH3Aggregations(m.R.H3Aggregations...).Apply(ctx, o) - } - if len(m.R.Leads) > 0 { - OrganizationMods.AddExistingLeads(m.R.Leads...).Apply(ctx, o) - } - if len(m.R.NoteAudios) > 0 { - OrganizationMods.AddExistingNoteAudios(m.R.NoteAudios...).Apply(ctx, o) - } - if len(m.R.NoteImages) > 0 { - OrganizationMods.AddExistingNoteImages(m.R.NoteImages...).Apply(ctx, o) - } - if m.R.ArcgisAccountAccount != nil { - OrganizationMods.WithExistingArcgisAccountAccount(m.R.ArcgisAccountAccount).Apply(ctx, o) - } - if m.R.FieldseekerServiceFeatureItemServiceFeature != nil { - OrganizationMods.WithExistingFieldseekerServiceFeatureItemServiceFeature(m.R.FieldseekerServiceFeatureItemServiceFeature).Apply(ctx, o) - } - if len(m.R.Nuisances) > 0 { - OrganizationMods.AddExistingNuisances(m.R.Nuisances...).Apply(ctx, o) - } - if len(m.R.PublicreportPool) > 0 { - OrganizationMods.AddExistingPublicreportPool(m.R.PublicreportPool...).Apply(ctx, o) - } - if len(m.R.Quicks) > 0 { - OrganizationMods.AddExistingQuicks(m.R.Quicks...).Apply(ctx, o) - } - if len(m.R.Signals) > 0 { - OrganizationMods.AddExistingSignals(m.R.Signals...).Apply(ctx, o) - } - if len(m.R.User) > 0 { - OrganizationMods.AddExistingUser(m.R.User...).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewParcel(mods ...ParcelMod) *ParcelTemplate { - return f.NewParcelWithContext(context.Background(), mods...) -} - -func (f *Factory) NewParcelWithContext(ctx context.Context, mods ...ParcelMod) *ParcelTemplate { - o := &ParcelTemplate{f: f} - - if f != nil { - f.baseParcelMods.Apply(ctx, o) - } - - ParcelModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingParcel(m *models.Parcel) *ParcelTemplate { - o := &ParcelTemplate{f: f, alreadyPersisted: true} - - o.Apn = func() null.Val[string] { return m.Apn } - o.Description = func() null.Val[string] { return m.Description } - o.ID = func() int32 { return m.ID } - o.Geometry = func() string { return m.Geometry } - - ctx := context.Background() - if len(m.R.Sites) > 0 { - ParcelMods.AddExistingSites(m.R.Sites...).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewPool(mods ...PoolMod) *PoolTemplate { - return f.NewPoolWithContext(context.Background(), mods...) -} - -func (f *Factory) NewPoolWithContext(ctx context.Context, mods ...PoolMod) *PoolTemplate { - o := &PoolTemplate{f: f} - - if f != nil { - f.basePoolMods.Apply(ctx, o) - } - - PoolModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingPool(m *models.Pool) *PoolTemplate { - o := &PoolTemplate{f: f, alreadyPersisted: true} - - o.Condition = func() enums.Poolconditiontype { return m.Condition } - o.Created = func() time.Time { return m.Created } - o.CreatorID = func() int32 { return m.CreatorID } - o.ID = func() int32 { return m.ID } - o.SiteID = func() int32 { return m.SiteID } - o.SiteVersion = func() int32 { return m.SiteVersion } - o.Geometry = func() null.Val[string] { return m.Geometry } - - ctx := context.Background() - if m.R.CreatorUser != nil { - PoolMods.WithExistingCreatorUser(m.R.CreatorUser).Apply(ctx, o) - } - if m.R.Site != nil { - PoolMods.WithExistingSite(m.R.Site).Apply(ctx, o) - } - if len(m.R.SignalPools) > 0 { - PoolMods.AddExistingSignalPools(m.R.SignalPools...).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewPublicreportImage(mods ...PublicreportImageMod) *PublicreportImageTemplate { - return f.NewPublicreportImageWithContext(context.Background(), mods...) -} - -func (f *Factory) NewPublicreportImageWithContext(ctx context.Context, mods ...PublicreportImageMod) *PublicreportImageTemplate { - o := &PublicreportImageTemplate{f: f} - - if f != nil { - f.basePublicreportImageMods.Apply(ctx, o) - } - - PublicreportImageModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingPublicreportImage(m *models.PublicreportImage) *PublicreportImageTemplate { - o := &PublicreportImageTemplate{f: f, alreadyPersisted: true} - - o.ID = func() int32 { return m.ID } - o.ContentType = func() string { return m.ContentType } - o.Created = func() time.Time { return m.Created } - o.Location = func() null.Val[string] { return m.Location } - o.ResolutionX = func() int32 { return m.ResolutionX } - o.ResolutionY = func() int32 { return m.ResolutionY } - o.StorageUUID = func() uuid.UUID { return m.StorageUUID } - o.StorageSize = func() int64 { return m.StorageSize } - o.UploadedFilename = func() string { return m.UploadedFilename } - - ctx := context.Background() - if len(m.R.ImageExifs) > 0 { - PublicreportImageMods.AddExistingImageExifs(m.R.ImageExifs...).Apply(ctx, o) - } - if len(m.R.Nuisances) > 0 { - PublicreportImageMods.AddExistingNuisances(m.R.Nuisances...).Apply(ctx, o) - } - if len(m.R.Pools) > 0 { - PublicreportImageMods.AddExistingPools(m.R.Pools...).Apply(ctx, o) - } - if len(m.R.Quicks) > 0 { - PublicreportImageMods.AddExistingQuicks(m.R.Quicks...).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewPublicreportImageExif(mods ...PublicreportImageExifMod) *PublicreportImageExifTemplate { - return f.NewPublicreportImageExifWithContext(context.Background(), mods...) -} - -func (f *Factory) NewPublicreportImageExifWithContext(ctx context.Context, mods ...PublicreportImageExifMod) *PublicreportImageExifTemplate { - o := &PublicreportImageExifTemplate{f: f} - - if f != nil { - f.basePublicreportImageExifMods.Apply(ctx, o) - } - - PublicreportImageExifModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingPublicreportImageExif(m *models.PublicreportImageExif) *PublicreportImageExifTemplate { - o := &PublicreportImageExifTemplate{f: f, alreadyPersisted: true} - - o.ImageID = func() int32 { return m.ImageID } - o.Name = func() string { return m.Name } - o.Value = func() string { return m.Value } - - ctx := context.Background() - if m.R.Image != nil { - PublicreportImageExifMods.WithExistingImage(m.R.Image).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewPublicreportNotifyEmailNuisance(mods ...PublicreportNotifyEmailNuisanceMod) *PublicreportNotifyEmailNuisanceTemplate { - return f.NewPublicreportNotifyEmailNuisanceWithContext(context.Background(), mods...) -} - -func (f *Factory) NewPublicreportNotifyEmailNuisanceWithContext(ctx context.Context, mods ...PublicreportNotifyEmailNuisanceMod) *PublicreportNotifyEmailNuisanceTemplate { - o := &PublicreportNotifyEmailNuisanceTemplate{f: f} - - if f != nil { - f.basePublicreportNotifyEmailNuisanceMods.Apply(ctx, o) - } - - PublicreportNotifyEmailNuisanceModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingPublicreportNotifyEmailNuisance(m *models.PublicreportNotifyEmailNuisance) *PublicreportNotifyEmailNuisanceTemplate { - o := &PublicreportNotifyEmailNuisanceTemplate{f: f, alreadyPersisted: true} - - o.Created = func() time.Time { return m.Created } - o.Deleted = func() null.Val[time.Time] { return m.Deleted } - o.NuisanceID = func() int32 { return m.NuisanceID } - o.EmailAddress = func() string { return m.EmailAddress } - - ctx := context.Background() - if m.R.EmailAddressEmailContact != nil { - PublicreportNotifyEmailNuisanceMods.WithExistingEmailAddressEmailContact(m.R.EmailAddressEmailContact).Apply(ctx, o) - } - if m.R.Nuisance != nil { - PublicreportNotifyEmailNuisanceMods.WithExistingNuisance(m.R.Nuisance).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewPublicreportNotifyEmailPool(mods ...PublicreportNotifyEmailPoolMod) *PublicreportNotifyEmailPoolTemplate { - return f.NewPublicreportNotifyEmailPoolWithContext(context.Background(), mods...) -} - -func (f *Factory) NewPublicreportNotifyEmailPoolWithContext(ctx context.Context, mods ...PublicreportNotifyEmailPoolMod) *PublicreportNotifyEmailPoolTemplate { - o := &PublicreportNotifyEmailPoolTemplate{f: f} - - if f != nil { - f.basePublicreportNotifyEmailPoolMods.Apply(ctx, o) - } - - PublicreportNotifyEmailPoolModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingPublicreportNotifyEmailPool(m *models.PublicreportNotifyEmailPool) *PublicreportNotifyEmailPoolTemplate { - o := &PublicreportNotifyEmailPoolTemplate{f: f, alreadyPersisted: true} - - o.Created = func() time.Time { return m.Created } - o.Deleted = func() null.Val[time.Time] { return m.Deleted } - o.PoolID = func() int32 { return m.PoolID } - o.EmailAddress = func() string { return m.EmailAddress } - - ctx := context.Background() - if m.R.EmailAddressEmailContact != nil { - PublicreportNotifyEmailPoolMods.WithExistingEmailAddressEmailContact(m.R.EmailAddressEmailContact).Apply(ctx, o) - } - if m.R.Pool != nil { - PublicreportNotifyEmailPoolMods.WithExistingPool(m.R.Pool).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewPublicreportNotifyPhoneNuisance(mods ...PublicreportNotifyPhoneNuisanceMod) *PublicreportNotifyPhoneNuisanceTemplate { - return f.NewPublicreportNotifyPhoneNuisanceWithContext(context.Background(), mods...) -} - -func (f *Factory) NewPublicreportNotifyPhoneNuisanceWithContext(ctx context.Context, mods ...PublicreportNotifyPhoneNuisanceMod) *PublicreportNotifyPhoneNuisanceTemplate { - o := &PublicreportNotifyPhoneNuisanceTemplate{f: f} - - if f != nil { - f.basePublicreportNotifyPhoneNuisanceMods.Apply(ctx, o) - } - - PublicreportNotifyPhoneNuisanceModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingPublicreportNotifyPhoneNuisance(m *models.PublicreportNotifyPhoneNuisance) *PublicreportNotifyPhoneNuisanceTemplate { - o := &PublicreportNotifyPhoneNuisanceTemplate{f: f, alreadyPersisted: true} - - o.Created = func() time.Time { return m.Created } - o.Deleted = func() null.Val[time.Time] { return m.Deleted } - o.NuisanceID = func() int32 { return m.NuisanceID } - o.PhoneE164 = func() string { return m.PhoneE164 } - - ctx := context.Background() - if m.R.Nuisance != nil { - PublicreportNotifyPhoneNuisanceMods.WithExistingNuisance(m.R.Nuisance).Apply(ctx, o) - } - if m.R.PhoneE164Phone != nil { - PublicreportNotifyPhoneNuisanceMods.WithExistingPhoneE164Phone(m.R.PhoneE164Phone).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewPublicreportNotifyPhonePool(mods ...PublicreportNotifyPhonePoolMod) *PublicreportNotifyPhonePoolTemplate { - return f.NewPublicreportNotifyPhonePoolWithContext(context.Background(), mods...) -} - -func (f *Factory) NewPublicreportNotifyPhonePoolWithContext(ctx context.Context, mods ...PublicreportNotifyPhonePoolMod) *PublicreportNotifyPhonePoolTemplate { - o := &PublicreportNotifyPhonePoolTemplate{f: f} - - if f != nil { - f.basePublicreportNotifyPhonePoolMods.Apply(ctx, o) - } - - PublicreportNotifyPhonePoolModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingPublicreportNotifyPhonePool(m *models.PublicreportNotifyPhonePool) *PublicreportNotifyPhonePoolTemplate { - o := &PublicreportNotifyPhonePoolTemplate{f: f, alreadyPersisted: true} - - o.Created = func() time.Time { return m.Created } - o.Deleted = func() null.Val[time.Time] { return m.Deleted } - o.PhoneE164 = func() string { return m.PhoneE164 } - o.PoolID = func() int32 { return m.PoolID } - - ctx := context.Background() - if m.R.PhoneE164Phone != nil { - PublicreportNotifyPhonePoolMods.WithExistingPhoneE164Phone(m.R.PhoneE164Phone).Apply(ctx, o) - } - if m.R.Pool != nil { - PublicreportNotifyPhonePoolMods.WithExistingPool(m.R.Pool).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewPublicreportNuisance(mods ...PublicreportNuisanceMod) *PublicreportNuisanceTemplate { - return f.NewPublicreportNuisanceWithContext(context.Background(), mods...) -} - -func (f *Factory) NewPublicreportNuisanceWithContext(ctx context.Context, mods ...PublicreportNuisanceMod) *PublicreportNuisanceTemplate { - o := &PublicreportNuisanceTemplate{f: f} - - if f != nil { - f.basePublicreportNuisanceMods.Apply(ctx, o) - } - - PublicreportNuisanceModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingPublicreportNuisance(m *models.PublicreportNuisance) *PublicreportNuisanceTemplate { - o := &PublicreportNuisanceTemplate{f: f, alreadyPersisted: true} - - o.ID = func() int32 { return m.ID } - o.AdditionalInfo = func() string { return m.AdditionalInfo } - o.Created = func() time.Time { return m.Created } - o.Duration = func() enums.PublicreportNuisancedurationtype { return m.Duration } - o.SourceContainer = func() bool { return m.SourceContainer } - o.SourceDescription = func() string { return m.SourceDescription } - o.SourceStagnant = func() bool { return m.SourceStagnant } - o.PublicID = func() string { return m.PublicID } - o.ReporterEmail = func() null.Val[string] { return m.ReporterEmail } - o.ReporterName = func() null.Val[string] { return m.ReporterName } - o.ReporterPhone = func() null.Val[string] { return m.ReporterPhone } - o.Address = func() string { return m.Address } - o.Location = func() null.Val[string] { return m.Location } - o.Status = func() enums.PublicreportReportstatustype { return m.Status } - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } - o.SourceGutter = func() bool { return m.SourceGutter } - o.H3cell = func() null.Val[string] { return m.H3cell } - o.AddressCountry = func() string { return m.AddressCountry } - o.AddressPlace = func() string { return m.AddressPlace } - o.AddressPostcode = func() string { return m.AddressPostcode } - o.AddressRegion = func() string { return m.AddressRegion } - o.AddressStreet = func() string { return m.AddressStreet } - o.IsLocationBackyard = func() bool { return m.IsLocationBackyard } - o.IsLocationFrontyard = func() bool { return m.IsLocationFrontyard } - o.IsLocationGarden = func() bool { return m.IsLocationGarden } - o.IsLocationOther = func() bool { return m.IsLocationOther } - o.IsLocationPool = func() bool { return m.IsLocationPool } - o.MapZoom = func() float32 { return m.MapZoom } - o.TodEarly = func() bool { return m.TodEarly } - o.TodDay = func() bool { return m.TodDay } - o.TodEvening = func() bool { return m.TodEvening } - o.TodNight = func() bool { return m.TodNight } - o.LatlngAccuracyType = func() enums.PublicreportAccuracytype { return m.LatlngAccuracyType } - o.LatlngAccuracyValue = func() float32 { return m.LatlngAccuracyValue } - o.ReporterContactConsent = func() null.Val[bool] { return m.ReporterContactConsent } - - ctx := context.Background() - if len(m.R.NotifyEmailNuisances) > 0 { - PublicreportNuisanceMods.AddExistingNotifyEmailNuisances(m.R.NotifyEmailNuisances...).Apply(ctx, o) - } - if len(m.R.NotifyPhoneNuisances) > 0 { - PublicreportNuisanceMods.AddExistingNotifyPhoneNuisances(m.R.NotifyPhoneNuisances...).Apply(ctx, o) - } - if m.R.Organization != nil { - PublicreportNuisanceMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - if len(m.R.Images) > 0 { - PublicreportNuisanceMods.AddExistingImages(m.R.Images...).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewPublicreportNuisanceImage(mods ...PublicreportNuisanceImageMod) *PublicreportNuisanceImageTemplate { - return f.NewPublicreportNuisanceImageWithContext(context.Background(), mods...) -} - -func (f *Factory) NewPublicreportNuisanceImageWithContext(ctx context.Context, mods ...PublicreportNuisanceImageMod) *PublicreportNuisanceImageTemplate { - o := &PublicreportNuisanceImageTemplate{f: f} - - if f != nil { - f.basePublicreportNuisanceImageMods.Apply(ctx, o) - } - - PublicreportNuisanceImageModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingPublicreportNuisanceImage(m *models.PublicreportNuisanceImage) *PublicreportNuisanceImageTemplate { - o := &PublicreportNuisanceImageTemplate{f: f, alreadyPersisted: true} - - o.ImageID = func() int32 { return m.ImageID } - o.NuisanceID = func() int32 { return m.NuisanceID } - - ctx := context.Background() - if m.R.Image != nil { - PublicreportNuisanceImageMods.WithExistingImage(m.R.Image).Apply(ctx, o) - } - if m.R.Nuisance != nil { - PublicreportNuisanceImageMods.WithExistingNuisance(m.R.Nuisance).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewPublicreportPool(mods ...PublicreportPoolMod) *PublicreportPoolTemplate { - return f.NewPublicreportPoolWithContext(context.Background(), mods...) -} - -func (f *Factory) NewPublicreportPoolWithContext(ctx context.Context, mods ...PublicreportPoolMod) *PublicreportPoolTemplate { - o := &PublicreportPoolTemplate{f: f} - - if f != nil { - f.basePublicreportPoolMods.Apply(ctx, o) - } - - PublicreportPoolModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingPublicreportPool(m *models.PublicreportPool) *PublicreportPoolTemplate { - o := &PublicreportPoolTemplate{f: f, alreadyPersisted: true} - - o.ID = func() int32 { return m.ID } - o.AccessComments = func() string { return m.AccessComments } - o.AccessGate = func() bool { return m.AccessGate } - o.AccessFence = func() bool { return m.AccessFence } - o.AccessLocked = func() bool { return m.AccessLocked } - o.AccessDog = func() bool { return m.AccessDog } - o.AccessOther = func() bool { return m.AccessOther } - o.Address = func() string { return m.Address } - o.AddressCountry = func() string { return m.AddressCountry } - o.AddressPostCode = func() string { return m.AddressPostCode } - o.AddressPlace = func() string { return m.AddressPlace } - o.AddressStreet = func() string { return m.AddressStreet } - o.AddressRegion = func() string { return m.AddressRegion } - o.Comments = func() string { return m.Comments } - o.Created = func() time.Time { return m.Created } - o.H3cell = func() null.Val[string] { return m.H3cell } - o.HasAdult = func() bool { return m.HasAdult } - o.HasLarvae = func() bool { return m.HasLarvae } - o.HasPupae = func() bool { return m.HasPupae } - o.Location = func() null.Val[string] { return m.Location } - o.MapZoom = func() float32 { return m.MapZoom } - o.OwnerEmail = func() string { return m.OwnerEmail } - o.OwnerName = func() string { return m.OwnerName } - o.OwnerPhone = func() string { return m.OwnerPhone } - o.PublicID = func() string { return m.PublicID } - o.ReporterEmail = func() string { return m.ReporterEmail } - o.ReporterName = func() string { return m.ReporterName } - o.ReporterPhone = func() string { return m.ReporterPhone } - o.Status = func() enums.PublicreportReportstatustype { return m.Status } - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } - o.HasBackyardPermission = func() bool { return m.HasBackyardPermission } - o.IsReporterConfidential = func() bool { return m.IsReporterConfidential } - o.IsReporterOwner = func() bool { return m.IsReporterOwner } - o.ReporterContactConsent = func() null.Val[bool] { return m.ReporterContactConsent } - - ctx := context.Background() - if len(m.R.NotifyEmailPools) > 0 { - PublicreportPoolMods.AddExistingNotifyEmailPools(m.R.NotifyEmailPools...).Apply(ctx, o) - } - if len(m.R.NotifyPhonePools) > 0 { - PublicreportPoolMods.AddExistingNotifyPhonePools(m.R.NotifyPhonePools...).Apply(ctx, o) - } - if m.R.Organization != nil { - PublicreportPoolMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - if len(m.R.Images) > 0 { - PublicreportPoolMods.AddExistingImages(m.R.Images...).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewPublicreportPoolImage(mods ...PublicreportPoolImageMod) *PublicreportPoolImageTemplate { - return f.NewPublicreportPoolImageWithContext(context.Background(), mods...) -} - -func (f *Factory) NewPublicreportPoolImageWithContext(ctx context.Context, mods ...PublicreportPoolImageMod) *PublicreportPoolImageTemplate { - o := &PublicreportPoolImageTemplate{f: f} - - if f != nil { - f.basePublicreportPoolImageMods.Apply(ctx, o) - } - - PublicreportPoolImageModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingPublicreportPoolImage(m *models.PublicreportPoolImage) *PublicreportPoolImageTemplate { - o := &PublicreportPoolImageTemplate{f: f, alreadyPersisted: true} - - o.ImageID = func() int32 { return m.ImageID } - o.PoolID = func() int32 { return m.PoolID } - - ctx := context.Background() - if m.R.Image != nil { - PublicreportPoolImageMods.WithExistingImage(m.R.Image).Apply(ctx, o) - } - if m.R.Pool != nil { - PublicreportPoolImageMods.WithExistingPool(m.R.Pool).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewPublicreportQuick(mods ...PublicreportQuickMod) *PublicreportQuickTemplate { - return f.NewPublicreportQuickWithContext(context.Background(), mods...) -} - -func (f *Factory) NewPublicreportQuickWithContext(ctx context.Context, mods ...PublicreportQuickMod) *PublicreportQuickTemplate { - o := &PublicreportQuickTemplate{f: f} - - if f != nil { - f.basePublicreportQuickMods.Apply(ctx, o) - } - - PublicreportQuickModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingPublicreportQuick(m *models.PublicreportQuick) *PublicreportQuickTemplate { - o := &PublicreportQuickTemplate{f: f, alreadyPersisted: true} - - o.ID = func() int32 { return m.ID } - o.Created = func() time.Time { return m.Created } - o.Comments = func() string { return m.Comments } - o.Location = func() null.Val[string] { return m.Location } - o.H3cell = func() null.Val[string] { return m.H3cell } - o.PublicID = func() string { return m.PublicID } - o.ReporterEmail = func() string { return m.ReporterEmail } - o.ReporterPhone = func() string { return m.ReporterPhone } - o.Address = func() string { return m.Address } - o.Status = func() enums.PublicreportReportstatustype { return m.Status } - o.OrganizationID = func() null.Val[int32] { return m.OrganizationID } - - ctx := context.Background() - if m.R.Organization != nil { - PublicreportQuickMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - if len(m.R.Images) > 0 { - PublicreportQuickMods.AddExistingImages(m.R.Images...).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewPublicreportQuickImage(mods ...PublicreportQuickImageMod) *PublicreportQuickImageTemplate { - return f.NewPublicreportQuickImageWithContext(context.Background(), mods...) -} - -func (f *Factory) NewPublicreportQuickImageWithContext(ctx context.Context, mods ...PublicreportQuickImageMod) *PublicreportQuickImageTemplate { - o := &PublicreportQuickImageTemplate{f: f} - - if f != nil { - f.basePublicreportQuickImageMods.Apply(ctx, o) - } - - PublicreportQuickImageModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingPublicreportQuickImage(m *models.PublicreportQuickImage) *PublicreportQuickImageTemplate { - o := &PublicreportQuickImageTemplate{f: f, alreadyPersisted: true} - - o.ImageID = func() int32 { return m.ImageID } - o.QuickID = func() int32 { return m.QuickID } - - ctx := context.Background() - if m.R.Image != nil { - PublicreportQuickImageMods.WithExistingImage(m.R.Image).Apply(ctx, o) - } - if m.R.Quick != nil { - PublicreportQuickImageMods.WithExistingQuick(m.R.Quick).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewPublicreportReportLocation(mods ...PublicreportReportLocationMod) *PublicreportReportLocationTemplate { - return f.NewPublicreportReportLocationWithContext(context.Background(), mods...) -} - -func (f *Factory) NewPublicreportReportLocationWithContext(ctx context.Context, mods ...PublicreportReportLocationMod) *PublicreportReportLocationTemplate { - o := &PublicreportReportLocationTemplate{f: f} - - if f != nil { - f.basePublicreportReportLocationMods.Apply(ctx, o) - } - - PublicreportReportLocationModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingPublicreportReportLocation(m *models.PublicreportReportLocation) *PublicreportReportLocationTemplate { - o := &PublicreportReportLocationTemplate{f: f, alreadyPersisted: true} - - o.ID = func() null.Val[int64] { return m.ID } - o.TableName = func() null.Val[string] { return m.TableName } - o.Address = func() null.Val[string] { return m.Address } - o.Created = func() null.Val[time.Time] { return m.Created } - o.Location = func() null.Val[string] { return m.Location } - o.PublicID = func() null.Val[string] { return m.PublicID } - o.Status = func() null.Val[enums.PublicreportReportstatustype] { return m.Status } - - return o -} - -func (f *Factory) NewPublicreportSubscribeEmail(mods ...PublicreportSubscribeEmailMod) *PublicreportSubscribeEmailTemplate { - return f.NewPublicreportSubscribeEmailWithContext(context.Background(), mods...) -} - -func (f *Factory) NewPublicreportSubscribeEmailWithContext(ctx context.Context, mods ...PublicreportSubscribeEmailMod) *PublicreportSubscribeEmailTemplate { - o := &PublicreportSubscribeEmailTemplate{f: f} - - if f != nil { - f.basePublicreportSubscribeEmailMods.Apply(ctx, o) - } - - PublicreportSubscribeEmailModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingPublicreportSubscribeEmail(m *models.PublicreportSubscribeEmail) *PublicreportSubscribeEmailTemplate { - o := &PublicreportSubscribeEmailTemplate{f: f, alreadyPersisted: true} - - o.Created = func() time.Time { return m.Created } - o.Deleted = func() null.Val[time.Time] { return m.Deleted } - o.EmailAddress = func() string { return m.EmailAddress } - o.ID = func() int32 { return m.ID } - - ctx := context.Background() - if m.R.EmailAddressEmailContact != nil { - PublicreportSubscribeEmailMods.WithExistingEmailAddressEmailContact(m.R.EmailAddressEmailContact).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewPublicreportSubscribePhone(mods ...PublicreportSubscribePhoneMod) *PublicreportSubscribePhoneTemplate { - return f.NewPublicreportSubscribePhoneWithContext(context.Background(), mods...) -} - -func (f *Factory) NewPublicreportSubscribePhoneWithContext(ctx context.Context, mods ...PublicreportSubscribePhoneMod) *PublicreportSubscribePhoneTemplate { - o := &PublicreportSubscribePhoneTemplate{f: f} - - if f != nil { - f.basePublicreportSubscribePhoneMods.Apply(ctx, o) - } - - PublicreportSubscribePhoneModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingPublicreportSubscribePhone(m *models.PublicreportSubscribePhone) *PublicreportSubscribePhoneTemplate { - o := &PublicreportSubscribePhoneTemplate{f: f, alreadyPersisted: true} - - o.Created = func() time.Time { return m.Created } - o.Deleted = func() null.Val[time.Time] { return m.Deleted } - o.ID = func() int32 { return m.ID } - o.PhoneE164 = func() string { return m.PhoneE164 } - - ctx := context.Background() - if m.R.PhoneE164Phone != nil { - PublicreportSubscribePhoneMods.WithExistingPhoneE164Phone(m.R.PhoneE164Phone).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewRasterColumn(mods ...RasterColumnMod) *RasterColumnTemplate { - return f.NewRasterColumnWithContext(context.Background(), mods...) -} - -func (f *Factory) NewRasterColumnWithContext(ctx context.Context, mods ...RasterColumnMod) *RasterColumnTemplate { - o := &RasterColumnTemplate{f: f} - - if f != nil { - f.baseRasterColumnMods.Apply(ctx, o) - } - - RasterColumnModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingRasterColumn(m *models.RasterColumn) *RasterColumnTemplate { - o := &RasterColumnTemplate{f: f, alreadyPersisted: true} - - o.RTableCatalog = func() null.Val[string] { return m.RTableCatalog } - o.RTableSchema = func() null.Val[string] { return m.RTableSchema } - o.RTableName = func() null.Val[string] { return m.RTableName } - o.RRasterColumn = func() null.Val[string] { return m.RRasterColumn } - o.Srid = func() null.Val[int32] { return m.Srid } - o.ScaleX = func() null.Val[float64] { return m.ScaleX } - o.ScaleY = func() null.Val[float64] { return m.ScaleY } - o.BlocksizeX = func() null.Val[int32] { return m.BlocksizeX } - o.BlocksizeY = func() null.Val[int32] { return m.BlocksizeY } - o.SameAlignment = func() null.Val[bool] { return m.SameAlignment } - o.RegularBlocking = func() null.Val[bool] { return m.RegularBlocking } - o.NumBands = func() null.Val[int32] { return m.NumBands } - o.PixelTypes = func() null.Val[pq.StringArray] { return m.PixelTypes } - o.NodataValues = func() null.Val[pq.Float64Array] { return m.NodataValues } - o.OutDB = func() null.Val[pq.BoolArray] { return m.OutDB } - o.Extent = func() null.Val[string] { return m.Extent } - o.SpatialIndex = func() null.Val[bool] { return m.SpatialIndex } - - return o -} - -func (f *Factory) NewRasterOverview(mods ...RasterOverviewMod) *RasterOverviewTemplate { - return f.NewRasterOverviewWithContext(context.Background(), mods...) -} - -func (f *Factory) NewRasterOverviewWithContext(ctx context.Context, mods ...RasterOverviewMod) *RasterOverviewTemplate { - o := &RasterOverviewTemplate{f: f} - - if f != nil { - f.baseRasterOverviewMods.Apply(ctx, o) - } - - RasterOverviewModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingRasterOverview(m *models.RasterOverview) *RasterOverviewTemplate { - o := &RasterOverviewTemplate{f: f, alreadyPersisted: true} - - o.OTableCatalog = func() null.Val[string] { return m.OTableCatalog } - o.OTableSchema = func() null.Val[string] { return m.OTableSchema } - o.OTableName = func() null.Val[string] { return m.OTableName } - o.ORasterColumn = func() null.Val[string] { return m.ORasterColumn } - o.RTableCatalog = func() null.Val[string] { return m.RTableCatalog } - o.RTableSchema = func() null.Val[string] { return m.RTableSchema } - o.RTableName = func() null.Val[string] { return m.RTableName } - o.RRasterColumn = func() null.Val[string] { return m.RRasterColumn } - o.OverviewFactor = func() null.Val[int32] { return m.OverviewFactor } - - return o -} - -func (f *Factory) NewResident(mods ...ResidentMod) *ResidentTemplate { - return f.NewResidentWithContext(context.Background(), mods...) -} - -func (f *Factory) NewResidentWithContext(ctx context.Context, mods ...ResidentMod) *ResidentTemplate { - o := &ResidentTemplate{f: f} - - if f != nil { - f.baseResidentMods.Apply(ctx, o) - } - - ResidentModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingResident(m *models.Resident) *ResidentTemplate { - o := &ResidentTemplate{f: f, alreadyPersisted: true} - - o.AddressID = func() int32 { return m.AddressID } - o.Created = func() time.Time { return m.Created } - o.Creator = func() int32 { return m.Creator } - o.ID = func() int32 { return m.ID } - o.Name = func() string { return m.Name } - o.PhoneMobile = func() null.Val[string] { return m.PhoneMobile } - o.SiteID = func() int32 { return m.SiteID } - o.SiteVersion = func() int32 { return m.SiteVersion } - - ctx := context.Background() - if m.R.Address != nil { - ResidentMods.WithExistingAddress(m.R.Address).Apply(ctx, o) - } - if m.R.CreatorUser != nil { - ResidentMods.WithExistingCreatorUser(m.R.CreatorUser).Apply(ctx, o) - } - if m.R.PhoneMobilePhone != nil { - ResidentMods.WithExistingPhoneMobilePhone(m.R.PhoneMobilePhone).Apply(ctx, o) - } - if m.R.Site != nil { - ResidentMods.WithExistingSite(m.R.Site).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewSession(mods ...SessionMod) *SessionTemplate { - return f.NewSessionWithContext(context.Background(), mods...) -} - -func (f *Factory) NewSessionWithContext(ctx context.Context, mods ...SessionMod) *SessionTemplate { - o := &SessionTemplate{f: f} - - if f != nil { - f.baseSessionMods.Apply(ctx, o) - } - - SessionModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingSession(m *models.Session) *SessionTemplate { - o := &SessionTemplate{f: f, alreadyPersisted: true} - - o.Token = func() string { return m.Token } - o.Data = func() []byte { return m.Data } - o.Expiry = func() time.Time { return m.Expiry } - - return o -} - -func (f *Factory) NewSignal(mods ...SignalMod) *SignalTemplate { - return f.NewSignalWithContext(context.Background(), mods...) -} - -func (f *Factory) NewSignalWithContext(ctx context.Context, mods ...SignalMod) *SignalTemplate { - o := &SignalTemplate{f: f} - - if f != nil { - f.baseSignalMods.Apply(ctx, o) - } - - SignalModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingSignal(m *models.Signal) *SignalTemplate { - o := &SignalTemplate{f: f, alreadyPersisted: true} - - o.Addressed = func() null.Val[time.Time] { return m.Addressed } - o.Addressor = func() null.Val[int32] { return m.Addressor } - o.Created = func() time.Time { return m.Created } - o.Creator = func() int32 { return m.Creator } - o.ID = func() int32 { return m.ID } - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Species = func() null.Val[enums.Mosquitospecies] { return m.Species } - o.Title = func() string { return m.Title } - o.Type = func() enums.Signaltype { return m.Type } - - ctx := context.Background() - if m.R.AddressorUser != nil { - SignalMods.WithExistingAddressorUser(m.R.AddressorUser).Apply(ctx, o) - } - if m.R.CreatorUser != nil { - SignalMods.WithExistingCreatorUser(m.R.CreatorUser).Apply(ctx, o) - } - if m.R.Organization != nil { - SignalMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - if len(m.R.SignalPools) > 0 { - SignalMods.AddExistingSignalPools(m.R.SignalPools...).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewSignalPool(mods ...SignalPoolMod) *SignalPoolTemplate { - return f.NewSignalPoolWithContext(context.Background(), mods...) -} - -func (f *Factory) NewSignalPoolWithContext(ctx context.Context, mods ...SignalPoolMod) *SignalPoolTemplate { - o := &SignalPoolTemplate{f: f} - - if f != nil { - f.baseSignalPoolMods.Apply(ctx, o) - } - - SignalPoolModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingSignalPool(m *models.SignalPool) *SignalPoolTemplate { - o := &SignalPoolTemplate{f: f, alreadyPersisted: true} - - o.PoolID = func() int32 { return m.PoolID } - o.SignalID = func() int32 { return m.SignalID } - - ctx := context.Background() - if m.R.Pool != nil { - SignalPoolMods.WithExistingPool(m.R.Pool).Apply(ctx, o) - } - if m.R.Signal != nil { - SignalPoolMods.WithExistingSignal(m.R.Signal).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewSite(mods ...SiteMod) *SiteTemplate { - return f.NewSiteWithContext(context.Background(), mods...) -} - -func (f *Factory) NewSiteWithContext(ctx context.Context, mods ...SiteMod) *SiteTemplate { - o := &SiteTemplate{f: f} - - if f != nil { - f.baseSiteMods.Apply(ctx, o) - } - - SiteModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingSite(m *models.Site) *SiteTemplate { - o := &SiteTemplate{f: f, alreadyPersisted: true} - - o.AddressID = func() int32 { return m.AddressID } - o.Created = func() time.Time { return m.Created } - o.CreatorID = func() int32 { return m.CreatorID } - o.FileID = func() null.Val[int32] { return m.FileID } - o.ID = func() int32 { return m.ID } - o.Notes = func() string { return m.Notes } - o.OrganizationID = func() int32 { return m.OrganizationID } - o.OwnerName = func() string { return m.OwnerName } - o.OwnerPhoneE164 = func() null.Val[string] { return m.OwnerPhoneE164 } - o.ParcelID = func() null.Val[int32] { return m.ParcelID } - o.ResidentOwned = func() null.Val[bool] { return m.ResidentOwned } - o.Tags = func() pgtypes.HStore { return m.Tags } - o.Version = func() int32 { return m.Version } - - ctx := context.Background() - if len(m.R.Leads) > 0 { - SiteMods.AddExistingLeads(m.R.Leads...).Apply(ctx, o) - } - if len(m.R.Pools) > 0 { - SiteMods.AddExistingPools(m.R.Pools...).Apply(ctx, o) - } - if len(m.R.Residents) > 0 { - SiteMods.AddExistingResidents(m.R.Residents...).Apply(ctx, o) - } - if m.R.Address != nil { - SiteMods.WithExistingAddress(m.R.Address).Apply(ctx, o) - } - if m.R.CreatorUser != nil { - SiteMods.WithExistingCreatorUser(m.R.CreatorUser).Apply(ctx, o) - } - if m.R.File != nil { - SiteMods.WithExistingFile(m.R.File).Apply(ctx, o) - } - if m.R.Parcel != nil { - SiteMods.WithExistingParcel(m.R.Parcel).Apply(ctx, o) - } - - return o -} - -func (f *Factory) NewSpatialRefSy(mods ...SpatialRefSyMod) *SpatialRefSyTemplate { - return f.NewSpatialRefSyWithContext(context.Background(), mods...) -} - -func (f *Factory) NewSpatialRefSyWithContext(ctx context.Context, mods ...SpatialRefSyMod) *SpatialRefSyTemplate { - o := &SpatialRefSyTemplate{f: f} - - if f != nil { - f.baseSpatialRefSyMods.Apply(ctx, o) - } - - SpatialRefSyModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingSpatialRefSy(m *models.SpatialRefSy) *SpatialRefSyTemplate { - o := &SpatialRefSyTemplate{f: f, alreadyPersisted: true} - - o.Srid = func() int32 { return m.Srid } - o.AuthName = func() null.Val[string] { return m.AuthName } - o.AuthSrid = func() null.Val[int32] { return m.AuthSrid } - o.Srtext = func() null.Val[string] { return m.Srtext } - o.Proj4text = func() null.Val[string] { return m.Proj4text } - - return o -} - -func (f *Factory) NewUser(mods ...UserMod) *UserTemplate { - return f.NewUserWithContext(context.Background(), mods...) -} - -func (f *Factory) NewUserWithContext(ctx context.Context, mods ...UserMod) *UserTemplate { - o := &UserTemplate{f: f} - - if f != nil { - f.baseUserMods.Apply(ctx, o) - } - - UserModSlice(mods).Apply(ctx, o) - - return o -} - -func (f *Factory) FromExistingUser(m *models.User) *UserTemplate { - o := &UserTemplate{f: f, alreadyPersisted: true} - - o.ID = func() int32 { return m.ID } - o.ArcgisAccessToken = func() null.Val[string] { return m.ArcgisAccessToken } - o.ArcgisLicense = func() null.Val[enums.Arcgislicensetype] { return m.ArcgisLicense } - o.ArcgisRefreshToken = func() null.Val[string] { return m.ArcgisRefreshToken } - o.ArcgisRefreshTokenExpires = func() null.Val[time.Time] { return m.ArcgisRefreshTokenExpires } - o.ArcgisRole = func() null.Val[string] { return m.ArcgisRole } - o.DisplayName = func() string { return m.DisplayName } - o.Email = func() null.Val[string] { return m.Email } - o.OrganizationID = func() int32 { return m.OrganizationID } - o.Username = func() string { return m.Username } - o.PasswordHashType = func() enums.Hashtype { return m.PasswordHashType } - o.PasswordHash = func() string { return m.PasswordHash } - o.Role = func() enums.Userrole { return m.Role } - - ctx := context.Background() - if len(m.R.UserOauthTokens) > 0 { - UserMods.AddExistingUserOauthTokens(m.R.UserOauthTokens...).Apply(ctx, o) - } - if len(m.R.PublicUserUser) > 0 { - UserMods.AddExistingPublicUserUser(m.R.PublicUserUser...).Apply(ctx, o) - } - if len(m.R.CreatorComplianceReportRequests) > 0 { - UserMods.AddExistingCreatorComplianceReportRequests(m.R.CreatorComplianceReportRequests...).Apply(ctx, o) - } - if len(m.R.CommitterFiles) > 0 { - UserMods.AddExistingCommitterFiles(m.R.CommitterFiles...).Apply(ctx, o) - } - if len(m.R.CreatorFiles) > 0 { - UserMods.AddExistingCreatorFiles(m.R.CreatorFiles...).Apply(ctx, o) - } - if len(m.R.FileuploadPool) > 0 { - UserMods.AddExistingFileuploadPool(m.R.FileuploadPool...).Apply(ctx, o) - } - if len(m.R.CreatorLeads) > 0 { - UserMods.AddExistingCreatorLeads(m.R.CreatorLeads...).Apply(ctx, o) - } - 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) - } - if len(m.R.CreatorPools) > 0 { - UserMods.AddExistingCreatorPools(m.R.CreatorPools...).Apply(ctx, o) - } - if len(m.R.CreatorResidents) > 0 { - UserMods.AddExistingCreatorResidents(m.R.CreatorResidents...).Apply(ctx, o) - } - if len(m.R.AddressorSignals) > 0 { - UserMods.AddExistingAddressorSignals(m.R.AddressorSignals...).Apply(ctx, o) - } - if len(m.R.CreatorSignals) > 0 { - UserMods.AddExistingCreatorSignals(m.R.CreatorSignals...).Apply(ctx, o) - } - if len(m.R.CreatorSites) > 0 { - UserMods.AddExistingCreatorSites(m.R.CreatorSites...).Apply(ctx, o) - } - if m.R.Organization != nil { - UserMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o) - } - - return o -} - -func (f *Factory) ClearBaseAddressMods() { - f.baseAddressMods = nil -} - -func (f *Factory) AddBaseAddressMod(mods ...AddressMod) { - f.baseAddressMods = append(f.baseAddressMods, mods...) -} - -func (f *Factory) ClearBaseArcgisAccountMods() { - f.baseArcgisAccountMods = nil -} - -func (f *Factory) AddBaseArcgisAccountMod(mods ...ArcgisAccountMod) { - f.baseArcgisAccountMods = append(f.baseArcgisAccountMods, mods...) -} - -func (f *Factory) ClearBaseArcgisAddressMappingMods() { - f.baseArcgisAddressMappingMods = nil -} - -func (f *Factory) AddBaseArcgisAddressMappingMod(mods ...ArcgisAddressMappingMod) { - f.baseArcgisAddressMappingMods = append(f.baseArcgisAddressMappingMods, mods...) -} - -func (f *Factory) ClearBaseArcgisLayerMods() { - f.baseArcgisLayerMods = nil -} - -func (f *Factory) AddBaseArcgisLayerMod(mods ...ArcgisLayerMod) { - f.baseArcgisLayerMods = append(f.baseArcgisLayerMods, mods...) -} - -func (f *Factory) ClearBaseArcgisLayerFieldMods() { - f.baseArcgisLayerFieldMods = nil -} - -func (f *Factory) AddBaseArcgisLayerFieldMod(mods ...ArcgisLayerFieldMod) { - f.baseArcgisLayerFieldMods = append(f.baseArcgisLayerFieldMods, mods...) -} - -func (f *Factory) ClearBaseArcgisOauthTokenMods() { - f.baseArcgisOauthTokenMods = nil -} - -func (f *Factory) AddBaseArcgisOauthTokenMod(mods ...ArcgisOauthTokenMod) { - f.baseArcgisOauthTokenMods = append(f.baseArcgisOauthTokenMods, mods...) -} - -func (f *Factory) ClearBaseArcgisParcelMappingMods() { - f.baseArcgisParcelMappingMods = nil -} - -func (f *Factory) AddBaseArcgisParcelMappingMod(mods ...ArcgisParcelMappingMod) { - f.baseArcgisParcelMappingMods = append(f.baseArcgisParcelMappingMods, mods...) -} - -func (f *Factory) ClearBaseArcgisServiceFeatureMods() { - f.baseArcgisServiceFeatureMods = nil -} - -func (f *Factory) AddBaseArcgisServiceFeatureMod(mods ...ArcgisServiceFeatureMod) { - f.baseArcgisServiceFeatureMods = append(f.baseArcgisServiceFeatureMods, mods...) -} - -func (f *Factory) ClearBaseArcgisServiceMapMods() { - f.baseArcgisServiceMapMods = nil -} - -func (f *Factory) AddBaseArcgisServiceMapMod(mods ...ArcgisServiceMapMod) { - f.baseArcgisServiceMapMods = append(f.baseArcgisServiceMapMods, mods...) -} - -func (f *Factory) ClearBaseArcgisUserMods() { - f.baseArcgisUserMods = nil -} - -func (f *Factory) AddBaseArcgisUserMod(mods ...ArcgisUserMod) { - f.baseArcgisUserMods = append(f.baseArcgisUserMods, mods...) -} - -func (f *Factory) ClearBaseArcgisUserPrivilegeMods() { - f.baseArcgisUserPrivilegeMods = nil -} - -func (f *Factory) AddBaseArcgisUserPrivilegeMod(mods ...ArcgisUserPrivilegeMod) { - f.baseArcgisUserPrivilegeMods = append(f.baseArcgisUserPrivilegeMods, mods...) -} - -func (f *Factory) ClearBaseCommsEmailContactMods() { - f.baseCommsEmailContactMods = nil -} - -func (f *Factory) AddBaseCommsEmailContactMod(mods ...CommsEmailContactMod) { - f.baseCommsEmailContactMods = append(f.baseCommsEmailContactMods, mods...) -} - -func (f *Factory) ClearBaseCommsEmailLogMods() { - f.baseCommsEmailLogMods = nil -} - -func (f *Factory) AddBaseCommsEmailLogMod(mods ...CommsEmailLogMod) { - f.baseCommsEmailLogMods = append(f.baseCommsEmailLogMods, mods...) -} - -func (f *Factory) ClearBaseCommsEmailTemplateMods() { - f.baseCommsEmailTemplateMods = nil -} - -func (f *Factory) AddBaseCommsEmailTemplateMod(mods ...CommsEmailTemplateMod) { - f.baseCommsEmailTemplateMods = append(f.baseCommsEmailTemplateMods, mods...) -} - -func (f *Factory) ClearBaseCommsMailerMods() { - f.baseCommsMailerMods = nil -} - -func (f *Factory) AddBaseCommsMailerMod(mods ...CommsMailerMod) { - f.baseCommsMailerMods = append(f.baseCommsMailerMods, mods...) -} - -func (f *Factory) ClearBaseCommsPhoneMods() { - f.baseCommsPhoneMods = nil -} - -func (f *Factory) AddBaseCommsPhoneMod(mods ...CommsPhoneMod) { - f.baseCommsPhoneMods = append(f.baseCommsPhoneMods, mods...) -} - -func (f *Factory) ClearBaseCommsTextJobMods() { - f.baseCommsTextJobMods = nil -} - -func (f *Factory) AddBaseCommsTextJobMod(mods ...CommsTextJobMod) { - f.baseCommsTextJobMods = append(f.baseCommsTextJobMods, mods...) -} - -func (f *Factory) ClearBaseCommsTextLogMods() { - f.baseCommsTextLogMods = nil -} - -func (f *Factory) AddBaseCommsTextLogMod(mods ...CommsTextLogMod) { - f.baseCommsTextLogMods = append(f.baseCommsTextLogMods, mods...) -} - -func (f *Factory) ClearBaseComplianceReportRequestMods() { - f.baseComplianceReportRequestMods = nil -} - -func (f *Factory) AddBaseComplianceReportRequestMod(mods ...ComplianceReportRequestMod) { - f.baseComplianceReportRequestMods = append(f.baseComplianceReportRequestMods, mods...) -} - -func (f *Factory) ClearBaseComplianceReportRequestMailerMods() { - f.baseComplianceReportRequestMailerMods = nil -} - -func (f *Factory) AddBaseComplianceReportRequestMailerMod(mods ...ComplianceReportRequestMailerMod) { - f.baseComplianceReportRequestMailerMods = append(f.baseComplianceReportRequestMailerMods, mods...) -} - -func (f *Factory) ClearBaseDistrictSubscriptionEmailMods() { - f.baseDistrictSubscriptionEmailMods = nil -} - -func (f *Factory) AddBaseDistrictSubscriptionEmailMod(mods ...DistrictSubscriptionEmailMod) { - f.baseDistrictSubscriptionEmailMods = append(f.baseDistrictSubscriptionEmailMods, mods...) -} - -func (f *Factory) ClearBaseDistrictSubscriptionPhoneMods() { - f.baseDistrictSubscriptionPhoneMods = nil -} - -func (f *Factory) AddBaseDistrictSubscriptionPhoneMod(mods ...DistrictSubscriptionPhoneMod) { - f.baseDistrictSubscriptionPhoneMods = append(f.baseDistrictSubscriptionPhoneMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerContainerrelateMods() { - f.baseFieldseekerContainerrelateMods = nil -} - -func (f *Factory) AddBaseFieldseekerContainerrelateMod(mods ...FieldseekerContainerrelateMod) { - f.baseFieldseekerContainerrelateMods = append(f.baseFieldseekerContainerrelateMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerFieldscoutinglogMods() { - f.baseFieldseekerFieldscoutinglogMods = nil -} - -func (f *Factory) AddBaseFieldseekerFieldscoutinglogMod(mods ...FieldseekerFieldscoutinglogMod) { - f.baseFieldseekerFieldscoutinglogMods = append(f.baseFieldseekerFieldscoutinglogMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerHabitatrelateMods() { - f.baseFieldseekerHabitatrelateMods = nil -} - -func (f *Factory) AddBaseFieldseekerHabitatrelateMod(mods ...FieldseekerHabitatrelateMod) { - f.baseFieldseekerHabitatrelateMods = append(f.baseFieldseekerHabitatrelateMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerInspectionsampleMods() { - f.baseFieldseekerInspectionsampleMods = nil -} - -func (f *Factory) AddBaseFieldseekerInspectionsampleMod(mods ...FieldseekerInspectionsampleMod) { - f.baseFieldseekerInspectionsampleMods = append(f.baseFieldseekerInspectionsampleMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerInspectionsampledetailMods() { - f.baseFieldseekerInspectionsampledetailMods = nil -} - -func (f *Factory) AddBaseFieldseekerInspectionsampledetailMod(mods ...FieldseekerInspectionsampledetailMod) { - f.baseFieldseekerInspectionsampledetailMods = append(f.baseFieldseekerInspectionsampledetailMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerLinelocationMods() { - f.baseFieldseekerLinelocationMods = nil -} - -func (f *Factory) AddBaseFieldseekerLinelocationMod(mods ...FieldseekerLinelocationMod) { - f.baseFieldseekerLinelocationMods = append(f.baseFieldseekerLinelocationMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerLocationtrackingMods() { - f.baseFieldseekerLocationtrackingMods = nil -} - -func (f *Factory) AddBaseFieldseekerLocationtrackingMod(mods ...FieldseekerLocationtrackingMod) { - f.baseFieldseekerLocationtrackingMods = append(f.baseFieldseekerLocationtrackingMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerMosquitoinspectionMods() { - f.baseFieldseekerMosquitoinspectionMods = nil -} - -func (f *Factory) AddBaseFieldseekerMosquitoinspectionMod(mods ...FieldseekerMosquitoinspectionMod) { - f.baseFieldseekerMosquitoinspectionMods = append(f.baseFieldseekerMosquitoinspectionMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerPointlocationMods() { - f.baseFieldseekerPointlocationMods = nil -} - -func (f *Factory) AddBaseFieldseekerPointlocationMod(mods ...FieldseekerPointlocationMod) { - f.baseFieldseekerPointlocationMods = append(f.baseFieldseekerPointlocationMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerPolygonlocationMods() { - f.baseFieldseekerPolygonlocationMods = nil -} - -func (f *Factory) AddBaseFieldseekerPolygonlocationMod(mods ...FieldseekerPolygonlocationMod) { - f.baseFieldseekerPolygonlocationMods = append(f.baseFieldseekerPolygonlocationMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerPoolMods() { - f.baseFieldseekerPoolMods = nil -} - -func (f *Factory) AddBaseFieldseekerPoolMod(mods ...FieldseekerPoolMod) { - f.baseFieldseekerPoolMods = append(f.baseFieldseekerPoolMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerPooldetailMods() { - f.baseFieldseekerPooldetailMods = nil -} - -func (f *Factory) AddBaseFieldseekerPooldetailMod(mods ...FieldseekerPooldetailMod) { - f.baseFieldseekerPooldetailMods = append(f.baseFieldseekerPooldetailMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerProposedtreatmentareaMods() { - f.baseFieldseekerProposedtreatmentareaMods = nil -} - -func (f *Factory) AddBaseFieldseekerProposedtreatmentareaMod(mods ...FieldseekerProposedtreatmentareaMod) { - f.baseFieldseekerProposedtreatmentareaMods = append(f.baseFieldseekerProposedtreatmentareaMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerQamosquitoinspectionMods() { - f.baseFieldseekerQamosquitoinspectionMods = nil -} - -func (f *Factory) AddBaseFieldseekerQamosquitoinspectionMod(mods ...FieldseekerQamosquitoinspectionMod) { - f.baseFieldseekerQamosquitoinspectionMods = append(f.baseFieldseekerQamosquitoinspectionMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerRodentlocationMods() { - f.baseFieldseekerRodentlocationMods = nil -} - -func (f *Factory) AddBaseFieldseekerRodentlocationMod(mods ...FieldseekerRodentlocationMod) { - f.baseFieldseekerRodentlocationMods = append(f.baseFieldseekerRodentlocationMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerSamplecollectionMods() { - f.baseFieldseekerSamplecollectionMods = nil -} - -func (f *Factory) AddBaseFieldseekerSamplecollectionMod(mods ...FieldseekerSamplecollectionMod) { - f.baseFieldseekerSamplecollectionMods = append(f.baseFieldseekerSamplecollectionMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerSamplelocationMods() { - f.baseFieldseekerSamplelocationMods = nil -} - -func (f *Factory) AddBaseFieldseekerSamplelocationMod(mods ...FieldseekerSamplelocationMod) { - f.baseFieldseekerSamplelocationMods = append(f.baseFieldseekerSamplelocationMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerServicerequestMods() { - f.baseFieldseekerServicerequestMods = nil -} - -func (f *Factory) AddBaseFieldseekerServicerequestMod(mods ...FieldseekerServicerequestMod) { - f.baseFieldseekerServicerequestMods = append(f.baseFieldseekerServicerequestMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerSpeciesabundanceMods() { - f.baseFieldseekerSpeciesabundanceMods = nil -} - -func (f *Factory) AddBaseFieldseekerSpeciesabundanceMod(mods ...FieldseekerSpeciesabundanceMod) { - f.baseFieldseekerSpeciesabundanceMods = append(f.baseFieldseekerSpeciesabundanceMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerStormdrainMods() { - f.baseFieldseekerStormdrainMods = nil -} - -func (f *Factory) AddBaseFieldseekerStormdrainMod(mods ...FieldseekerStormdrainMod) { - f.baseFieldseekerStormdrainMods = append(f.baseFieldseekerStormdrainMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerTimecardMods() { - f.baseFieldseekerTimecardMods = nil -} - -func (f *Factory) AddBaseFieldseekerTimecardMod(mods ...FieldseekerTimecardMod) { - f.baseFieldseekerTimecardMods = append(f.baseFieldseekerTimecardMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerTrapdatumMods() { - f.baseFieldseekerTrapdatumMods = nil -} - -func (f *Factory) AddBaseFieldseekerTrapdatumMod(mods ...FieldseekerTrapdatumMod) { - f.baseFieldseekerTrapdatumMods = append(f.baseFieldseekerTrapdatumMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerTraplocationMods() { - f.baseFieldseekerTraplocationMods = nil -} - -func (f *Factory) AddBaseFieldseekerTraplocationMod(mods ...FieldseekerTraplocationMod) { - f.baseFieldseekerTraplocationMods = append(f.baseFieldseekerTraplocationMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerTreatmentMods() { - f.baseFieldseekerTreatmentMods = nil -} - -func (f *Factory) AddBaseFieldseekerTreatmentMod(mods ...FieldseekerTreatmentMod) { - f.baseFieldseekerTreatmentMods = append(f.baseFieldseekerTreatmentMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerTreatmentareaMods() { - f.baseFieldseekerTreatmentareaMods = nil -} - -func (f *Factory) AddBaseFieldseekerTreatmentareaMod(mods ...FieldseekerTreatmentareaMod) { - f.baseFieldseekerTreatmentareaMods = append(f.baseFieldseekerTreatmentareaMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerZoneMods() { - f.baseFieldseekerZoneMods = nil -} - -func (f *Factory) AddBaseFieldseekerZoneMod(mods ...FieldseekerZoneMod) { - f.baseFieldseekerZoneMods = append(f.baseFieldseekerZoneMods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerZones2Mods() { - f.baseFieldseekerZones2Mods = nil -} - -func (f *Factory) AddBaseFieldseekerZones2Mod(mods ...FieldseekerZones2Mod) { - f.baseFieldseekerZones2Mods = append(f.baseFieldseekerZones2Mods, mods...) -} - -func (f *Factory) ClearBaseFieldseekerSyncMods() { - f.baseFieldseekerSyncMods = nil -} - -func (f *Factory) AddBaseFieldseekerSyncMod(mods ...FieldseekerSyncMod) { - f.baseFieldseekerSyncMods = append(f.baseFieldseekerSyncMods, mods...) -} - -func (f *Factory) ClearBaseFileuploadCSVMods() { - f.baseFileuploadCSVMods = nil -} - -func (f *Factory) AddBaseFileuploadCSVMod(mods ...FileuploadCSVMod) { - f.baseFileuploadCSVMods = append(f.baseFileuploadCSVMods, mods...) -} - -func (f *Factory) ClearBaseFileuploadErrorCSVMods() { - f.baseFileuploadErrorCSVMods = nil -} - -func (f *Factory) AddBaseFileuploadErrorCSVMod(mods ...FileuploadErrorCSVMod) { - f.baseFileuploadErrorCSVMods = append(f.baseFileuploadErrorCSVMods, mods...) -} - -func (f *Factory) ClearBaseFileuploadErrorFileMods() { - f.baseFileuploadErrorFileMods = nil -} - -func (f *Factory) AddBaseFileuploadErrorFileMod(mods ...FileuploadErrorFileMod) { - f.baseFileuploadErrorFileMods = append(f.baseFileuploadErrorFileMods, mods...) -} - -func (f *Factory) ClearBaseFileuploadFileMods() { - f.baseFileuploadFileMods = nil -} - -func (f *Factory) AddBaseFileuploadFileMod(mods ...FileuploadFileMod) { - f.baseFileuploadFileMods = append(f.baseFileuploadFileMods, mods...) -} - -func (f *Factory) ClearBaseFileuploadPoolMods() { - f.baseFileuploadPoolMods = nil -} - -func (f *Factory) AddBaseFileuploadPoolMod(mods ...FileuploadPoolMod) { - f.baseFileuploadPoolMods = append(f.baseFileuploadPoolMods, mods...) -} - -func (f *Factory) ClearBaseGeographyColumnMods() { - f.baseGeographyColumnMods = nil -} - -func (f *Factory) AddBaseGeographyColumnMod(mods ...GeographyColumnMod) { - f.baseGeographyColumnMods = append(f.baseGeographyColumnMods, mods...) -} - -func (f *Factory) ClearBaseGeometryColumnMods() { - f.baseGeometryColumnMods = nil -} - -func (f *Factory) AddBaseGeometryColumnMod(mods ...GeometryColumnMod) { - f.baseGeometryColumnMods = append(f.baseGeometryColumnMods, mods...) -} - -func (f *Factory) ClearBaseGooseDBVersionMods() { - f.baseGooseDBVersionMods = nil -} - -func (f *Factory) AddBaseGooseDBVersionMod(mods ...GooseDBVersionMod) { - f.baseGooseDBVersionMods = append(f.baseGooseDBVersionMods, mods...) -} - -func (f *Factory) ClearBaseH3AggregationMods() { - f.baseH3AggregationMods = nil -} - -func (f *Factory) AddBaseH3AggregationMod(mods ...H3AggregationMod) { - f.baseH3AggregationMods = append(f.baseH3AggregationMods, mods...) -} - -func (f *Factory) ClearBaseLeadMods() { - f.baseLeadMods = nil -} - -func (f *Factory) AddBaseLeadMod(mods ...LeadMod) { - f.baseLeadMods = append(f.baseLeadMods, mods...) -} - -func (f *Factory) ClearBaseNoteAudioMods() { - f.baseNoteAudioMods = nil -} - -func (f *Factory) AddBaseNoteAudioMod(mods ...NoteAudioMod) { - f.baseNoteAudioMods = append(f.baseNoteAudioMods, mods...) -} - -func (f *Factory) ClearBaseNoteAudioBreadcrumbMods() { - f.baseNoteAudioBreadcrumbMods = nil -} - -func (f *Factory) AddBaseNoteAudioBreadcrumbMod(mods ...NoteAudioBreadcrumbMod) { - f.baseNoteAudioBreadcrumbMods = append(f.baseNoteAudioBreadcrumbMods, mods...) -} - -func (f *Factory) ClearBaseNoteAudioDatumMods() { - f.baseNoteAudioDatumMods = nil -} - -func (f *Factory) AddBaseNoteAudioDatumMod(mods ...NoteAudioDatumMod) { - f.baseNoteAudioDatumMods = append(f.baseNoteAudioDatumMods, mods...) -} - -func (f *Factory) ClearBaseNoteImageMods() { - f.baseNoteImageMods = nil -} - -func (f *Factory) AddBaseNoteImageMod(mods ...NoteImageMod) { - f.baseNoteImageMods = append(f.baseNoteImageMods, mods...) -} - -func (f *Factory) ClearBaseNoteImageBreadcrumbMods() { - f.baseNoteImageBreadcrumbMods = nil -} - -func (f *Factory) AddBaseNoteImageBreadcrumbMod(mods ...NoteImageBreadcrumbMod) { - f.baseNoteImageBreadcrumbMods = append(f.baseNoteImageBreadcrumbMods, mods...) -} - -func (f *Factory) ClearBaseNoteImageDatumMods() { - f.baseNoteImageDatumMods = nil -} - -func (f *Factory) AddBaseNoteImageDatumMod(mods ...NoteImageDatumMod) { - f.baseNoteImageDatumMods = append(f.baseNoteImageDatumMods, mods...) -} - -func (f *Factory) ClearBaseNotificationMods() { - f.baseNotificationMods = nil -} - -func (f *Factory) AddBaseNotificationMod(mods ...NotificationMod) { - f.baseNotificationMods = append(f.baseNotificationMods, mods...) -} - -func (f *Factory) ClearBaseOrganizationMods() { - f.baseOrganizationMods = nil -} - -func (f *Factory) AddBaseOrganizationMod(mods ...OrganizationMod) { - f.baseOrganizationMods = append(f.baseOrganizationMods, mods...) -} - -func (f *Factory) ClearBaseParcelMods() { - f.baseParcelMods = nil -} - -func (f *Factory) AddBaseParcelMod(mods ...ParcelMod) { - f.baseParcelMods = append(f.baseParcelMods, mods...) -} - -func (f *Factory) ClearBasePoolMods() { - f.basePoolMods = nil -} - -func (f *Factory) AddBasePoolMod(mods ...PoolMod) { - f.basePoolMods = append(f.basePoolMods, mods...) -} - -func (f *Factory) ClearBasePublicreportImageMods() { - f.basePublicreportImageMods = nil -} - -func (f *Factory) AddBasePublicreportImageMod(mods ...PublicreportImageMod) { - f.basePublicreportImageMods = append(f.basePublicreportImageMods, mods...) -} - -func (f *Factory) ClearBasePublicreportImageExifMods() { - f.basePublicreportImageExifMods = nil -} - -func (f *Factory) AddBasePublicreportImageExifMod(mods ...PublicreportImageExifMod) { - f.basePublicreportImageExifMods = append(f.basePublicreportImageExifMods, mods...) -} - -func (f *Factory) ClearBasePublicreportNotifyEmailNuisanceMods() { - f.basePublicreportNotifyEmailNuisanceMods = nil -} - -func (f *Factory) AddBasePublicreportNotifyEmailNuisanceMod(mods ...PublicreportNotifyEmailNuisanceMod) { - f.basePublicreportNotifyEmailNuisanceMods = append(f.basePublicreportNotifyEmailNuisanceMods, mods...) -} - -func (f *Factory) ClearBasePublicreportNotifyEmailPoolMods() { - f.basePublicreportNotifyEmailPoolMods = nil -} - -func (f *Factory) AddBasePublicreportNotifyEmailPoolMod(mods ...PublicreportNotifyEmailPoolMod) { - f.basePublicreportNotifyEmailPoolMods = append(f.basePublicreportNotifyEmailPoolMods, mods...) -} - -func (f *Factory) ClearBasePublicreportNotifyPhoneNuisanceMods() { - f.basePublicreportNotifyPhoneNuisanceMods = nil -} - -func (f *Factory) AddBasePublicreportNotifyPhoneNuisanceMod(mods ...PublicreportNotifyPhoneNuisanceMod) { - f.basePublicreportNotifyPhoneNuisanceMods = append(f.basePublicreportNotifyPhoneNuisanceMods, mods...) -} - -func (f *Factory) ClearBasePublicreportNotifyPhonePoolMods() { - f.basePublicreportNotifyPhonePoolMods = nil -} - -func (f *Factory) AddBasePublicreportNotifyPhonePoolMod(mods ...PublicreportNotifyPhonePoolMod) { - f.basePublicreportNotifyPhonePoolMods = append(f.basePublicreportNotifyPhonePoolMods, mods...) -} - -func (f *Factory) ClearBasePublicreportNuisanceMods() { - f.basePublicreportNuisanceMods = nil -} - -func (f *Factory) AddBasePublicreportNuisanceMod(mods ...PublicreportNuisanceMod) { - f.basePublicreportNuisanceMods = append(f.basePublicreportNuisanceMods, mods...) -} - -func (f *Factory) ClearBasePublicreportNuisanceImageMods() { - f.basePublicreportNuisanceImageMods = nil -} - -func (f *Factory) AddBasePublicreportNuisanceImageMod(mods ...PublicreportNuisanceImageMod) { - f.basePublicreportNuisanceImageMods = append(f.basePublicreportNuisanceImageMods, mods...) -} - -func (f *Factory) ClearBasePublicreportPoolMods() { - f.basePublicreportPoolMods = nil -} - -func (f *Factory) AddBasePublicreportPoolMod(mods ...PublicreportPoolMod) { - f.basePublicreportPoolMods = append(f.basePublicreportPoolMods, mods...) -} - -func (f *Factory) ClearBasePublicreportPoolImageMods() { - f.basePublicreportPoolImageMods = nil -} - -func (f *Factory) AddBasePublicreportPoolImageMod(mods ...PublicreportPoolImageMod) { - f.basePublicreportPoolImageMods = append(f.basePublicreportPoolImageMods, mods...) -} - -func (f *Factory) ClearBasePublicreportQuickMods() { - f.basePublicreportQuickMods = nil -} - -func (f *Factory) AddBasePublicreportQuickMod(mods ...PublicreportQuickMod) { - f.basePublicreportQuickMods = append(f.basePublicreportQuickMods, mods...) -} - -func (f *Factory) ClearBasePublicreportQuickImageMods() { - f.basePublicreportQuickImageMods = nil -} - -func (f *Factory) AddBasePublicreportQuickImageMod(mods ...PublicreportQuickImageMod) { - f.basePublicreportQuickImageMods = append(f.basePublicreportQuickImageMods, mods...) -} - -func (f *Factory) ClearBasePublicreportReportLocationMods() { - f.basePublicreportReportLocationMods = nil -} - -func (f *Factory) AddBasePublicreportReportLocationMod(mods ...PublicreportReportLocationMod) { - f.basePublicreportReportLocationMods = append(f.basePublicreportReportLocationMods, mods...) -} - -func (f *Factory) ClearBasePublicreportSubscribeEmailMods() { - f.basePublicreportSubscribeEmailMods = nil -} - -func (f *Factory) AddBasePublicreportSubscribeEmailMod(mods ...PublicreportSubscribeEmailMod) { - f.basePublicreportSubscribeEmailMods = append(f.basePublicreportSubscribeEmailMods, mods...) -} - -func (f *Factory) ClearBasePublicreportSubscribePhoneMods() { - f.basePublicreportSubscribePhoneMods = nil -} - -func (f *Factory) AddBasePublicreportSubscribePhoneMod(mods ...PublicreportSubscribePhoneMod) { - f.basePublicreportSubscribePhoneMods = append(f.basePublicreportSubscribePhoneMods, mods...) -} - -func (f *Factory) ClearBaseRasterColumnMods() { - f.baseRasterColumnMods = nil -} - -func (f *Factory) AddBaseRasterColumnMod(mods ...RasterColumnMod) { - f.baseRasterColumnMods = append(f.baseRasterColumnMods, mods...) -} - -func (f *Factory) ClearBaseRasterOverviewMods() { - f.baseRasterOverviewMods = nil -} - -func (f *Factory) AddBaseRasterOverviewMod(mods ...RasterOverviewMod) { - f.baseRasterOverviewMods = append(f.baseRasterOverviewMods, mods...) -} - -func (f *Factory) ClearBaseResidentMods() { - f.baseResidentMods = nil -} - -func (f *Factory) AddBaseResidentMod(mods ...ResidentMod) { - f.baseResidentMods = append(f.baseResidentMods, mods...) -} - -func (f *Factory) ClearBaseSessionMods() { - f.baseSessionMods = nil -} - -func (f *Factory) AddBaseSessionMod(mods ...SessionMod) { - f.baseSessionMods = append(f.baseSessionMods, mods...) -} - -func (f *Factory) ClearBaseSignalMods() { - f.baseSignalMods = nil -} - -func (f *Factory) AddBaseSignalMod(mods ...SignalMod) { - f.baseSignalMods = append(f.baseSignalMods, mods...) -} - -func (f *Factory) ClearBaseSignalPoolMods() { - f.baseSignalPoolMods = nil -} - -func (f *Factory) AddBaseSignalPoolMod(mods ...SignalPoolMod) { - f.baseSignalPoolMods = append(f.baseSignalPoolMods, mods...) -} - -func (f *Factory) ClearBaseSiteMods() { - f.baseSiteMods = nil -} - -func (f *Factory) AddBaseSiteMod(mods ...SiteMod) { - f.baseSiteMods = append(f.baseSiteMods, mods...) -} - -func (f *Factory) ClearBaseSpatialRefSyMods() { - f.baseSpatialRefSyMods = nil -} - -func (f *Factory) AddBaseSpatialRefSyMod(mods ...SpatialRefSyMod) { - f.baseSpatialRefSyMods = append(f.baseSpatialRefSyMods, mods...) -} - -func (f *Factory) ClearBaseUserMods() { - f.baseUserMods = nil -} - -func (f *Factory) AddBaseUserMod(mods ...UserMod) { - f.baseUserMods = append(f.baseUserMods, mods...) -} diff --git a/db/factory/bobfactory_random.bob.go b/db/factory/bobfactory_random.bob.go deleted file mode 100644 index 11f9ae33..00000000 --- a/db/factory/bobfactory_random.bob.go +++ /dev/null @@ -1,494 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "bytes" - "database/sql" - "encoding/json" - "fmt" - "math" - "strconv" - "strings" - "time" - - "github.com/Gleipnir-Technology/bob/types" - "github.com/Gleipnir-Technology/bob/types/pgtypes" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" - "github.com/google/uuid" - "github.com/jaswdr/faker/v2" - "github.com/lib/pq" - "github.com/shopspring/decimal" -) - -var defaultFaker = faker.New() - -func random___byte(f *faker.Faker, limits ...string) []byte { - if f == nil { - f = &defaultFaker - } - - return []byte(random_string(f, limits...)) -} - -func random_bool(f *faker.Faker, limits ...string) bool { - if f == nil { - f = &defaultFaker - } - - return f.Bool() -} - -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_ArcgisFieldtype(f *faker.Faker, limits ...string) enums.ArcgisFieldtype { - if f == nil { - f = &defaultFaker - } - - var e enums.ArcgisFieldtype - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_ArcgisMappingdestinationaddress(f *faker.Faker, limits ...string) enums.ArcgisMappingdestinationaddress { - if f == nil { - f = &defaultFaker - } - - var e enums.ArcgisMappingdestinationaddress - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_ArcgisMappingdestinationparcel(f *faker.Faker, limits ...string) enums.ArcgisMappingdestinationparcel { - if f == nil { - f = &defaultFaker - } - - var e enums.ArcgisMappingdestinationparcel - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_Arcgislicensetype(f *faker.Faker, limits ...string) enums.Arcgislicensetype { - if f == nil { - f = &defaultFaker - } - - var e enums.Arcgislicensetype - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_Audiodatatype(f *faker.Faker, limits ...string) enums.Audiodatatype { - if f == nil { - f = &defaultFaker - } - - var e enums.Audiodatatype - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_CommsMessagetypeemail(f *faker.Faker, limits ...string) enums.CommsMessagetypeemail { - if f == nil { - f = &defaultFaker - } - - var e enums.CommsMessagetypeemail - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_CommsPhonestatustype(f *faker.Faker, limits ...string) enums.CommsPhonestatustype { - if f == nil { - f = &defaultFaker - } - - var e enums.CommsPhonestatustype - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_CommsTextjobsource(f *faker.Faker, limits ...string) enums.CommsTextjobsource { - if f == nil { - f = &defaultFaker - } - - var e enums.CommsTextjobsource - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_CommsTextjobtype(f *faker.Faker, limits ...string) enums.CommsTextjobtype { - if f == nil { - f = &defaultFaker - } - - var e enums.CommsTextjobtype - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_CommsTextorigin(f *faker.Faker, limits ...string) enums.CommsTextorigin { - if f == nil { - f = &defaultFaker - } - - var e enums.CommsTextorigin - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_Countrytype(f *faker.Faker, limits ...string) enums.Countrytype { - if f == nil { - f = &defaultFaker - } - - var e enums.Countrytype - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FileuploadCsvtype(f *faker.Faker, limits ...string) enums.FileuploadCsvtype { - if f == nil { - f = &defaultFaker - } - - var e enums.FileuploadCsvtype - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_FileuploadFilestatustype(f *faker.Faker, limits ...string) enums.FileuploadFilestatustype { - if f == nil { - f = &defaultFaker - } - - var e enums.FileuploadFilestatustype - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_H3aggregationtype(f *faker.Faker, limits ...string) enums.H3aggregationtype { - if f == nil { - f = &defaultFaker - } - - var e enums.H3aggregationtype - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_Hashtype(f *faker.Faker, limits ...string) enums.Hashtype { - if f == nil { - f = &defaultFaker - } - - var e enums.Hashtype - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_Leadtype(f *faker.Faker, limits ...string) enums.Leadtype { - if f == nil { - f = &defaultFaker - } - - var e enums.Leadtype - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_Mosquitospecies(f *faker.Faker, limits ...string) enums.Mosquitospecies { - if f == nil { - f = &defaultFaker - } - - var e enums.Mosquitospecies - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_Notificationtype(f *faker.Faker, limits ...string) enums.Notificationtype { - if f == nil { - f = &defaultFaker - } - - var e enums.Notificationtype - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_Poolconditiontype(f *faker.Faker, limits ...string) enums.Poolconditiontype { - if f == nil { - f = &defaultFaker - } - - var e enums.Poolconditiontype - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_PublicreportAccuracytype(f *faker.Faker, limits ...string) enums.PublicreportAccuracytype { - if f == nil { - f = &defaultFaker - } - - var e enums.PublicreportAccuracytype - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_PublicreportNuisancedurationtype(f *faker.Faker, limits ...string) enums.PublicreportNuisancedurationtype { - if f == nil { - f = &defaultFaker - } - - var e enums.PublicreportNuisancedurationtype - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_PublicreportReportstatustype(f *faker.Faker, limits ...string) enums.PublicreportReportstatustype { - if f == nil { - f = &defaultFaker - } - - var e enums.PublicreportReportstatustype - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_Signaltype(f *faker.Faker, limits ...string) enums.Signaltype { - if f == nil { - f = &defaultFaker - } - - var e enums.Signaltype - all := e.All() - return all[f.IntBetween(0, len(all)-1)] -} - -func random_enums_Userrole(f *faker.Faker, limits ...string) enums.Userrole { - if f == nil { - f = &defaultFaker - } - - var e enums.Userrole - all := e.All() - 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 - } - - 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 val -} - -func random_int16(f *faker.Faker, limits ...string) int16 { - if f == nil { - f = &defaultFaker - } - - return f.Int16() -} - -func random_int32(f *faker.Faker, limits ...string) int32 { - if f == nil { - f = &defaultFaker - } - - return f.Int32() -} - -func random_int64(f *faker.Faker, limits ...string) int64 { - if f == nil { - f = &defaultFaker - } - - return f.Int64() -} - -func random_pgtypes_HStore(f *faker.Faker, limits ...string) pgtypes.HStore { - if f == nil { - f = &defaultFaker - } - - hs := make(pgtypes.HStore) - for range f.IntBetween(1, 5) { - hs[random_string(f)] = sql.Null[string]{V: random_string(f, limits...), Valid: f.Bool()} - } - return hs -} - -func random_pq_BoolArray(f *faker.Faker, limits ...string) pq.BoolArray { - if f == nil { - f = &defaultFaker - } - - arr := make(pq.BoolArray, f.IntBetween(1, 5)) - for i := range arr { - arr[i] = random_bool(f, limits...) - } - return arr -} - -func random_pq_Float64Array(f *faker.Faker, limits ...string) pq.Float64Array { - if f == nil { - f = &defaultFaker - } - - arr := make(pq.Float64Array, f.IntBetween(1, 5)) - for i := range arr { - arr[i] = random_float64(f, limits...) - } - return arr -} - -func random_pq_StringArray(f *faker.Faker, limits ...string) pq.StringArray { - if f == nil { - f = &defaultFaker - } - - arr := make(pq.StringArray, f.IntBetween(1, 5)) - for i := range arr { - arr[i] = random_string(f, limits...) - } - return arr -} - -func random_string(f *faker.Faker, limits ...string) string { - if f == nil { - f = &defaultFaker - } - - val := strings.Join(f.Lorem().Words(f.IntBetween(1, 5)), " ") - if len(limits) == 0 { - return val - } - limitInt, _ := strconv.Atoi(limits[0]) - if limitInt > 0 && limitInt < len(val) { - val = val[:limitInt] - } - return val -} - -func random_time_Time(f *faker.Faker, limits ...string) time.Time { - if f == nil { - f = &defaultFaker - } - - year := time.Hour * 24 * 365 - min := time.Now().Add(-year) - max := time.Now().Add(year) - 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.New() -} diff --git a/db/factory/comms.email_contact.bob.go b/db/factory/comms.email_contact.bob.go deleted file mode 100644 index 2f89d433..00000000 --- a/db/factory/comms.email_contact.bob.go +++ /dev/null @@ -1,821 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/omit" - "github.com/jaswdr/faker/v2" -) - -type CommsEmailContactMod interface { - Apply(context.Context, *CommsEmailContactTemplate) -} - -type CommsEmailContactModFunc func(context.Context, *CommsEmailContactTemplate) - -func (f CommsEmailContactModFunc) Apply(ctx context.Context, n *CommsEmailContactTemplate) { - f(ctx, n) -} - -type CommsEmailContactModSlice []CommsEmailContactMod - -func (mods CommsEmailContactModSlice) Apply(ctx context.Context, n *CommsEmailContactTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// CommsEmailContactTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type CommsEmailContactTemplate struct { - Address func() string - Confirmed func() bool - IsSubscribed func() bool - PublicID func() string - - r commsEmailContactR - f *Factory - - alreadyPersisted bool -} - -type commsEmailContactR struct { - DestinationEmailLogs []*commsEmailContactRDestinationEmailLogsR - Organizations []*commsEmailContactROrganizationsR - EmailAddressNotifyEmailNuisances []*commsEmailContactREmailAddressNotifyEmailNuisancesR - EmailAddressNotifyEmailPools []*commsEmailContactREmailAddressNotifyEmailPoolsR - EmailAddressSubscribeEmails []*commsEmailContactREmailAddressSubscribeEmailsR -} - -type commsEmailContactRDestinationEmailLogsR struct { - number int - o *CommsEmailLogTemplate -} -type commsEmailContactROrganizationsR struct { - number int - o *OrganizationTemplate -} -type commsEmailContactREmailAddressNotifyEmailNuisancesR struct { - number int - o *PublicreportNotifyEmailNuisanceTemplate -} -type commsEmailContactREmailAddressNotifyEmailPoolsR struct { - number int - o *PublicreportNotifyEmailPoolTemplate -} -type commsEmailContactREmailAddressSubscribeEmailsR struct { - number int - o *PublicreportSubscribeEmailTemplate -} - -// Apply mods to the CommsEmailContactTemplate -func (o *CommsEmailContactTemplate) Apply(ctx context.Context, mods ...CommsEmailContactMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.CommsEmailContact -// according to the relationships in the template. Nothing is inserted into the db -func (t CommsEmailContactTemplate) setModelRels(o *models.CommsEmailContact) { - if t.r.DestinationEmailLogs != nil { - rel := models.CommsEmailLogSlice{} - for _, r := range t.r.DestinationEmailLogs { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.Destination = o.Address // h2 - rel.R.DestinationEmailContact = o - } - rel = append(rel, related...) - } - o.R.DestinationEmailLogs = rel - } - - if t.r.Organizations != nil { - rel := models.OrganizationSlice{} - for _, r := range t.r.Organizations { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.R.EmailContacts = append(rel.R.EmailContacts, o) - } - rel = append(rel, related...) - } - o.R.Organizations = rel - } - - if t.r.EmailAddressNotifyEmailNuisances != nil { - rel := models.PublicreportNotifyEmailNuisanceSlice{} - for _, r := range t.r.EmailAddressNotifyEmailNuisances { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.EmailAddress = o.Address // h2 - rel.R.EmailAddressEmailContact = o - } - rel = append(rel, related...) - } - o.R.EmailAddressNotifyEmailNuisances = rel - } - - if t.r.EmailAddressNotifyEmailPools != nil { - rel := models.PublicreportNotifyEmailPoolSlice{} - for _, r := range t.r.EmailAddressNotifyEmailPools { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.EmailAddress = o.Address // h2 - rel.R.EmailAddressEmailContact = o - } - rel = append(rel, related...) - } - o.R.EmailAddressNotifyEmailPools = rel - } - - if t.r.EmailAddressSubscribeEmails != nil { - rel := models.PublicreportSubscribeEmailSlice{} - for _, r := range t.r.EmailAddressSubscribeEmails { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.EmailAddress = o.Address // h2 - rel.R.EmailAddressEmailContact = o - } - rel = append(rel, related...) - } - o.R.EmailAddressSubscribeEmails = rel - } -} - -// BuildSetter returns an *models.CommsEmailContactSetter -// this does nothing with the relationship templates -func (o CommsEmailContactTemplate) BuildSetter() *models.CommsEmailContactSetter { - m := &models.CommsEmailContactSetter{} - - if o.Address != nil { - val := o.Address() - m.Address = omit.From(val) - } - if o.Confirmed != nil { - val := o.Confirmed() - m.Confirmed = omit.From(val) - } - if o.IsSubscribed != nil { - val := o.IsSubscribed() - m.IsSubscribed = omit.From(val) - } - if o.PublicID != nil { - val := o.PublicID() - m.PublicID = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.CommsEmailContactSetter -// this does nothing with the relationship templates -func (o CommsEmailContactTemplate) BuildManySetter(number int) []*models.CommsEmailContactSetter { - m := make([]*models.CommsEmailContactSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.CommsEmailContact -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use CommsEmailContactTemplate.Create -func (o CommsEmailContactTemplate) Build() *models.CommsEmailContact { - m := &models.CommsEmailContact{} - - if o.Address != nil { - m.Address = o.Address() - } - if o.Confirmed != nil { - m.Confirmed = o.Confirmed() - } - if o.IsSubscribed != nil { - m.IsSubscribed = o.IsSubscribed() - } - if o.PublicID != nil { - m.PublicID = o.PublicID() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.CommsEmailContactSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use CommsEmailContactTemplate.CreateMany -func (o CommsEmailContactTemplate) BuildMany(number int) models.CommsEmailContactSlice { - m := make(models.CommsEmailContactSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableCommsEmailContact(m *models.CommsEmailContactSetter) { - if !(m.Address.IsValue()) { - val := random_string(nil) - m.Address = omit.From(val) - } - if !(m.Confirmed.IsValue()) { - val := random_bool(nil) - m.Confirmed = omit.From(val) - } - if !(m.IsSubscribed.IsValue()) { - val := random_bool(nil) - m.IsSubscribed = omit.From(val) - } - if !(m.PublicID.IsValue()) { - val := random_string(nil) - m.PublicID = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.CommsEmailContact -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *CommsEmailContactTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.CommsEmailContact) error { - var err error - - isDestinationEmailLogsDone, _ := commsEmailContactRelDestinationEmailLogsCtx.Value(ctx) - if !isDestinationEmailLogsDone && o.r.DestinationEmailLogs != nil { - ctx = commsEmailContactRelDestinationEmailLogsCtx.WithValue(ctx, true) - for _, r := range o.r.DestinationEmailLogs { - if r.o.alreadyPersisted { - m.R.DestinationEmailLogs = append(m.R.DestinationEmailLogs, r.o.Build()) - } else { - rel0, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachDestinationEmailLogs(ctx, exec, rel0...) - if err != nil { - return err - } - } - } - } - - isOrganizationsDone, _ := commsEmailContactRelOrganizationsCtx.Value(ctx) - if !isOrganizationsDone && o.r.Organizations != nil { - ctx = commsEmailContactRelOrganizationsCtx.WithValue(ctx, true) - for _, r := range o.r.Organizations { - if r.o.alreadyPersisted { - m.R.Organizations = append(m.R.Organizations, r.o.Build()) - } else { - rel1, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachOrganizations(ctx, exec, rel1...) - if err != nil { - return err - } - } - } - } - - isEmailAddressNotifyEmailNuisancesDone, _ := commsEmailContactRelEmailAddressNotifyEmailNuisancesCtx.Value(ctx) - if !isEmailAddressNotifyEmailNuisancesDone && o.r.EmailAddressNotifyEmailNuisances != nil { - ctx = commsEmailContactRelEmailAddressNotifyEmailNuisancesCtx.WithValue(ctx, true) - for _, r := range o.r.EmailAddressNotifyEmailNuisances { - if r.o.alreadyPersisted { - m.R.EmailAddressNotifyEmailNuisances = append(m.R.EmailAddressNotifyEmailNuisances, r.o.Build()) - } else { - rel2, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachEmailAddressNotifyEmailNuisances(ctx, exec, rel2...) - if err != nil { - return err - } - } - } - } - - isEmailAddressNotifyEmailPoolsDone, _ := commsEmailContactRelEmailAddressNotifyEmailPoolsCtx.Value(ctx) - if !isEmailAddressNotifyEmailPoolsDone && o.r.EmailAddressNotifyEmailPools != nil { - ctx = commsEmailContactRelEmailAddressNotifyEmailPoolsCtx.WithValue(ctx, true) - for _, r := range o.r.EmailAddressNotifyEmailPools { - if r.o.alreadyPersisted { - m.R.EmailAddressNotifyEmailPools = append(m.R.EmailAddressNotifyEmailPools, r.o.Build()) - } else { - rel3, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachEmailAddressNotifyEmailPools(ctx, exec, rel3...) - if err != nil { - return err - } - } - } - } - - isEmailAddressSubscribeEmailsDone, _ := commsEmailContactRelEmailAddressSubscribeEmailsCtx.Value(ctx) - if !isEmailAddressSubscribeEmailsDone && o.r.EmailAddressSubscribeEmails != nil { - ctx = commsEmailContactRelEmailAddressSubscribeEmailsCtx.WithValue(ctx, true) - for _, r := range o.r.EmailAddressSubscribeEmails { - if r.o.alreadyPersisted { - m.R.EmailAddressSubscribeEmails = append(m.R.EmailAddressSubscribeEmails, r.o.Build()) - } else { - rel4, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachEmailAddressSubscribeEmails(ctx, exec, rel4...) - if err != nil { - return err - } - } - } - } - - return err -} - -// Create builds a commsEmailContact and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *CommsEmailContactTemplate) Create(ctx context.Context, exec bob.Executor) (*models.CommsEmailContact, error) { - var err error - opt := o.BuildSetter() - ensureCreatableCommsEmailContact(opt) - - m, err := models.CommsEmailContacts.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a commsEmailContact and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *CommsEmailContactTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.CommsEmailContact { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a commsEmailContact 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 *CommsEmailContactTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.CommsEmailContact { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple commsEmailContacts and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o CommsEmailContactTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.CommsEmailContactSlice, error) { - var err error - m := make(models.CommsEmailContactSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple commsEmailContacts and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o CommsEmailContactTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.CommsEmailContactSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple commsEmailContacts 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 CommsEmailContactTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.CommsEmailContactSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CommsEmailContact has methods that act as mods for the CommsEmailContactTemplate -var CommsEmailContactMods commsEmailContactMods - -type commsEmailContactMods struct{} - -func (m commsEmailContactMods) RandomizeAllColumns(f *faker.Faker) CommsEmailContactMod { - return CommsEmailContactModSlice{ - CommsEmailContactMods.RandomAddress(f), - CommsEmailContactMods.RandomConfirmed(f), - CommsEmailContactMods.RandomIsSubscribed(f), - CommsEmailContactMods.RandomPublicID(f), - } -} - -// Set the model columns to this value -func (m commsEmailContactMods) Address(val string) CommsEmailContactMod { - return CommsEmailContactModFunc(func(_ context.Context, o *CommsEmailContactTemplate) { - o.Address = func() string { return val } - }) -} - -// Set the Column from the function -func (m commsEmailContactMods) AddressFunc(f func() string) CommsEmailContactMod { - return CommsEmailContactModFunc(func(_ context.Context, o *CommsEmailContactTemplate) { - o.Address = f - }) -} - -// Clear any values for the column -func (m commsEmailContactMods) UnsetAddress() CommsEmailContactMod { - return CommsEmailContactModFunc(func(_ context.Context, o *CommsEmailContactTemplate) { - o.Address = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsEmailContactMods) RandomAddress(f *faker.Faker) CommsEmailContactMod { - return CommsEmailContactModFunc(func(_ context.Context, o *CommsEmailContactTemplate) { - o.Address = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m commsEmailContactMods) Confirmed(val bool) CommsEmailContactMod { - return CommsEmailContactModFunc(func(_ context.Context, o *CommsEmailContactTemplate) { - o.Confirmed = func() bool { return val } - }) -} - -// Set the Column from the function -func (m commsEmailContactMods) ConfirmedFunc(f func() bool) CommsEmailContactMod { - return CommsEmailContactModFunc(func(_ context.Context, o *CommsEmailContactTemplate) { - o.Confirmed = f - }) -} - -// Clear any values for the column -func (m commsEmailContactMods) UnsetConfirmed() CommsEmailContactMod { - return CommsEmailContactModFunc(func(_ context.Context, o *CommsEmailContactTemplate) { - o.Confirmed = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsEmailContactMods) RandomConfirmed(f *faker.Faker) CommsEmailContactMod { - return CommsEmailContactModFunc(func(_ context.Context, o *CommsEmailContactTemplate) { - o.Confirmed = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m commsEmailContactMods) IsSubscribed(val bool) CommsEmailContactMod { - return CommsEmailContactModFunc(func(_ context.Context, o *CommsEmailContactTemplate) { - o.IsSubscribed = func() bool { return val } - }) -} - -// Set the Column from the function -func (m commsEmailContactMods) IsSubscribedFunc(f func() bool) CommsEmailContactMod { - return CommsEmailContactModFunc(func(_ context.Context, o *CommsEmailContactTemplate) { - o.IsSubscribed = f - }) -} - -// Clear any values for the column -func (m commsEmailContactMods) UnsetIsSubscribed() CommsEmailContactMod { - return CommsEmailContactModFunc(func(_ context.Context, o *CommsEmailContactTemplate) { - o.IsSubscribed = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsEmailContactMods) RandomIsSubscribed(f *faker.Faker) CommsEmailContactMod { - return CommsEmailContactModFunc(func(_ context.Context, o *CommsEmailContactTemplate) { - o.IsSubscribed = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m commsEmailContactMods) PublicID(val string) CommsEmailContactMod { - return CommsEmailContactModFunc(func(_ context.Context, o *CommsEmailContactTemplate) { - o.PublicID = func() string { return val } - }) -} - -// Set the Column from the function -func (m commsEmailContactMods) PublicIDFunc(f func() string) CommsEmailContactMod { - return CommsEmailContactModFunc(func(_ context.Context, o *CommsEmailContactTemplate) { - o.PublicID = f - }) -} - -// Clear any values for the column -func (m commsEmailContactMods) UnsetPublicID() CommsEmailContactMod { - return CommsEmailContactModFunc(func(_ context.Context, o *CommsEmailContactTemplate) { - o.PublicID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsEmailContactMods) RandomPublicID(f *faker.Faker) CommsEmailContactMod { - return CommsEmailContactModFunc(func(_ context.Context, o *CommsEmailContactTemplate) { - o.PublicID = func() string { - return random_string(f) - } - }) -} - -func (m commsEmailContactMods) WithParentsCascading() CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - if isDone, _ := commsEmailContactWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = commsEmailContactWithParentsCascadingCtx.WithValue(ctx, true) - }) -} - -func (m commsEmailContactMods) WithDestinationEmailLogs(number int, related *CommsEmailLogTemplate) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - o.r.DestinationEmailLogs = []*commsEmailContactRDestinationEmailLogsR{{ - number: number, - o: related, - }} - }) -} - -func (m commsEmailContactMods) WithNewDestinationEmailLogs(number int, mods ...CommsEmailLogMod) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - related := o.f.NewCommsEmailLogWithContext(ctx, mods...) - m.WithDestinationEmailLogs(number, related).Apply(ctx, o) - }) -} - -func (m commsEmailContactMods) AddDestinationEmailLogs(number int, related *CommsEmailLogTemplate) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - o.r.DestinationEmailLogs = append(o.r.DestinationEmailLogs, &commsEmailContactRDestinationEmailLogsR{ - number: number, - o: related, - }) - }) -} - -func (m commsEmailContactMods) AddNewDestinationEmailLogs(number int, mods ...CommsEmailLogMod) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - related := o.f.NewCommsEmailLogWithContext(ctx, mods...) - m.AddDestinationEmailLogs(number, related).Apply(ctx, o) - }) -} - -func (m commsEmailContactMods) AddExistingDestinationEmailLogs(existingModels ...*models.CommsEmailLog) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - for _, em := range existingModels { - o.r.DestinationEmailLogs = append(o.r.DestinationEmailLogs, &commsEmailContactRDestinationEmailLogsR{ - o: o.f.FromExistingCommsEmailLog(em), - }) - } - }) -} - -func (m commsEmailContactMods) WithoutDestinationEmailLogs() CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - o.r.DestinationEmailLogs = nil - }) -} - -func (m commsEmailContactMods) WithOrganizations(number int, related *OrganizationTemplate) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - o.r.Organizations = []*commsEmailContactROrganizationsR{{ - number: number, - o: related, - }} - }) -} - -func (m commsEmailContactMods) WithNewOrganizations(number int, mods ...OrganizationMod) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - m.WithOrganizations(number, related).Apply(ctx, o) - }) -} - -func (m commsEmailContactMods) AddOrganizations(number int, related *OrganizationTemplate) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - o.r.Organizations = append(o.r.Organizations, &commsEmailContactROrganizationsR{ - number: number, - o: related, - }) - }) -} - -func (m commsEmailContactMods) AddNewOrganizations(number int, mods ...OrganizationMod) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - m.AddOrganizations(number, related).Apply(ctx, o) - }) -} - -func (m commsEmailContactMods) AddExistingOrganizations(existingModels ...*models.Organization) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - for _, em := range existingModels { - o.r.Organizations = append(o.r.Organizations, &commsEmailContactROrganizationsR{ - o: o.f.FromExistingOrganization(em), - }) - } - }) -} - -func (m commsEmailContactMods) WithoutOrganizations() CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - o.r.Organizations = nil - }) -} - -func (m commsEmailContactMods) WithEmailAddressNotifyEmailNuisances(number int, related *PublicreportNotifyEmailNuisanceTemplate) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - o.r.EmailAddressNotifyEmailNuisances = []*commsEmailContactREmailAddressNotifyEmailNuisancesR{{ - number: number, - o: related, - }} - }) -} - -func (m commsEmailContactMods) WithNewEmailAddressNotifyEmailNuisances(number int, mods ...PublicreportNotifyEmailNuisanceMod) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - related := o.f.NewPublicreportNotifyEmailNuisanceWithContext(ctx, mods...) - m.WithEmailAddressNotifyEmailNuisances(number, related).Apply(ctx, o) - }) -} - -func (m commsEmailContactMods) AddEmailAddressNotifyEmailNuisances(number int, related *PublicreportNotifyEmailNuisanceTemplate) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - o.r.EmailAddressNotifyEmailNuisances = append(o.r.EmailAddressNotifyEmailNuisances, &commsEmailContactREmailAddressNotifyEmailNuisancesR{ - number: number, - o: related, - }) - }) -} - -func (m commsEmailContactMods) AddNewEmailAddressNotifyEmailNuisances(number int, mods ...PublicreportNotifyEmailNuisanceMod) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - related := o.f.NewPublicreportNotifyEmailNuisanceWithContext(ctx, mods...) - m.AddEmailAddressNotifyEmailNuisances(number, related).Apply(ctx, o) - }) -} - -func (m commsEmailContactMods) AddExistingEmailAddressNotifyEmailNuisances(existingModels ...*models.PublicreportNotifyEmailNuisance) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - for _, em := range existingModels { - o.r.EmailAddressNotifyEmailNuisances = append(o.r.EmailAddressNotifyEmailNuisances, &commsEmailContactREmailAddressNotifyEmailNuisancesR{ - o: o.f.FromExistingPublicreportNotifyEmailNuisance(em), - }) - } - }) -} - -func (m commsEmailContactMods) WithoutEmailAddressNotifyEmailNuisances() CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - o.r.EmailAddressNotifyEmailNuisances = nil - }) -} - -func (m commsEmailContactMods) WithEmailAddressNotifyEmailPools(number int, related *PublicreportNotifyEmailPoolTemplate) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - o.r.EmailAddressNotifyEmailPools = []*commsEmailContactREmailAddressNotifyEmailPoolsR{{ - number: number, - o: related, - }} - }) -} - -func (m commsEmailContactMods) WithNewEmailAddressNotifyEmailPools(number int, mods ...PublicreportNotifyEmailPoolMod) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - related := o.f.NewPublicreportNotifyEmailPoolWithContext(ctx, mods...) - m.WithEmailAddressNotifyEmailPools(number, related).Apply(ctx, o) - }) -} - -func (m commsEmailContactMods) AddEmailAddressNotifyEmailPools(number int, related *PublicreportNotifyEmailPoolTemplate) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - o.r.EmailAddressNotifyEmailPools = append(o.r.EmailAddressNotifyEmailPools, &commsEmailContactREmailAddressNotifyEmailPoolsR{ - number: number, - o: related, - }) - }) -} - -func (m commsEmailContactMods) AddNewEmailAddressNotifyEmailPools(number int, mods ...PublicreportNotifyEmailPoolMod) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - related := o.f.NewPublicreportNotifyEmailPoolWithContext(ctx, mods...) - m.AddEmailAddressNotifyEmailPools(number, related).Apply(ctx, o) - }) -} - -func (m commsEmailContactMods) AddExistingEmailAddressNotifyEmailPools(existingModels ...*models.PublicreportNotifyEmailPool) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - for _, em := range existingModels { - o.r.EmailAddressNotifyEmailPools = append(o.r.EmailAddressNotifyEmailPools, &commsEmailContactREmailAddressNotifyEmailPoolsR{ - o: o.f.FromExistingPublicreportNotifyEmailPool(em), - }) - } - }) -} - -func (m commsEmailContactMods) WithoutEmailAddressNotifyEmailPools() CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - o.r.EmailAddressNotifyEmailPools = nil - }) -} - -func (m commsEmailContactMods) WithEmailAddressSubscribeEmails(number int, related *PublicreportSubscribeEmailTemplate) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - o.r.EmailAddressSubscribeEmails = []*commsEmailContactREmailAddressSubscribeEmailsR{{ - number: number, - o: related, - }} - }) -} - -func (m commsEmailContactMods) WithNewEmailAddressSubscribeEmails(number int, mods ...PublicreportSubscribeEmailMod) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - related := o.f.NewPublicreportSubscribeEmailWithContext(ctx, mods...) - m.WithEmailAddressSubscribeEmails(number, related).Apply(ctx, o) - }) -} - -func (m commsEmailContactMods) AddEmailAddressSubscribeEmails(number int, related *PublicreportSubscribeEmailTemplate) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - o.r.EmailAddressSubscribeEmails = append(o.r.EmailAddressSubscribeEmails, &commsEmailContactREmailAddressSubscribeEmailsR{ - number: number, - o: related, - }) - }) -} - -func (m commsEmailContactMods) AddNewEmailAddressSubscribeEmails(number int, mods ...PublicreportSubscribeEmailMod) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - related := o.f.NewPublicreportSubscribeEmailWithContext(ctx, mods...) - m.AddEmailAddressSubscribeEmails(number, related).Apply(ctx, o) - }) -} - -func (m commsEmailContactMods) AddExistingEmailAddressSubscribeEmails(existingModels ...*models.PublicreportSubscribeEmail) CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - for _, em := range existingModels { - o.r.EmailAddressSubscribeEmails = append(o.r.EmailAddressSubscribeEmails, &commsEmailContactREmailAddressSubscribeEmailsR{ - o: o.f.FromExistingPublicreportSubscribeEmail(em), - }) - } - }) -} - -func (m commsEmailContactMods) WithoutEmailAddressSubscribeEmails() CommsEmailContactMod { - return CommsEmailContactModFunc(func(ctx context.Context, o *CommsEmailContactTemplate) { - o.r.EmailAddressSubscribeEmails = nil - }) -} diff --git a/db/factory/comms.email_log.bob.go b/db/factory/comms.email_log.bob.go deleted file mode 100644 index e5d70db7..00000000 --- a/db/factory/comms.email_log.bob.go +++ /dev/null @@ -1,848 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types/pgtypes" - 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/jaswdr/faker/v2" -) - -type CommsEmailLogMod interface { - Apply(context.Context, *CommsEmailLogTemplate) -} - -type CommsEmailLogModFunc func(context.Context, *CommsEmailLogTemplate) - -func (f CommsEmailLogModFunc) Apply(ctx context.Context, n *CommsEmailLogTemplate) { - f(ctx, n) -} - -type CommsEmailLogModSlice []CommsEmailLogMod - -func (mods CommsEmailLogModSlice) Apply(ctx context.Context, n *CommsEmailLogTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// CommsEmailLogTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type CommsEmailLogTemplate struct { - ID func() int32 - Created func() time.Time - DeliveryStatus func() string - Destination func() string - PublicID func() string - SentAt func() null.Val[time.Time] - Source func() string - Subject func() string - TemplateID func() int32 - TemplateData func() pgtypes.HStore - Type func() enums.CommsMessagetypeemail - - r commsEmailLogR - f *Factory - - alreadyPersisted bool -} - -type commsEmailLogR struct { - DestinationEmailContact *commsEmailLogRDestinationEmailContactR - TemplateEmailTemplate *commsEmailLogRTemplateEmailTemplateR -} - -type commsEmailLogRDestinationEmailContactR struct { - o *CommsEmailContactTemplate -} -type commsEmailLogRTemplateEmailTemplateR struct { - o *CommsEmailTemplateTemplate -} - -// Apply mods to the CommsEmailLogTemplate -func (o *CommsEmailLogTemplate) Apply(ctx context.Context, mods ...CommsEmailLogMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.CommsEmailLog -// according to the relationships in the template. Nothing is inserted into the db -func (t CommsEmailLogTemplate) setModelRels(o *models.CommsEmailLog) { - if t.r.DestinationEmailContact != nil { - rel := t.r.DestinationEmailContact.o.Build() - rel.R.DestinationEmailLogs = append(rel.R.DestinationEmailLogs, o) - o.Destination = rel.Address // h2 - o.R.DestinationEmailContact = rel - } - - if t.r.TemplateEmailTemplate != nil { - rel := t.r.TemplateEmailTemplate.o.Build() - rel.R.TemplateEmailLogs = append(rel.R.TemplateEmailLogs, o) - o.TemplateID = rel.ID // h2 - o.R.TemplateEmailTemplate = rel - } -} - -// BuildSetter returns an *models.CommsEmailLogSetter -// this does nothing with the relationship templates -func (o CommsEmailLogTemplate) BuildSetter() *models.CommsEmailLogSetter { - m := &models.CommsEmailLogSetter{} - - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.DeliveryStatus != nil { - val := o.DeliveryStatus() - m.DeliveryStatus = omit.From(val) - } - if o.Destination != nil { - val := o.Destination() - m.Destination = omit.From(val) - } - if o.PublicID != nil { - val := o.PublicID() - m.PublicID = omit.From(val) - } - if o.SentAt != nil { - val := o.SentAt() - m.SentAt = omitnull.FromNull(val) - } - if o.Source != nil { - val := o.Source() - m.Source = omit.From(val) - } - if o.Subject != nil { - val := o.Subject() - m.Subject = omit.From(val) - } - if o.TemplateID != nil { - val := o.TemplateID() - m.TemplateID = omit.From(val) - } - if o.TemplateData != nil { - val := o.TemplateData() - m.TemplateData = omit.From(val) - } - if o.Type != nil { - val := o.Type() - m.Type = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.CommsEmailLogSetter -// this does nothing with the relationship templates -func (o CommsEmailLogTemplate) BuildManySetter(number int) []*models.CommsEmailLogSetter { - m := make([]*models.CommsEmailLogSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.CommsEmailLog -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use CommsEmailLogTemplate.Create -func (o CommsEmailLogTemplate) Build() *models.CommsEmailLog { - m := &models.CommsEmailLog{} - - if o.ID != nil { - m.ID = o.ID() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.DeliveryStatus != nil { - m.DeliveryStatus = o.DeliveryStatus() - } - if o.Destination != nil { - m.Destination = o.Destination() - } - if o.PublicID != nil { - m.PublicID = o.PublicID() - } - if o.SentAt != nil { - m.SentAt = o.SentAt() - } - if o.Source != nil { - m.Source = o.Source() - } - if o.Subject != nil { - m.Subject = o.Subject() - } - if o.TemplateID != nil { - m.TemplateID = o.TemplateID() - } - if o.TemplateData != nil { - m.TemplateData = o.TemplateData() - } - if o.Type != nil { - m.Type = o.Type() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.CommsEmailLogSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use CommsEmailLogTemplate.CreateMany -func (o CommsEmailLogTemplate) BuildMany(number int) models.CommsEmailLogSlice { - m := make(models.CommsEmailLogSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableCommsEmailLog(m *models.CommsEmailLogSetter) { - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.DeliveryStatus.IsValue()) { - val := random_string(nil, "16") - m.DeliveryStatus = omit.From(val) - } - if !(m.Destination.IsValue()) { - val := random_string(nil) - m.Destination = omit.From(val) - } - if !(m.PublicID.IsValue()) { - val := random_string(nil, "64") - m.PublicID = omit.From(val) - } - if !(m.Source.IsValue()) { - val := random_string(nil) - m.Source = omit.From(val) - } - if !(m.Subject.IsValue()) { - val := random_string(nil, "255") - m.Subject = omit.From(val) - } - if !(m.TemplateID.IsValue()) { - val := random_int32(nil) - m.TemplateID = omit.From(val) - } - if !(m.TemplateData.IsValue()) { - val := random_pgtypes_HStore(nil) - m.TemplateData = omit.From(val) - } - if !(m.Type.IsValue()) { - val := random_enums_CommsMessagetypeemail(nil) - m.Type = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.CommsEmailLog -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *CommsEmailLogTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.CommsEmailLog) error { - var err error - - return err -} - -// Create builds a commsEmailLog and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *CommsEmailLogTemplate) Create(ctx context.Context, exec bob.Executor) (*models.CommsEmailLog, error) { - var err error - opt := o.BuildSetter() - ensureCreatableCommsEmailLog(opt) - - if o.r.DestinationEmailContact == nil { - CommsEmailLogMods.WithNewDestinationEmailContact().Apply(ctx, o) - } - - var rel0 *models.CommsEmailContact - - if o.r.DestinationEmailContact.o.alreadyPersisted { - rel0 = o.r.DestinationEmailContact.o.Build() - } else { - rel0, err = o.r.DestinationEmailContact.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.Destination = omit.From(rel0.Address) - - if o.r.TemplateEmailTemplate == nil { - CommsEmailLogMods.WithNewTemplateEmailTemplate().Apply(ctx, o) - } - - var rel1 *models.CommsEmailTemplate - - if o.r.TemplateEmailTemplate.o.alreadyPersisted { - rel1 = o.r.TemplateEmailTemplate.o.Build() - } else { - rel1, err = o.r.TemplateEmailTemplate.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.TemplateID = omit.From(rel1.ID) - - m, err := models.CommsEmailLogs.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.DestinationEmailContact = rel0 - m.R.TemplateEmailTemplate = rel1 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a commsEmailLog and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *CommsEmailLogTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.CommsEmailLog { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a commsEmailLog 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 *CommsEmailLogTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.CommsEmailLog { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple commsEmailLogs and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o CommsEmailLogTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.CommsEmailLogSlice, error) { - var err error - m := make(models.CommsEmailLogSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple commsEmailLogs and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o CommsEmailLogTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.CommsEmailLogSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple commsEmailLogs 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 CommsEmailLogTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.CommsEmailLogSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CommsEmailLog has methods that act as mods for the CommsEmailLogTemplate -var CommsEmailLogMods commsEmailLogMods - -type commsEmailLogMods struct{} - -func (m commsEmailLogMods) RandomizeAllColumns(f *faker.Faker) CommsEmailLogMod { - return CommsEmailLogModSlice{ - CommsEmailLogMods.RandomID(f), - CommsEmailLogMods.RandomCreated(f), - CommsEmailLogMods.RandomDeliveryStatus(f), - CommsEmailLogMods.RandomDestination(f), - CommsEmailLogMods.RandomPublicID(f), - CommsEmailLogMods.RandomSentAt(f), - CommsEmailLogMods.RandomSource(f), - CommsEmailLogMods.RandomSubject(f), - CommsEmailLogMods.RandomTemplateID(f), - CommsEmailLogMods.RandomTemplateData(f), - CommsEmailLogMods.RandomType(f), - } -} - -// Set the model columns to this value -func (m commsEmailLogMods) ID(val int32) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m commsEmailLogMods) IDFunc(f func() int32) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m commsEmailLogMods) UnsetID() CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsEmailLogMods) RandomID(f *faker.Faker) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m commsEmailLogMods) Created(val time.Time) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m commsEmailLogMods) CreatedFunc(f func() time.Time) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m commsEmailLogMods) UnsetCreated() CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - 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 commsEmailLogMods) RandomCreated(f *faker.Faker) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m commsEmailLogMods) DeliveryStatus(val string) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.DeliveryStatus = func() string { return val } - }) -} - -// Set the Column from the function -func (m commsEmailLogMods) DeliveryStatusFunc(f func() string) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.DeliveryStatus = f - }) -} - -// Clear any values for the column -func (m commsEmailLogMods) UnsetDeliveryStatus() CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.DeliveryStatus = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsEmailLogMods) RandomDeliveryStatus(f *faker.Faker) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.DeliveryStatus = func() string { - return random_string(f, "16") - } - }) -} - -// Set the model columns to this value -func (m commsEmailLogMods) Destination(val string) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.Destination = func() string { return val } - }) -} - -// Set the Column from the function -func (m commsEmailLogMods) DestinationFunc(f func() string) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.Destination = f - }) -} - -// Clear any values for the column -func (m commsEmailLogMods) UnsetDestination() CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.Destination = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsEmailLogMods) RandomDestination(f *faker.Faker) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.Destination = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m commsEmailLogMods) PublicID(val string) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.PublicID = func() string { return val } - }) -} - -// Set the Column from the function -func (m commsEmailLogMods) PublicIDFunc(f func() string) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.PublicID = f - }) -} - -// Clear any values for the column -func (m commsEmailLogMods) UnsetPublicID() CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.PublicID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsEmailLogMods) RandomPublicID(f *faker.Faker) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.PublicID = func() string { - return random_string(f, "64") - } - }) -} - -// Set the model columns to this value -func (m commsEmailLogMods) SentAt(val null.Val[time.Time]) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.SentAt = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m commsEmailLogMods) SentAtFunc(f func() null.Val[time.Time]) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.SentAt = f - }) -} - -// Clear any values for the column -func (m commsEmailLogMods) UnsetSentAt() CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.SentAt = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m commsEmailLogMods) RandomSentAt(f *faker.Faker) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.SentAt = 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 commsEmailLogMods) RandomSentAtNotNull(f *faker.Faker) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.SentAt = 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 commsEmailLogMods) Source(val string) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.Source = func() string { return val } - }) -} - -// Set the Column from the function -func (m commsEmailLogMods) SourceFunc(f func() string) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.Source = f - }) -} - -// Clear any values for the column -func (m commsEmailLogMods) UnsetSource() CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.Source = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsEmailLogMods) RandomSource(f *faker.Faker) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.Source = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m commsEmailLogMods) Subject(val string) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.Subject = func() string { return val } - }) -} - -// Set the Column from the function -func (m commsEmailLogMods) SubjectFunc(f func() string) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.Subject = f - }) -} - -// Clear any values for the column -func (m commsEmailLogMods) UnsetSubject() CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.Subject = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsEmailLogMods) RandomSubject(f *faker.Faker) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.Subject = func() string { - return random_string(f, "255") - } - }) -} - -// Set the model columns to this value -func (m commsEmailLogMods) TemplateID(val int32) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.TemplateID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m commsEmailLogMods) TemplateIDFunc(f func() int32) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.TemplateID = f - }) -} - -// Clear any values for the column -func (m commsEmailLogMods) UnsetTemplateID() CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.TemplateID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsEmailLogMods) RandomTemplateID(f *faker.Faker) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.TemplateID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m commsEmailLogMods) TemplateData(val pgtypes.HStore) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.TemplateData = func() pgtypes.HStore { return val } - }) -} - -// Set the Column from the function -func (m commsEmailLogMods) TemplateDataFunc(f func() pgtypes.HStore) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.TemplateData = f - }) -} - -// Clear any values for the column -func (m commsEmailLogMods) UnsetTemplateData() CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.TemplateData = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsEmailLogMods) RandomTemplateData(f *faker.Faker) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.TemplateData = func() pgtypes.HStore { - return random_pgtypes_HStore(f) - } - }) -} - -// Set the model columns to this value -func (m commsEmailLogMods) Type(val enums.CommsMessagetypeemail) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.Type = func() enums.CommsMessagetypeemail { return val } - }) -} - -// Set the Column from the function -func (m commsEmailLogMods) TypeFunc(f func() enums.CommsMessagetypeemail) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.Type = f - }) -} - -// Clear any values for the column -func (m commsEmailLogMods) UnsetType() CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - 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 commsEmailLogMods) RandomType(f *faker.Faker) CommsEmailLogMod { - return CommsEmailLogModFunc(func(_ context.Context, o *CommsEmailLogTemplate) { - o.Type = func() enums.CommsMessagetypeemail { - return random_enums_CommsMessagetypeemail(f) - } - }) -} - -func (m commsEmailLogMods) WithParentsCascading() CommsEmailLogMod { - return CommsEmailLogModFunc(func(ctx context.Context, o *CommsEmailLogTemplate) { - if isDone, _ := commsEmailLogWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = commsEmailLogWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewCommsEmailContactWithContext(ctx, CommsEmailContactMods.WithParentsCascading()) - m.WithDestinationEmailContact(related).Apply(ctx, o) - } - { - - related := o.f.NewCommsEmailTemplateWithContext(ctx, CommsEmailTemplateMods.WithParentsCascading()) - m.WithTemplateEmailTemplate(related).Apply(ctx, o) - } - }) -} - -func (m commsEmailLogMods) WithDestinationEmailContact(rel *CommsEmailContactTemplate) CommsEmailLogMod { - return CommsEmailLogModFunc(func(ctx context.Context, o *CommsEmailLogTemplate) { - o.r.DestinationEmailContact = &commsEmailLogRDestinationEmailContactR{ - o: rel, - } - }) -} - -func (m commsEmailLogMods) WithNewDestinationEmailContact(mods ...CommsEmailContactMod) CommsEmailLogMod { - return CommsEmailLogModFunc(func(ctx context.Context, o *CommsEmailLogTemplate) { - related := o.f.NewCommsEmailContactWithContext(ctx, mods...) - - m.WithDestinationEmailContact(related).Apply(ctx, o) - }) -} - -func (m commsEmailLogMods) WithExistingDestinationEmailContact(em *models.CommsEmailContact) CommsEmailLogMod { - return CommsEmailLogModFunc(func(ctx context.Context, o *CommsEmailLogTemplate) { - o.r.DestinationEmailContact = &commsEmailLogRDestinationEmailContactR{ - o: o.f.FromExistingCommsEmailContact(em), - } - }) -} - -func (m commsEmailLogMods) WithoutDestinationEmailContact() CommsEmailLogMod { - return CommsEmailLogModFunc(func(ctx context.Context, o *CommsEmailLogTemplate) { - o.r.DestinationEmailContact = nil - }) -} - -func (m commsEmailLogMods) WithTemplateEmailTemplate(rel *CommsEmailTemplateTemplate) CommsEmailLogMod { - return CommsEmailLogModFunc(func(ctx context.Context, o *CommsEmailLogTemplate) { - o.r.TemplateEmailTemplate = &commsEmailLogRTemplateEmailTemplateR{ - o: rel, - } - }) -} - -func (m commsEmailLogMods) WithNewTemplateEmailTemplate(mods ...CommsEmailTemplateMod) CommsEmailLogMod { - return CommsEmailLogModFunc(func(ctx context.Context, o *CommsEmailLogTemplate) { - related := o.f.NewCommsEmailTemplateWithContext(ctx, mods...) - - m.WithTemplateEmailTemplate(related).Apply(ctx, o) - }) -} - -func (m commsEmailLogMods) WithExistingTemplateEmailTemplate(em *models.CommsEmailTemplate) CommsEmailLogMod { - return CommsEmailLogModFunc(func(ctx context.Context, o *CommsEmailLogTemplate) { - o.r.TemplateEmailTemplate = &commsEmailLogRTemplateEmailTemplateR{ - o: o.f.FromExistingCommsEmailTemplate(em), - } - }) -} - -func (m commsEmailLogMods) WithoutTemplateEmailTemplate() CommsEmailLogMod { - return CommsEmailLogModFunc(func(ctx context.Context, o *CommsEmailLogTemplate) { - o.r.TemplateEmailTemplate = nil - }) -} diff --git a/db/factory/comms.email_template.bob.go b/db/factory/comms.email_template.bob.go deleted file mode 100644 index 82774dda..00000000 --- a/db/factory/comms.email_template.bob.go +++ /dev/null @@ -1,672 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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/jaswdr/faker/v2" -) - -type CommsEmailTemplateMod interface { - Apply(context.Context, *CommsEmailTemplateTemplate) -} - -type CommsEmailTemplateModFunc func(context.Context, *CommsEmailTemplateTemplate) - -func (f CommsEmailTemplateModFunc) Apply(ctx context.Context, n *CommsEmailTemplateTemplate) { - f(ctx, n) -} - -type CommsEmailTemplateModSlice []CommsEmailTemplateMod - -func (mods CommsEmailTemplateModSlice) Apply(ctx context.Context, n *CommsEmailTemplateTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// CommsEmailTemplateTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type CommsEmailTemplateTemplate struct { - ContentHTML func() string - ContentTXT func() string - ContentHashHTML func() string - ContentHashTXT func() string - Created func() time.Time - ID func() int32 - Superceded func() null.Val[time.Time] - MessageType func() enums.CommsMessagetypeemail - - r commsEmailTemplateR - f *Factory - - alreadyPersisted bool -} - -type commsEmailTemplateR struct { - TemplateEmailLogs []*commsEmailTemplateRTemplateEmailLogsR -} - -type commsEmailTemplateRTemplateEmailLogsR struct { - number int - o *CommsEmailLogTemplate -} - -// Apply mods to the CommsEmailTemplateTemplate -func (o *CommsEmailTemplateTemplate) Apply(ctx context.Context, mods ...CommsEmailTemplateMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.CommsEmailTemplate -// according to the relationships in the template. Nothing is inserted into the db -func (t CommsEmailTemplateTemplate) setModelRels(o *models.CommsEmailTemplate) { - if t.r.TemplateEmailLogs != nil { - rel := models.CommsEmailLogSlice{} - for _, r := range t.r.TemplateEmailLogs { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.TemplateID = o.ID // h2 - rel.R.TemplateEmailTemplate = o - } - rel = append(rel, related...) - } - o.R.TemplateEmailLogs = rel - } -} - -// BuildSetter returns an *models.CommsEmailTemplateSetter -// this does nothing with the relationship templates -func (o CommsEmailTemplateTemplate) BuildSetter() *models.CommsEmailTemplateSetter { - m := &models.CommsEmailTemplateSetter{} - - if o.ContentHTML != nil { - val := o.ContentHTML() - m.ContentHTML = omit.From(val) - } - if o.ContentTXT != nil { - val := o.ContentTXT() - m.ContentTXT = omit.From(val) - } - if o.ContentHashHTML != nil { - val := o.ContentHashHTML() - m.ContentHashHTML = omit.From(val) - } - if o.ContentHashTXT != nil { - val := o.ContentHashTXT() - m.ContentHashTXT = omit.From(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.Superceded != nil { - val := o.Superceded() - m.Superceded = omitnull.FromNull(val) - } - if o.MessageType != nil { - val := o.MessageType() - m.MessageType = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.CommsEmailTemplateSetter -// this does nothing with the relationship templates -func (o CommsEmailTemplateTemplate) BuildManySetter(number int) []*models.CommsEmailTemplateSetter { - m := make([]*models.CommsEmailTemplateSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.CommsEmailTemplate -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use CommsEmailTemplateTemplate.Create -func (o CommsEmailTemplateTemplate) Build() *models.CommsEmailTemplate { - m := &models.CommsEmailTemplate{} - - if o.ContentHTML != nil { - m.ContentHTML = o.ContentHTML() - } - if o.ContentTXT != nil { - m.ContentTXT = o.ContentTXT() - } - if o.ContentHashHTML != nil { - m.ContentHashHTML = o.ContentHashHTML() - } - if o.ContentHashTXT != nil { - m.ContentHashTXT = o.ContentHashTXT() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.ID != nil { - m.ID = o.ID() - } - if o.Superceded != nil { - m.Superceded = o.Superceded() - } - if o.MessageType != nil { - m.MessageType = o.MessageType() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.CommsEmailTemplateSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use CommsEmailTemplateTemplate.CreateMany -func (o CommsEmailTemplateTemplate) BuildMany(number int) models.CommsEmailTemplateSlice { - m := make(models.CommsEmailTemplateSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableCommsEmailTemplate(m *models.CommsEmailTemplateSetter) { - if !(m.ContentHTML.IsValue()) { - val := random_string(nil) - m.ContentHTML = omit.From(val) - } - if !(m.ContentTXT.IsValue()) { - val := random_string(nil) - m.ContentTXT = omit.From(val) - } - if !(m.ContentHashHTML.IsValue()) { - val := random_string(nil, "64") - m.ContentHashHTML = omit.From(val) - } - if !(m.ContentHashTXT.IsValue()) { - val := random_string(nil, "64") - m.ContentHashTXT = omit.From(val) - } - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.MessageType.IsValue()) { - val := random_enums_CommsMessagetypeemail(nil) - m.MessageType = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.CommsEmailTemplate -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *CommsEmailTemplateTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.CommsEmailTemplate) error { - var err error - - isTemplateEmailLogsDone, _ := commsEmailTemplateRelTemplateEmailLogsCtx.Value(ctx) - if !isTemplateEmailLogsDone && o.r.TemplateEmailLogs != nil { - ctx = commsEmailTemplateRelTemplateEmailLogsCtx.WithValue(ctx, true) - for _, r := range o.r.TemplateEmailLogs { - if r.o.alreadyPersisted { - m.R.TemplateEmailLogs = append(m.R.TemplateEmailLogs, r.o.Build()) - } else { - rel0, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachTemplateEmailLogs(ctx, exec, rel0...) - if err != nil { - return err - } - } - } - } - - return err -} - -// Create builds a commsEmailTemplate and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *CommsEmailTemplateTemplate) Create(ctx context.Context, exec bob.Executor) (*models.CommsEmailTemplate, error) { - var err error - opt := o.BuildSetter() - ensureCreatableCommsEmailTemplate(opt) - - m, err := models.CommsEmailTemplates.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a commsEmailTemplate and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *CommsEmailTemplateTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.CommsEmailTemplate { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a commsEmailTemplate 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 *CommsEmailTemplateTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.CommsEmailTemplate { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple commsEmailTemplates and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o CommsEmailTemplateTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.CommsEmailTemplateSlice, error) { - var err error - m := make(models.CommsEmailTemplateSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple commsEmailTemplates and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o CommsEmailTemplateTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.CommsEmailTemplateSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple commsEmailTemplates 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 CommsEmailTemplateTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.CommsEmailTemplateSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CommsEmailTemplate has methods that act as mods for the CommsEmailTemplateTemplate -var CommsEmailTemplateMods commsEmailTemplateMods - -type commsEmailTemplateMods struct{} - -func (m commsEmailTemplateMods) RandomizeAllColumns(f *faker.Faker) CommsEmailTemplateMod { - return CommsEmailTemplateModSlice{ - CommsEmailTemplateMods.RandomContentHTML(f), - CommsEmailTemplateMods.RandomContentTXT(f), - CommsEmailTemplateMods.RandomContentHashHTML(f), - CommsEmailTemplateMods.RandomContentHashTXT(f), - CommsEmailTemplateMods.RandomCreated(f), - CommsEmailTemplateMods.RandomID(f), - CommsEmailTemplateMods.RandomSuperceded(f), - CommsEmailTemplateMods.RandomMessageType(f), - } -} - -// Set the model columns to this value -func (m commsEmailTemplateMods) ContentHTML(val string) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.ContentHTML = func() string { return val } - }) -} - -// Set the Column from the function -func (m commsEmailTemplateMods) ContentHTMLFunc(f func() string) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.ContentHTML = f - }) -} - -// Clear any values for the column -func (m commsEmailTemplateMods) UnsetContentHTML() CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.ContentHTML = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsEmailTemplateMods) RandomContentHTML(f *faker.Faker) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.ContentHTML = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m commsEmailTemplateMods) ContentTXT(val string) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.ContentTXT = func() string { return val } - }) -} - -// Set the Column from the function -func (m commsEmailTemplateMods) ContentTXTFunc(f func() string) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.ContentTXT = f - }) -} - -// Clear any values for the column -func (m commsEmailTemplateMods) UnsetContentTXT() CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.ContentTXT = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsEmailTemplateMods) RandomContentTXT(f *faker.Faker) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.ContentTXT = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m commsEmailTemplateMods) ContentHashHTML(val string) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.ContentHashHTML = func() string { return val } - }) -} - -// Set the Column from the function -func (m commsEmailTemplateMods) ContentHashHTMLFunc(f func() string) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.ContentHashHTML = f - }) -} - -// Clear any values for the column -func (m commsEmailTemplateMods) UnsetContentHashHTML() CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.ContentHashHTML = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsEmailTemplateMods) RandomContentHashHTML(f *faker.Faker) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.ContentHashHTML = func() string { - return random_string(f, "64") - } - }) -} - -// Set the model columns to this value -func (m commsEmailTemplateMods) ContentHashTXT(val string) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.ContentHashTXT = func() string { return val } - }) -} - -// Set the Column from the function -func (m commsEmailTemplateMods) ContentHashTXTFunc(f func() string) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.ContentHashTXT = f - }) -} - -// Clear any values for the column -func (m commsEmailTemplateMods) UnsetContentHashTXT() CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.ContentHashTXT = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsEmailTemplateMods) RandomContentHashTXT(f *faker.Faker) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.ContentHashTXT = func() string { - return random_string(f, "64") - } - }) -} - -// Set the model columns to this value -func (m commsEmailTemplateMods) Created(val time.Time) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m commsEmailTemplateMods) CreatedFunc(f func() time.Time) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m commsEmailTemplateMods) UnsetCreated() CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - 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 commsEmailTemplateMods) RandomCreated(f *faker.Faker) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m commsEmailTemplateMods) ID(val int32) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m commsEmailTemplateMods) IDFunc(f func() int32) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m commsEmailTemplateMods) UnsetID() CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsEmailTemplateMods) RandomID(f *faker.Faker) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m commsEmailTemplateMods) Superceded(val null.Val[time.Time]) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.Superceded = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m commsEmailTemplateMods) SupercededFunc(f func() null.Val[time.Time]) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.Superceded = f - }) -} - -// Clear any values for the column -func (m commsEmailTemplateMods) UnsetSuperceded() CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.Superceded = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m commsEmailTemplateMods) RandomSuperceded(f *faker.Faker) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.Superceded = 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 commsEmailTemplateMods) RandomSupercededNotNull(f *faker.Faker) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.Superceded = 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 commsEmailTemplateMods) MessageType(val enums.CommsMessagetypeemail) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.MessageType = func() enums.CommsMessagetypeemail { return val } - }) -} - -// Set the Column from the function -func (m commsEmailTemplateMods) MessageTypeFunc(f func() enums.CommsMessagetypeemail) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.MessageType = f - }) -} - -// Clear any values for the column -func (m commsEmailTemplateMods) UnsetMessageType() CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.MessageType = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsEmailTemplateMods) RandomMessageType(f *faker.Faker) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(_ context.Context, o *CommsEmailTemplateTemplate) { - o.MessageType = func() enums.CommsMessagetypeemail { - return random_enums_CommsMessagetypeemail(f) - } - }) -} - -func (m commsEmailTemplateMods) WithParentsCascading() CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(ctx context.Context, o *CommsEmailTemplateTemplate) { - if isDone, _ := commsEmailTemplateWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = commsEmailTemplateWithParentsCascadingCtx.WithValue(ctx, true) - }) -} - -func (m commsEmailTemplateMods) WithTemplateEmailLogs(number int, related *CommsEmailLogTemplate) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(ctx context.Context, o *CommsEmailTemplateTemplate) { - o.r.TemplateEmailLogs = []*commsEmailTemplateRTemplateEmailLogsR{{ - number: number, - o: related, - }} - }) -} - -func (m commsEmailTemplateMods) WithNewTemplateEmailLogs(number int, mods ...CommsEmailLogMod) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(ctx context.Context, o *CommsEmailTemplateTemplate) { - related := o.f.NewCommsEmailLogWithContext(ctx, mods...) - m.WithTemplateEmailLogs(number, related).Apply(ctx, o) - }) -} - -func (m commsEmailTemplateMods) AddTemplateEmailLogs(number int, related *CommsEmailLogTemplate) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(ctx context.Context, o *CommsEmailTemplateTemplate) { - o.r.TemplateEmailLogs = append(o.r.TemplateEmailLogs, &commsEmailTemplateRTemplateEmailLogsR{ - number: number, - o: related, - }) - }) -} - -func (m commsEmailTemplateMods) AddNewTemplateEmailLogs(number int, mods ...CommsEmailLogMod) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(ctx context.Context, o *CommsEmailTemplateTemplate) { - related := o.f.NewCommsEmailLogWithContext(ctx, mods...) - m.AddTemplateEmailLogs(number, related).Apply(ctx, o) - }) -} - -func (m commsEmailTemplateMods) AddExistingTemplateEmailLogs(existingModels ...*models.CommsEmailLog) CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(ctx context.Context, o *CommsEmailTemplateTemplate) { - for _, em := range existingModels { - o.r.TemplateEmailLogs = append(o.r.TemplateEmailLogs, &commsEmailTemplateRTemplateEmailLogsR{ - o: o.f.FromExistingCommsEmailLog(em), - }) - } - }) -} - -func (m commsEmailTemplateMods) WithoutTemplateEmailLogs() CommsEmailTemplateMod { - return CommsEmailTemplateModFunc(func(ctx context.Context, o *CommsEmailTemplateTemplate) { - o.r.TemplateEmailLogs = nil - }) -} diff --git a/db/factory/comms.mailer.bob.go b/db/factory/comms.mailer.bob.go deleted file mode 100644 index af79060f..00000000 --- a/db/factory/comms.mailer.bob.go +++ /dev/null @@ -1,564 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/omit" - "github.com/google/uuid" - "github.com/jaswdr/faker/v2" -) - -type CommsMailerMod interface { - Apply(context.Context, *CommsMailerTemplate) -} - -type CommsMailerModFunc func(context.Context, *CommsMailerTemplate) - -func (f CommsMailerModFunc) Apply(ctx context.Context, n *CommsMailerTemplate) { - f(ctx, n) -} - -type CommsMailerModSlice []CommsMailerMod - -func (mods CommsMailerModSlice) Apply(ctx context.Context, n *CommsMailerTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// CommsMailerTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type CommsMailerTemplate struct { - AddressID func() int32 - Created func() time.Time - ID func() int32 - Recipient func() string - UUID func() uuid.UUID - - r commsMailerR - f *Factory - - alreadyPersisted bool -} - -type commsMailerR struct { - Address *commsMailerRAddressR - ComplianceReportRequests []*commsMailerRComplianceReportRequestsR -} - -type commsMailerRAddressR struct { - o *AddressTemplate -} -type commsMailerRComplianceReportRequestsR struct { - number int - o *ComplianceReportRequestTemplate -} - -// Apply mods to the CommsMailerTemplate -func (o *CommsMailerTemplate) Apply(ctx context.Context, mods ...CommsMailerMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.CommsMailer -// according to the relationships in the template. Nothing is inserted into the db -func (t CommsMailerTemplate) setModelRels(o *models.CommsMailer) { - if t.r.Address != nil { - rel := t.r.Address.o.Build() - rel.R.Mailers = append(rel.R.Mailers, o) - o.AddressID = rel.ID // h2 - o.R.Address = rel - } - - if t.r.ComplianceReportRequests != nil { - rel := models.ComplianceReportRequestSlice{} - for _, r := range t.r.ComplianceReportRequests { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.R.Mailers = append(rel.R.Mailers, o) - } - rel = append(rel, related...) - } - o.R.ComplianceReportRequests = rel - } -} - -// BuildSetter returns an *models.CommsMailerSetter -// this does nothing with the relationship templates -func (o CommsMailerTemplate) BuildSetter() *models.CommsMailerSetter { - m := &models.CommsMailerSetter{} - - if o.AddressID != nil { - val := o.AddressID() - m.AddressID = omit.From(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.Recipient != nil { - val := o.Recipient() - m.Recipient = omit.From(val) - } - if o.UUID != nil { - val := o.UUID() - m.UUID = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.CommsMailerSetter -// this does nothing with the relationship templates -func (o CommsMailerTemplate) BuildManySetter(number int) []*models.CommsMailerSetter { - m := make([]*models.CommsMailerSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.CommsMailer -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use CommsMailerTemplate.Create -func (o CommsMailerTemplate) Build() *models.CommsMailer { - m := &models.CommsMailer{} - - if o.AddressID != nil { - m.AddressID = o.AddressID() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.ID != nil { - m.ID = o.ID() - } - if o.Recipient != nil { - m.Recipient = o.Recipient() - } - if o.UUID != nil { - m.UUID = o.UUID() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.CommsMailerSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use CommsMailerTemplate.CreateMany -func (o CommsMailerTemplate) BuildMany(number int) models.CommsMailerSlice { - m := make(models.CommsMailerSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableCommsMailer(m *models.CommsMailerSetter) { - if !(m.AddressID.IsValue()) { - val := random_int32(nil) - m.AddressID = omit.From(val) - } - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.Recipient.IsValue()) { - val := random_string(nil) - m.Recipient = 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.CommsMailer -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *CommsMailerTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.CommsMailer) error { - var err error - - return err -} - -// Create builds a commsMailer and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *CommsMailerTemplate) Create(ctx context.Context, exec bob.Executor) (*models.CommsMailer, error) { - var err error - opt := o.BuildSetter() - ensureCreatableCommsMailer(opt) - - if o.r.Address == nil { - CommsMailerMods.WithNewAddress().Apply(ctx, o) - } - - var rel0 *models.Address - - if o.r.Address.o.alreadyPersisted { - rel0 = o.r.Address.o.Build() - } else { - rel0, err = o.r.Address.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.AddressID = omit.From(rel0.ID) - - m, err := models.CommsMailers.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.Address = rel0 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a commsMailer and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *CommsMailerTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.CommsMailer { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a commsMailer 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 *CommsMailerTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.CommsMailer { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple commsMailers and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o CommsMailerTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.CommsMailerSlice, error) { - var err error - m := make(models.CommsMailerSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple commsMailers and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o CommsMailerTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.CommsMailerSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple commsMailers 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 CommsMailerTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.CommsMailerSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CommsMailer has methods that act as mods for the CommsMailerTemplate -var CommsMailerMods commsMailerMods - -type commsMailerMods struct{} - -func (m commsMailerMods) RandomizeAllColumns(f *faker.Faker) CommsMailerMod { - return CommsMailerModSlice{ - CommsMailerMods.RandomAddressID(f), - CommsMailerMods.RandomCreated(f), - CommsMailerMods.RandomID(f), - CommsMailerMods.RandomRecipient(f), - CommsMailerMods.RandomUUID(f), - } -} - -// Set the model columns to this value -func (m commsMailerMods) AddressID(val int32) CommsMailerMod { - return CommsMailerModFunc(func(_ context.Context, o *CommsMailerTemplate) { - o.AddressID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m commsMailerMods) AddressIDFunc(f func() int32) CommsMailerMod { - return CommsMailerModFunc(func(_ context.Context, o *CommsMailerTemplate) { - o.AddressID = f - }) -} - -// Clear any values for the column -func (m commsMailerMods) UnsetAddressID() CommsMailerMod { - return CommsMailerModFunc(func(_ context.Context, o *CommsMailerTemplate) { - o.AddressID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsMailerMods) RandomAddressID(f *faker.Faker) CommsMailerMod { - return CommsMailerModFunc(func(_ context.Context, o *CommsMailerTemplate) { - o.AddressID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m commsMailerMods) Created(val time.Time) CommsMailerMod { - return CommsMailerModFunc(func(_ context.Context, o *CommsMailerTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m commsMailerMods) CreatedFunc(f func() time.Time) CommsMailerMod { - return CommsMailerModFunc(func(_ context.Context, o *CommsMailerTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m commsMailerMods) UnsetCreated() CommsMailerMod { - return CommsMailerModFunc(func(_ context.Context, o *CommsMailerTemplate) { - 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 commsMailerMods) RandomCreated(f *faker.Faker) CommsMailerMod { - return CommsMailerModFunc(func(_ context.Context, o *CommsMailerTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m commsMailerMods) ID(val int32) CommsMailerMod { - return CommsMailerModFunc(func(_ context.Context, o *CommsMailerTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m commsMailerMods) IDFunc(f func() int32) CommsMailerMod { - return CommsMailerModFunc(func(_ context.Context, o *CommsMailerTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m commsMailerMods) UnsetID() CommsMailerMod { - return CommsMailerModFunc(func(_ context.Context, o *CommsMailerTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsMailerMods) RandomID(f *faker.Faker) CommsMailerMod { - return CommsMailerModFunc(func(_ context.Context, o *CommsMailerTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m commsMailerMods) Recipient(val string) CommsMailerMod { - return CommsMailerModFunc(func(_ context.Context, o *CommsMailerTemplate) { - o.Recipient = func() string { return val } - }) -} - -// Set the Column from the function -func (m commsMailerMods) RecipientFunc(f func() string) CommsMailerMod { - return CommsMailerModFunc(func(_ context.Context, o *CommsMailerTemplate) { - o.Recipient = f - }) -} - -// Clear any values for the column -func (m commsMailerMods) UnsetRecipient() CommsMailerMod { - return CommsMailerModFunc(func(_ context.Context, o *CommsMailerTemplate) { - o.Recipient = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsMailerMods) RandomRecipient(f *faker.Faker) CommsMailerMod { - return CommsMailerModFunc(func(_ context.Context, o *CommsMailerTemplate) { - o.Recipient = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m commsMailerMods) UUID(val uuid.UUID) CommsMailerMod { - return CommsMailerModFunc(func(_ context.Context, o *CommsMailerTemplate) { - o.UUID = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m commsMailerMods) UUIDFunc(f func() uuid.UUID) CommsMailerMod { - return CommsMailerModFunc(func(_ context.Context, o *CommsMailerTemplate) { - o.UUID = f - }) -} - -// Clear any values for the column -func (m commsMailerMods) UnsetUUID() CommsMailerMod { - return CommsMailerModFunc(func(_ context.Context, o *CommsMailerTemplate) { - 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 commsMailerMods) RandomUUID(f *faker.Faker) CommsMailerMod { - return CommsMailerModFunc(func(_ context.Context, o *CommsMailerTemplate) { - o.UUID = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -func (m commsMailerMods) WithParentsCascading() CommsMailerMod { - return CommsMailerModFunc(func(ctx context.Context, o *CommsMailerTemplate) { - if isDone, _ := commsMailerWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = commsMailerWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewAddressWithContext(ctx, AddressMods.WithParentsCascading()) - m.WithAddress(related).Apply(ctx, o) - } - }) -} - -func (m commsMailerMods) WithAddress(rel *AddressTemplate) CommsMailerMod { - return CommsMailerModFunc(func(ctx context.Context, o *CommsMailerTemplate) { - o.r.Address = &commsMailerRAddressR{ - o: rel, - } - }) -} - -func (m commsMailerMods) WithNewAddress(mods ...AddressMod) CommsMailerMod { - return CommsMailerModFunc(func(ctx context.Context, o *CommsMailerTemplate) { - related := o.f.NewAddressWithContext(ctx, mods...) - - m.WithAddress(related).Apply(ctx, o) - }) -} - -func (m commsMailerMods) WithExistingAddress(em *models.Address) CommsMailerMod { - return CommsMailerModFunc(func(ctx context.Context, o *CommsMailerTemplate) { - o.r.Address = &commsMailerRAddressR{ - o: o.f.FromExistingAddress(em), - } - }) -} - -func (m commsMailerMods) WithoutAddress() CommsMailerMod { - return CommsMailerModFunc(func(ctx context.Context, o *CommsMailerTemplate) { - o.r.Address = nil - }) -} - -func (m commsMailerMods) WithComplianceReportRequests(number int, related *ComplianceReportRequestTemplate) CommsMailerMod { - return CommsMailerModFunc(func(ctx context.Context, o *CommsMailerTemplate) { - o.r.ComplianceReportRequests = []*commsMailerRComplianceReportRequestsR{{ - number: number, - o: related, - }} - }) -} - -func (m commsMailerMods) WithNewComplianceReportRequests(number int, mods ...ComplianceReportRequestMod) CommsMailerMod { - return CommsMailerModFunc(func(ctx context.Context, o *CommsMailerTemplate) { - related := o.f.NewComplianceReportRequestWithContext(ctx, mods...) - m.WithComplianceReportRequests(number, related).Apply(ctx, o) - }) -} - -func (m commsMailerMods) AddComplianceReportRequests(number int, related *ComplianceReportRequestTemplate) CommsMailerMod { - return CommsMailerModFunc(func(ctx context.Context, o *CommsMailerTemplate) { - o.r.ComplianceReportRequests = append(o.r.ComplianceReportRequests, &commsMailerRComplianceReportRequestsR{ - number: number, - o: related, - }) - }) -} - -func (m commsMailerMods) AddNewComplianceReportRequests(number int, mods ...ComplianceReportRequestMod) CommsMailerMod { - return CommsMailerModFunc(func(ctx context.Context, o *CommsMailerTemplate) { - related := o.f.NewComplianceReportRequestWithContext(ctx, mods...) - m.AddComplianceReportRequests(number, related).Apply(ctx, o) - }) -} - -func (m commsMailerMods) AddExistingComplianceReportRequests(existingModels ...*models.ComplianceReportRequest) CommsMailerMod { - return CommsMailerModFunc(func(ctx context.Context, o *CommsMailerTemplate) { - for _, em := range existingModels { - o.r.ComplianceReportRequests = append(o.r.ComplianceReportRequests, &commsMailerRComplianceReportRequestsR{ - o: o.f.FromExistingComplianceReportRequest(em), - }) - } - }) -} - -func (m commsMailerMods) WithoutComplianceReportRequests() CommsMailerMod { - return CommsMailerModFunc(func(ctx context.Context, o *CommsMailerTemplate) { - o.r.ComplianceReportRequests = nil - }) -} diff --git a/db/factory/comms.phone.bob.go b/db/factory/comms.phone.bob.go deleted file mode 100644 index 5250ce18..00000000 --- a/db/factory/comms.phone.bob.go +++ /dev/null @@ -1,1209 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - 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/jaswdr/faker/v2" -) - -type CommsPhoneMod interface { - Apply(context.Context, *CommsPhoneTemplate) -} - -type CommsPhoneModFunc func(context.Context, *CommsPhoneTemplate) - -func (f CommsPhoneModFunc) Apply(ctx context.Context, n *CommsPhoneTemplate) { - f(ctx, n) -} - -type CommsPhoneModSlice []CommsPhoneMod - -func (mods CommsPhoneModSlice) Apply(ctx context.Context, n *CommsPhoneTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// CommsPhoneTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type CommsPhoneTemplate struct { - E164 func() string - IsSubscribed func() bool - Status func() enums.CommsPhonestatustype - - r commsPhoneR - f *Factory - - alreadyPersisted bool -} - -type commsPhoneR struct { - DestinationTextJobs []*commsPhoneRDestinationTextJobsR - DestinationTextLogs []*commsPhoneRDestinationTextLogsR - SourceTextLogs []*commsPhoneRSourceTextLogsR - Organizations []*commsPhoneROrganizationsR - PropertyOwnerPhoneE164Pools []*commsPhoneRPropertyOwnerPhoneE164PoolsR - ResidentPhoneE164Pools []*commsPhoneRResidentPhoneE164PoolsR - PhoneE164NotifyPhoneNuisances []*commsPhoneRPhoneE164NotifyPhoneNuisancesR - PhoneE164NotifyPhonePools []*commsPhoneRPhoneE164NotifyPhonePoolsR - PhoneE164SubscribePhones []*commsPhoneRPhoneE164SubscribePhonesR - PhoneMobileResidents []*commsPhoneRPhoneMobileResidentsR -} - -type commsPhoneRDestinationTextJobsR struct { - number int - o *CommsTextJobTemplate -} -type commsPhoneRDestinationTextLogsR struct { - number int - o *CommsTextLogTemplate -} -type commsPhoneRSourceTextLogsR struct { - number int - o *CommsTextLogTemplate -} -type commsPhoneROrganizationsR struct { - number int - o *OrganizationTemplate -} -type commsPhoneRPropertyOwnerPhoneE164PoolsR struct { - number int - o *FileuploadPoolTemplate -} -type commsPhoneRResidentPhoneE164PoolsR struct { - number int - o *FileuploadPoolTemplate -} -type commsPhoneRPhoneE164NotifyPhoneNuisancesR struct { - number int - o *PublicreportNotifyPhoneNuisanceTemplate -} -type commsPhoneRPhoneE164NotifyPhonePoolsR struct { - number int - o *PublicreportNotifyPhonePoolTemplate -} -type commsPhoneRPhoneE164SubscribePhonesR struct { - number int - o *PublicreportSubscribePhoneTemplate -} -type commsPhoneRPhoneMobileResidentsR struct { - number int - o *ResidentTemplate -} - -// Apply mods to the CommsPhoneTemplate -func (o *CommsPhoneTemplate) Apply(ctx context.Context, mods ...CommsPhoneMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.CommsPhone -// according to the relationships in the template. Nothing is inserted into the db -func (t CommsPhoneTemplate) setModelRels(o *models.CommsPhone) { - if t.r.DestinationTextJobs != nil { - rel := models.CommsTextJobSlice{} - for _, r := range t.r.DestinationTextJobs { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.Destination = o.E164 // h2 - rel.R.DestinationPhone = o - } - rel = append(rel, related...) - } - o.R.DestinationTextJobs = rel - } - - if t.r.DestinationTextLogs != nil { - rel := models.CommsTextLogSlice{} - for _, r := range t.r.DestinationTextLogs { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.Destination = o.E164 // h2 - rel.R.DestinationPhone = o - } - rel = append(rel, related...) - } - o.R.DestinationTextLogs = rel - } - - if t.r.SourceTextLogs != nil { - rel := models.CommsTextLogSlice{} - for _, r := range t.r.SourceTextLogs { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.Source = o.E164 // h2 - rel.R.SourcePhone = o - } - rel = append(rel, related...) - } - o.R.SourceTextLogs = rel - } - - if t.r.Organizations != nil { - rel := models.OrganizationSlice{} - for _, r := range t.r.Organizations { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.R.Phones = append(rel.R.Phones, o) - } - rel = append(rel, related...) - } - o.R.Organizations = rel - } - - if t.r.PropertyOwnerPhoneE164Pools != nil { - rel := models.FileuploadPoolSlice{} - for _, r := range t.r.PropertyOwnerPhoneE164Pools { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.PropertyOwnerPhoneE164 = null.From(o.E164) // h2 - rel.R.PropertyOwnerPhoneE164Phone = o - } - rel = append(rel, related...) - } - o.R.PropertyOwnerPhoneE164Pools = rel - } - - if t.r.ResidentPhoneE164Pools != nil { - rel := models.FileuploadPoolSlice{} - for _, r := range t.r.ResidentPhoneE164Pools { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.ResidentPhoneE164 = null.From(o.E164) // h2 - rel.R.ResidentPhoneE164Phone = o - } - rel = append(rel, related...) - } - o.R.ResidentPhoneE164Pools = rel - } - - if t.r.PhoneE164NotifyPhoneNuisances != nil { - rel := models.PublicreportNotifyPhoneNuisanceSlice{} - for _, r := range t.r.PhoneE164NotifyPhoneNuisances { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.PhoneE164 = o.E164 // h2 - rel.R.PhoneE164Phone = o - } - rel = append(rel, related...) - } - o.R.PhoneE164NotifyPhoneNuisances = rel - } - - if t.r.PhoneE164NotifyPhonePools != nil { - rel := models.PublicreportNotifyPhonePoolSlice{} - for _, r := range t.r.PhoneE164NotifyPhonePools { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.PhoneE164 = o.E164 // h2 - rel.R.PhoneE164Phone = o - } - rel = append(rel, related...) - } - o.R.PhoneE164NotifyPhonePools = rel - } - - if t.r.PhoneE164SubscribePhones != nil { - rel := models.PublicreportSubscribePhoneSlice{} - for _, r := range t.r.PhoneE164SubscribePhones { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.PhoneE164 = o.E164 // h2 - rel.R.PhoneE164Phone = o - } - rel = append(rel, related...) - } - o.R.PhoneE164SubscribePhones = rel - } - - if t.r.PhoneMobileResidents != nil { - rel := models.ResidentSlice{} - for _, r := range t.r.PhoneMobileResidents { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.PhoneMobile = null.From(o.E164) // h2 - rel.R.PhoneMobilePhone = o - } - rel = append(rel, related...) - } - o.R.PhoneMobileResidents = rel - } -} - -// BuildSetter returns an *models.CommsPhoneSetter -// this does nothing with the relationship templates -func (o CommsPhoneTemplate) BuildSetter() *models.CommsPhoneSetter { - m := &models.CommsPhoneSetter{} - - if o.E164 != nil { - val := o.E164() - m.E164 = omit.From(val) - } - if o.IsSubscribed != nil { - val := o.IsSubscribed() - m.IsSubscribed = omit.From(val) - } - if o.Status != nil { - val := o.Status() - m.Status = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.CommsPhoneSetter -// this does nothing with the relationship templates -func (o CommsPhoneTemplate) BuildManySetter(number int) []*models.CommsPhoneSetter { - m := make([]*models.CommsPhoneSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.CommsPhone -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use CommsPhoneTemplate.Create -func (o CommsPhoneTemplate) Build() *models.CommsPhone { - m := &models.CommsPhone{} - - if o.E164 != nil { - m.E164 = o.E164() - } - if o.IsSubscribed != nil { - m.IsSubscribed = o.IsSubscribed() - } - if o.Status != nil { - m.Status = o.Status() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.CommsPhoneSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use CommsPhoneTemplate.CreateMany -func (o CommsPhoneTemplate) BuildMany(number int) models.CommsPhoneSlice { - m := make(models.CommsPhoneSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableCommsPhone(m *models.CommsPhoneSetter) { - if !(m.E164.IsValue()) { - val := random_string(nil) - m.E164 = omit.From(val) - } - if !(m.IsSubscribed.IsValue()) { - val := random_bool(nil) - m.IsSubscribed = omit.From(val) - } - if !(m.Status.IsValue()) { - val := random_enums_CommsPhonestatustype(nil) - m.Status = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.CommsPhone -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *CommsPhoneTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.CommsPhone) error { - var err error - - isDestinationTextJobsDone, _ := commsPhoneRelDestinationTextJobsCtx.Value(ctx) - if !isDestinationTextJobsDone && o.r.DestinationTextJobs != nil { - ctx = commsPhoneRelDestinationTextJobsCtx.WithValue(ctx, true) - for _, r := range o.r.DestinationTextJobs { - if r.o.alreadyPersisted { - m.R.DestinationTextJobs = append(m.R.DestinationTextJobs, r.o.Build()) - } else { - rel0, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachDestinationTextJobs(ctx, exec, rel0...) - if err != nil { - return err - } - } - } - } - - isDestinationTextLogsDone, _ := commsPhoneRelDestinationTextLogsCtx.Value(ctx) - if !isDestinationTextLogsDone && o.r.DestinationTextLogs != nil { - ctx = commsPhoneRelDestinationTextLogsCtx.WithValue(ctx, true) - for _, r := range o.r.DestinationTextLogs { - if r.o.alreadyPersisted { - m.R.DestinationTextLogs = append(m.R.DestinationTextLogs, r.o.Build()) - } else { - rel1, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachDestinationTextLogs(ctx, exec, rel1...) - if err != nil { - return err - } - } - } - } - - isSourceTextLogsDone, _ := commsPhoneRelSourceTextLogsCtx.Value(ctx) - if !isSourceTextLogsDone && o.r.SourceTextLogs != nil { - ctx = commsPhoneRelSourceTextLogsCtx.WithValue(ctx, true) - for _, r := range o.r.SourceTextLogs { - if r.o.alreadyPersisted { - m.R.SourceTextLogs = append(m.R.SourceTextLogs, r.o.Build()) - } else { - rel2, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachSourceTextLogs(ctx, exec, rel2...) - if err != nil { - return err - } - } - } - } - - isOrganizationsDone, _ := commsPhoneRelOrganizationsCtx.Value(ctx) - if !isOrganizationsDone && o.r.Organizations != nil { - ctx = commsPhoneRelOrganizationsCtx.WithValue(ctx, true) - for _, r := range o.r.Organizations { - if r.o.alreadyPersisted { - m.R.Organizations = append(m.R.Organizations, r.o.Build()) - } else { - rel3, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachOrganizations(ctx, exec, rel3...) - if err != nil { - return err - } - } - } - } - - isPropertyOwnerPhoneE164PoolsDone, _ := commsPhoneRelPropertyOwnerPhoneE164PoolsCtx.Value(ctx) - if !isPropertyOwnerPhoneE164PoolsDone && o.r.PropertyOwnerPhoneE164Pools != nil { - ctx = commsPhoneRelPropertyOwnerPhoneE164PoolsCtx.WithValue(ctx, true) - for _, r := range o.r.PropertyOwnerPhoneE164Pools { - if r.o.alreadyPersisted { - m.R.PropertyOwnerPhoneE164Pools = append(m.R.PropertyOwnerPhoneE164Pools, r.o.Build()) - } else { - rel4, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachPropertyOwnerPhoneE164Pools(ctx, exec, rel4...) - if err != nil { - return err - } - } - } - } - - isResidentPhoneE164PoolsDone, _ := commsPhoneRelResidentPhoneE164PoolsCtx.Value(ctx) - if !isResidentPhoneE164PoolsDone && o.r.ResidentPhoneE164Pools != nil { - ctx = commsPhoneRelResidentPhoneE164PoolsCtx.WithValue(ctx, true) - for _, r := range o.r.ResidentPhoneE164Pools { - if r.o.alreadyPersisted { - m.R.ResidentPhoneE164Pools = append(m.R.ResidentPhoneE164Pools, r.o.Build()) - } else { - rel5, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachResidentPhoneE164Pools(ctx, exec, rel5...) - if err != nil { - return err - } - } - } - } - - isPhoneE164NotifyPhoneNuisancesDone, _ := commsPhoneRelPhoneE164NotifyPhoneNuisancesCtx.Value(ctx) - if !isPhoneE164NotifyPhoneNuisancesDone && o.r.PhoneE164NotifyPhoneNuisances != nil { - ctx = commsPhoneRelPhoneE164NotifyPhoneNuisancesCtx.WithValue(ctx, true) - for _, r := range o.r.PhoneE164NotifyPhoneNuisances { - if r.o.alreadyPersisted { - m.R.PhoneE164NotifyPhoneNuisances = append(m.R.PhoneE164NotifyPhoneNuisances, r.o.Build()) - } else { - rel6, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachPhoneE164NotifyPhoneNuisances(ctx, exec, rel6...) - if err != nil { - return err - } - } - } - } - - isPhoneE164NotifyPhonePoolsDone, _ := commsPhoneRelPhoneE164NotifyPhonePoolsCtx.Value(ctx) - if !isPhoneE164NotifyPhonePoolsDone && o.r.PhoneE164NotifyPhonePools != nil { - ctx = commsPhoneRelPhoneE164NotifyPhonePoolsCtx.WithValue(ctx, true) - for _, r := range o.r.PhoneE164NotifyPhonePools { - if r.o.alreadyPersisted { - m.R.PhoneE164NotifyPhonePools = append(m.R.PhoneE164NotifyPhonePools, r.o.Build()) - } else { - rel7, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachPhoneE164NotifyPhonePools(ctx, exec, rel7...) - if err != nil { - return err - } - } - } - } - - isPhoneE164SubscribePhonesDone, _ := commsPhoneRelPhoneE164SubscribePhonesCtx.Value(ctx) - if !isPhoneE164SubscribePhonesDone && o.r.PhoneE164SubscribePhones != nil { - ctx = commsPhoneRelPhoneE164SubscribePhonesCtx.WithValue(ctx, true) - for _, r := range o.r.PhoneE164SubscribePhones { - if r.o.alreadyPersisted { - m.R.PhoneE164SubscribePhones = append(m.R.PhoneE164SubscribePhones, r.o.Build()) - } else { - rel8, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachPhoneE164SubscribePhones(ctx, exec, rel8...) - if err != nil { - return err - } - } - } - } - - isPhoneMobileResidentsDone, _ := commsPhoneRelPhoneMobileResidentsCtx.Value(ctx) - if !isPhoneMobileResidentsDone && o.r.PhoneMobileResidents != nil { - ctx = commsPhoneRelPhoneMobileResidentsCtx.WithValue(ctx, true) - for _, r := range o.r.PhoneMobileResidents { - if r.o.alreadyPersisted { - m.R.PhoneMobileResidents = append(m.R.PhoneMobileResidents, r.o.Build()) - } else { - rel9, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachPhoneMobileResidents(ctx, exec, rel9...) - if err != nil { - return err - } - } - } - } - - return err -} - -// Create builds a commsPhone and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *CommsPhoneTemplate) Create(ctx context.Context, exec bob.Executor) (*models.CommsPhone, error) { - var err error - opt := o.BuildSetter() - ensureCreatableCommsPhone(opt) - - m, err := models.CommsPhones.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a commsPhone and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *CommsPhoneTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.CommsPhone { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a commsPhone 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 *CommsPhoneTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.CommsPhone { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple commsPhones and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o CommsPhoneTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.CommsPhoneSlice, error) { - var err error - m := make(models.CommsPhoneSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple commsPhones and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o CommsPhoneTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.CommsPhoneSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple commsPhones 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 CommsPhoneTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.CommsPhoneSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CommsPhone has methods that act as mods for the CommsPhoneTemplate -var CommsPhoneMods commsPhoneMods - -type commsPhoneMods struct{} - -func (m commsPhoneMods) RandomizeAllColumns(f *faker.Faker) CommsPhoneMod { - return CommsPhoneModSlice{ - CommsPhoneMods.RandomE164(f), - CommsPhoneMods.RandomIsSubscribed(f), - CommsPhoneMods.RandomStatus(f), - } -} - -// Set the model columns to this value -func (m commsPhoneMods) E164(val string) CommsPhoneMod { - return CommsPhoneModFunc(func(_ context.Context, o *CommsPhoneTemplate) { - o.E164 = func() string { return val } - }) -} - -// Set the Column from the function -func (m commsPhoneMods) E164Func(f func() string) CommsPhoneMod { - return CommsPhoneModFunc(func(_ context.Context, o *CommsPhoneTemplate) { - o.E164 = f - }) -} - -// Clear any values for the column -func (m commsPhoneMods) UnsetE164() CommsPhoneMod { - return CommsPhoneModFunc(func(_ context.Context, o *CommsPhoneTemplate) { - o.E164 = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsPhoneMods) RandomE164(f *faker.Faker) CommsPhoneMod { - return CommsPhoneModFunc(func(_ context.Context, o *CommsPhoneTemplate) { - o.E164 = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m commsPhoneMods) IsSubscribed(val bool) CommsPhoneMod { - return CommsPhoneModFunc(func(_ context.Context, o *CommsPhoneTemplate) { - o.IsSubscribed = func() bool { return val } - }) -} - -// Set the Column from the function -func (m commsPhoneMods) IsSubscribedFunc(f func() bool) CommsPhoneMod { - return CommsPhoneModFunc(func(_ context.Context, o *CommsPhoneTemplate) { - o.IsSubscribed = f - }) -} - -// Clear any values for the column -func (m commsPhoneMods) UnsetIsSubscribed() CommsPhoneMod { - return CommsPhoneModFunc(func(_ context.Context, o *CommsPhoneTemplate) { - o.IsSubscribed = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsPhoneMods) RandomIsSubscribed(f *faker.Faker) CommsPhoneMod { - return CommsPhoneModFunc(func(_ context.Context, o *CommsPhoneTemplate) { - o.IsSubscribed = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m commsPhoneMods) Status(val enums.CommsPhonestatustype) CommsPhoneMod { - return CommsPhoneModFunc(func(_ context.Context, o *CommsPhoneTemplate) { - o.Status = func() enums.CommsPhonestatustype { return val } - }) -} - -// Set the Column from the function -func (m commsPhoneMods) StatusFunc(f func() enums.CommsPhonestatustype) CommsPhoneMod { - return CommsPhoneModFunc(func(_ context.Context, o *CommsPhoneTemplate) { - o.Status = f - }) -} - -// Clear any values for the column -func (m commsPhoneMods) UnsetStatus() CommsPhoneMod { - return CommsPhoneModFunc(func(_ context.Context, o *CommsPhoneTemplate) { - o.Status = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsPhoneMods) RandomStatus(f *faker.Faker) CommsPhoneMod { - return CommsPhoneModFunc(func(_ context.Context, o *CommsPhoneTemplate) { - o.Status = func() enums.CommsPhonestatustype { - return random_enums_CommsPhonestatustype(f) - } - }) -} - -func (m commsPhoneMods) WithParentsCascading() CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - if isDone, _ := commsPhoneWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = commsPhoneWithParentsCascadingCtx.WithValue(ctx, true) - }) -} - -func (m commsPhoneMods) WithDestinationTextJobs(number int, related *CommsTextJobTemplate) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.DestinationTextJobs = []*commsPhoneRDestinationTextJobsR{{ - number: number, - o: related, - }} - }) -} - -func (m commsPhoneMods) WithNewDestinationTextJobs(number int, mods ...CommsTextJobMod) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - related := o.f.NewCommsTextJobWithContext(ctx, mods...) - m.WithDestinationTextJobs(number, related).Apply(ctx, o) - }) -} - -func (m commsPhoneMods) AddDestinationTextJobs(number int, related *CommsTextJobTemplate) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.DestinationTextJobs = append(o.r.DestinationTextJobs, &commsPhoneRDestinationTextJobsR{ - number: number, - o: related, - }) - }) -} - -func (m commsPhoneMods) AddNewDestinationTextJobs(number int, mods ...CommsTextJobMod) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - related := o.f.NewCommsTextJobWithContext(ctx, mods...) - m.AddDestinationTextJobs(number, related).Apply(ctx, o) - }) -} - -func (m commsPhoneMods) AddExistingDestinationTextJobs(existingModels ...*models.CommsTextJob) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - for _, em := range existingModels { - o.r.DestinationTextJobs = append(o.r.DestinationTextJobs, &commsPhoneRDestinationTextJobsR{ - o: o.f.FromExistingCommsTextJob(em), - }) - } - }) -} - -func (m commsPhoneMods) WithoutDestinationTextJobs() CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.DestinationTextJobs = nil - }) -} - -func (m commsPhoneMods) WithDestinationTextLogs(number int, related *CommsTextLogTemplate) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.DestinationTextLogs = []*commsPhoneRDestinationTextLogsR{{ - number: number, - o: related, - }} - }) -} - -func (m commsPhoneMods) WithNewDestinationTextLogs(number int, mods ...CommsTextLogMod) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - related := o.f.NewCommsTextLogWithContext(ctx, mods...) - m.WithDestinationTextLogs(number, related).Apply(ctx, o) - }) -} - -func (m commsPhoneMods) AddDestinationTextLogs(number int, related *CommsTextLogTemplate) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.DestinationTextLogs = append(o.r.DestinationTextLogs, &commsPhoneRDestinationTextLogsR{ - number: number, - o: related, - }) - }) -} - -func (m commsPhoneMods) AddNewDestinationTextLogs(number int, mods ...CommsTextLogMod) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - related := o.f.NewCommsTextLogWithContext(ctx, mods...) - m.AddDestinationTextLogs(number, related).Apply(ctx, o) - }) -} - -func (m commsPhoneMods) AddExistingDestinationTextLogs(existingModels ...*models.CommsTextLog) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - for _, em := range existingModels { - o.r.DestinationTextLogs = append(o.r.DestinationTextLogs, &commsPhoneRDestinationTextLogsR{ - o: o.f.FromExistingCommsTextLog(em), - }) - } - }) -} - -func (m commsPhoneMods) WithoutDestinationTextLogs() CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.DestinationTextLogs = nil - }) -} - -func (m commsPhoneMods) WithSourceTextLogs(number int, related *CommsTextLogTemplate) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.SourceTextLogs = []*commsPhoneRSourceTextLogsR{{ - number: number, - o: related, - }} - }) -} - -func (m commsPhoneMods) WithNewSourceTextLogs(number int, mods ...CommsTextLogMod) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - related := o.f.NewCommsTextLogWithContext(ctx, mods...) - m.WithSourceTextLogs(number, related).Apply(ctx, o) - }) -} - -func (m commsPhoneMods) AddSourceTextLogs(number int, related *CommsTextLogTemplate) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.SourceTextLogs = append(o.r.SourceTextLogs, &commsPhoneRSourceTextLogsR{ - number: number, - o: related, - }) - }) -} - -func (m commsPhoneMods) AddNewSourceTextLogs(number int, mods ...CommsTextLogMod) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - related := o.f.NewCommsTextLogWithContext(ctx, mods...) - m.AddSourceTextLogs(number, related).Apply(ctx, o) - }) -} - -func (m commsPhoneMods) AddExistingSourceTextLogs(existingModels ...*models.CommsTextLog) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - for _, em := range existingModels { - o.r.SourceTextLogs = append(o.r.SourceTextLogs, &commsPhoneRSourceTextLogsR{ - o: o.f.FromExistingCommsTextLog(em), - }) - } - }) -} - -func (m commsPhoneMods) WithoutSourceTextLogs() CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.SourceTextLogs = nil - }) -} - -func (m commsPhoneMods) WithOrganizations(number int, related *OrganizationTemplate) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.Organizations = []*commsPhoneROrganizationsR{{ - number: number, - o: related, - }} - }) -} - -func (m commsPhoneMods) WithNewOrganizations(number int, mods ...OrganizationMod) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - m.WithOrganizations(number, related).Apply(ctx, o) - }) -} - -func (m commsPhoneMods) AddOrganizations(number int, related *OrganizationTemplate) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.Organizations = append(o.r.Organizations, &commsPhoneROrganizationsR{ - number: number, - o: related, - }) - }) -} - -func (m commsPhoneMods) AddNewOrganizations(number int, mods ...OrganizationMod) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - m.AddOrganizations(number, related).Apply(ctx, o) - }) -} - -func (m commsPhoneMods) AddExistingOrganizations(existingModels ...*models.Organization) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - for _, em := range existingModels { - o.r.Organizations = append(o.r.Organizations, &commsPhoneROrganizationsR{ - o: o.f.FromExistingOrganization(em), - }) - } - }) -} - -func (m commsPhoneMods) WithoutOrganizations() CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.Organizations = nil - }) -} - -func (m commsPhoneMods) WithPropertyOwnerPhoneE164Pools(number int, related *FileuploadPoolTemplate) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.PropertyOwnerPhoneE164Pools = []*commsPhoneRPropertyOwnerPhoneE164PoolsR{{ - number: number, - o: related, - }} - }) -} - -func (m commsPhoneMods) WithNewPropertyOwnerPhoneE164Pools(number int, mods ...FileuploadPoolMod) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - related := o.f.NewFileuploadPoolWithContext(ctx, mods...) - m.WithPropertyOwnerPhoneE164Pools(number, related).Apply(ctx, o) - }) -} - -func (m commsPhoneMods) AddPropertyOwnerPhoneE164Pools(number int, related *FileuploadPoolTemplate) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.PropertyOwnerPhoneE164Pools = append(o.r.PropertyOwnerPhoneE164Pools, &commsPhoneRPropertyOwnerPhoneE164PoolsR{ - number: number, - o: related, - }) - }) -} - -func (m commsPhoneMods) AddNewPropertyOwnerPhoneE164Pools(number int, mods ...FileuploadPoolMod) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - related := o.f.NewFileuploadPoolWithContext(ctx, mods...) - m.AddPropertyOwnerPhoneE164Pools(number, related).Apply(ctx, o) - }) -} - -func (m commsPhoneMods) AddExistingPropertyOwnerPhoneE164Pools(existingModels ...*models.FileuploadPool) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - for _, em := range existingModels { - o.r.PropertyOwnerPhoneE164Pools = append(o.r.PropertyOwnerPhoneE164Pools, &commsPhoneRPropertyOwnerPhoneE164PoolsR{ - o: o.f.FromExistingFileuploadPool(em), - }) - } - }) -} - -func (m commsPhoneMods) WithoutPropertyOwnerPhoneE164Pools() CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.PropertyOwnerPhoneE164Pools = nil - }) -} - -func (m commsPhoneMods) WithResidentPhoneE164Pools(number int, related *FileuploadPoolTemplate) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.ResidentPhoneE164Pools = []*commsPhoneRResidentPhoneE164PoolsR{{ - number: number, - o: related, - }} - }) -} - -func (m commsPhoneMods) WithNewResidentPhoneE164Pools(number int, mods ...FileuploadPoolMod) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - related := o.f.NewFileuploadPoolWithContext(ctx, mods...) - m.WithResidentPhoneE164Pools(number, related).Apply(ctx, o) - }) -} - -func (m commsPhoneMods) AddResidentPhoneE164Pools(number int, related *FileuploadPoolTemplate) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.ResidentPhoneE164Pools = append(o.r.ResidentPhoneE164Pools, &commsPhoneRResidentPhoneE164PoolsR{ - number: number, - o: related, - }) - }) -} - -func (m commsPhoneMods) AddNewResidentPhoneE164Pools(number int, mods ...FileuploadPoolMod) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - related := o.f.NewFileuploadPoolWithContext(ctx, mods...) - m.AddResidentPhoneE164Pools(number, related).Apply(ctx, o) - }) -} - -func (m commsPhoneMods) AddExistingResidentPhoneE164Pools(existingModels ...*models.FileuploadPool) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - for _, em := range existingModels { - o.r.ResidentPhoneE164Pools = append(o.r.ResidentPhoneE164Pools, &commsPhoneRResidentPhoneE164PoolsR{ - o: o.f.FromExistingFileuploadPool(em), - }) - } - }) -} - -func (m commsPhoneMods) WithoutResidentPhoneE164Pools() CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.ResidentPhoneE164Pools = nil - }) -} - -func (m commsPhoneMods) WithPhoneE164NotifyPhoneNuisances(number int, related *PublicreportNotifyPhoneNuisanceTemplate) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.PhoneE164NotifyPhoneNuisances = []*commsPhoneRPhoneE164NotifyPhoneNuisancesR{{ - number: number, - o: related, - }} - }) -} - -func (m commsPhoneMods) WithNewPhoneE164NotifyPhoneNuisances(number int, mods ...PublicreportNotifyPhoneNuisanceMod) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - related := o.f.NewPublicreportNotifyPhoneNuisanceWithContext(ctx, mods...) - m.WithPhoneE164NotifyPhoneNuisances(number, related).Apply(ctx, o) - }) -} - -func (m commsPhoneMods) AddPhoneE164NotifyPhoneNuisances(number int, related *PublicreportNotifyPhoneNuisanceTemplate) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.PhoneE164NotifyPhoneNuisances = append(o.r.PhoneE164NotifyPhoneNuisances, &commsPhoneRPhoneE164NotifyPhoneNuisancesR{ - number: number, - o: related, - }) - }) -} - -func (m commsPhoneMods) AddNewPhoneE164NotifyPhoneNuisances(number int, mods ...PublicreportNotifyPhoneNuisanceMod) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - related := o.f.NewPublicreportNotifyPhoneNuisanceWithContext(ctx, mods...) - m.AddPhoneE164NotifyPhoneNuisances(number, related).Apply(ctx, o) - }) -} - -func (m commsPhoneMods) AddExistingPhoneE164NotifyPhoneNuisances(existingModels ...*models.PublicreportNotifyPhoneNuisance) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - for _, em := range existingModels { - o.r.PhoneE164NotifyPhoneNuisances = append(o.r.PhoneE164NotifyPhoneNuisances, &commsPhoneRPhoneE164NotifyPhoneNuisancesR{ - o: o.f.FromExistingPublicreportNotifyPhoneNuisance(em), - }) - } - }) -} - -func (m commsPhoneMods) WithoutPhoneE164NotifyPhoneNuisances() CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.PhoneE164NotifyPhoneNuisances = nil - }) -} - -func (m commsPhoneMods) WithPhoneE164NotifyPhonePools(number int, related *PublicreportNotifyPhonePoolTemplate) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.PhoneE164NotifyPhonePools = []*commsPhoneRPhoneE164NotifyPhonePoolsR{{ - number: number, - o: related, - }} - }) -} - -func (m commsPhoneMods) WithNewPhoneE164NotifyPhonePools(number int, mods ...PublicreportNotifyPhonePoolMod) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - related := o.f.NewPublicreportNotifyPhonePoolWithContext(ctx, mods...) - m.WithPhoneE164NotifyPhonePools(number, related).Apply(ctx, o) - }) -} - -func (m commsPhoneMods) AddPhoneE164NotifyPhonePools(number int, related *PublicreportNotifyPhonePoolTemplate) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.PhoneE164NotifyPhonePools = append(o.r.PhoneE164NotifyPhonePools, &commsPhoneRPhoneE164NotifyPhonePoolsR{ - number: number, - o: related, - }) - }) -} - -func (m commsPhoneMods) AddNewPhoneE164NotifyPhonePools(number int, mods ...PublicreportNotifyPhonePoolMod) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - related := o.f.NewPublicreportNotifyPhonePoolWithContext(ctx, mods...) - m.AddPhoneE164NotifyPhonePools(number, related).Apply(ctx, o) - }) -} - -func (m commsPhoneMods) AddExistingPhoneE164NotifyPhonePools(existingModels ...*models.PublicreportNotifyPhonePool) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - for _, em := range existingModels { - o.r.PhoneE164NotifyPhonePools = append(o.r.PhoneE164NotifyPhonePools, &commsPhoneRPhoneE164NotifyPhonePoolsR{ - o: o.f.FromExistingPublicreportNotifyPhonePool(em), - }) - } - }) -} - -func (m commsPhoneMods) WithoutPhoneE164NotifyPhonePools() CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.PhoneE164NotifyPhonePools = nil - }) -} - -func (m commsPhoneMods) WithPhoneE164SubscribePhones(number int, related *PublicreportSubscribePhoneTemplate) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.PhoneE164SubscribePhones = []*commsPhoneRPhoneE164SubscribePhonesR{{ - number: number, - o: related, - }} - }) -} - -func (m commsPhoneMods) WithNewPhoneE164SubscribePhones(number int, mods ...PublicreportSubscribePhoneMod) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - related := o.f.NewPublicreportSubscribePhoneWithContext(ctx, mods...) - m.WithPhoneE164SubscribePhones(number, related).Apply(ctx, o) - }) -} - -func (m commsPhoneMods) AddPhoneE164SubscribePhones(number int, related *PublicreportSubscribePhoneTemplate) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.PhoneE164SubscribePhones = append(o.r.PhoneE164SubscribePhones, &commsPhoneRPhoneE164SubscribePhonesR{ - number: number, - o: related, - }) - }) -} - -func (m commsPhoneMods) AddNewPhoneE164SubscribePhones(number int, mods ...PublicreportSubscribePhoneMod) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - related := o.f.NewPublicreportSubscribePhoneWithContext(ctx, mods...) - m.AddPhoneE164SubscribePhones(number, related).Apply(ctx, o) - }) -} - -func (m commsPhoneMods) AddExistingPhoneE164SubscribePhones(existingModels ...*models.PublicreportSubscribePhone) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - for _, em := range existingModels { - o.r.PhoneE164SubscribePhones = append(o.r.PhoneE164SubscribePhones, &commsPhoneRPhoneE164SubscribePhonesR{ - o: o.f.FromExistingPublicreportSubscribePhone(em), - }) - } - }) -} - -func (m commsPhoneMods) WithoutPhoneE164SubscribePhones() CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.PhoneE164SubscribePhones = nil - }) -} - -func (m commsPhoneMods) WithPhoneMobileResidents(number int, related *ResidentTemplate) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.PhoneMobileResidents = []*commsPhoneRPhoneMobileResidentsR{{ - number: number, - o: related, - }} - }) -} - -func (m commsPhoneMods) WithNewPhoneMobileResidents(number int, mods ...ResidentMod) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - related := o.f.NewResidentWithContext(ctx, mods...) - m.WithPhoneMobileResidents(number, related).Apply(ctx, o) - }) -} - -func (m commsPhoneMods) AddPhoneMobileResidents(number int, related *ResidentTemplate) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.PhoneMobileResidents = append(o.r.PhoneMobileResidents, &commsPhoneRPhoneMobileResidentsR{ - number: number, - o: related, - }) - }) -} - -func (m commsPhoneMods) AddNewPhoneMobileResidents(number int, mods ...ResidentMod) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - related := o.f.NewResidentWithContext(ctx, mods...) - m.AddPhoneMobileResidents(number, related).Apply(ctx, o) - }) -} - -func (m commsPhoneMods) AddExistingPhoneMobileResidents(existingModels ...*models.Resident) CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - for _, em := range existingModels { - o.r.PhoneMobileResidents = append(o.r.PhoneMobileResidents, &commsPhoneRPhoneMobileResidentsR{ - o: o.f.FromExistingResident(em), - }) - } - }) -} - -func (m commsPhoneMods) WithoutPhoneMobileResidents() CommsPhoneMod { - return CommsPhoneModFunc(func(ctx context.Context, o *CommsPhoneTemplate) { - o.r.PhoneMobileResidents = nil - }) -} diff --git a/db/factory/comms.text_job.bob.go b/db/factory/comms.text_job.bob.go deleted file mode 100644 index 5b3a7935..00000000 --- a/db/factory/comms.text_job.bob.go +++ /dev/null @@ -1,607 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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/jaswdr/faker/v2" -) - -type CommsTextJobMod interface { - Apply(context.Context, *CommsTextJobTemplate) -} - -type CommsTextJobModFunc func(context.Context, *CommsTextJobTemplate) - -func (f CommsTextJobModFunc) Apply(ctx context.Context, n *CommsTextJobTemplate) { - f(ctx, n) -} - -type CommsTextJobModSlice []CommsTextJobMod - -func (mods CommsTextJobModSlice) Apply(ctx context.Context, n *CommsTextJobTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// CommsTextJobTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type CommsTextJobTemplate struct { - Content func() string - Created func() time.Time - Destination func() string - ID func() int32 - Type func() enums.CommsTextjobtype - Source func() enums.CommsTextjobsource - Completed func() null.Val[time.Time] - - r commsTextJobR - f *Factory - - alreadyPersisted bool -} - -type commsTextJobR struct { - DestinationPhone *commsTextJobRDestinationPhoneR -} - -type commsTextJobRDestinationPhoneR struct { - o *CommsPhoneTemplate -} - -// Apply mods to the CommsTextJobTemplate -func (o *CommsTextJobTemplate) Apply(ctx context.Context, mods ...CommsTextJobMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.CommsTextJob -// according to the relationships in the template. Nothing is inserted into the db -func (t CommsTextJobTemplate) setModelRels(o *models.CommsTextJob) { - if t.r.DestinationPhone != nil { - rel := t.r.DestinationPhone.o.Build() - rel.R.DestinationTextJobs = append(rel.R.DestinationTextJobs, o) - o.Destination = rel.E164 // h2 - o.R.DestinationPhone = rel - } -} - -// BuildSetter returns an *models.CommsTextJobSetter -// this does nothing with the relationship templates -func (o CommsTextJobTemplate) BuildSetter() *models.CommsTextJobSetter { - m := &models.CommsTextJobSetter{} - - if o.Content != nil { - val := o.Content() - m.Content = omit.From(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.Destination != nil { - val := o.Destination() - m.Destination = omit.From(val) - } - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.Type != nil { - val := o.Type() - m.Type = omit.From(val) - } - if o.Source != nil { - val := o.Source() - m.Source = omit.From(val) - } - if o.Completed != nil { - val := o.Completed() - m.Completed = omitnull.FromNull(val) - } - - return m -} - -// BuildManySetter returns an []*models.CommsTextJobSetter -// this does nothing with the relationship templates -func (o CommsTextJobTemplate) BuildManySetter(number int) []*models.CommsTextJobSetter { - m := make([]*models.CommsTextJobSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.CommsTextJob -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use CommsTextJobTemplate.Create -func (o CommsTextJobTemplate) Build() *models.CommsTextJob { - m := &models.CommsTextJob{} - - if o.Content != nil { - m.Content = o.Content() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.Destination != nil { - m.Destination = o.Destination() - } - if o.ID != nil { - m.ID = o.ID() - } - if o.Type != nil { - m.Type = o.Type() - } - if o.Source != nil { - m.Source = o.Source() - } - if o.Completed != nil { - m.Completed = o.Completed() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.CommsTextJobSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use CommsTextJobTemplate.CreateMany -func (o CommsTextJobTemplate) BuildMany(number int) models.CommsTextJobSlice { - m := make(models.CommsTextJobSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableCommsTextJob(m *models.CommsTextJobSetter) { - if !(m.Content.IsValue()) { - val := random_string(nil) - m.Content = omit.From(val) - } - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.Destination.IsValue()) { - val := random_string(nil) - m.Destination = omit.From(val) - } - if !(m.Type.IsValue()) { - val := random_enums_CommsTextjobtype(nil) - m.Type = omit.From(val) - } - if !(m.Source.IsValue()) { - val := random_enums_CommsTextjobsource(nil) - m.Source = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.CommsTextJob -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *CommsTextJobTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.CommsTextJob) error { - var err error - - return err -} - -// Create builds a commsTextJob and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *CommsTextJobTemplate) Create(ctx context.Context, exec bob.Executor) (*models.CommsTextJob, error) { - var err error - opt := o.BuildSetter() - ensureCreatableCommsTextJob(opt) - - if o.r.DestinationPhone == nil { - CommsTextJobMods.WithNewDestinationPhone().Apply(ctx, o) - } - - var rel0 *models.CommsPhone - - if o.r.DestinationPhone.o.alreadyPersisted { - rel0 = o.r.DestinationPhone.o.Build() - } else { - rel0, err = o.r.DestinationPhone.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.Destination = omit.From(rel0.E164) - - m, err := models.CommsTextJobs.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.DestinationPhone = rel0 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a commsTextJob and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *CommsTextJobTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.CommsTextJob { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a commsTextJob 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 *CommsTextJobTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.CommsTextJob { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple commsTextJobs and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o CommsTextJobTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.CommsTextJobSlice, error) { - var err error - m := make(models.CommsTextJobSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple commsTextJobs and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o CommsTextJobTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.CommsTextJobSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple commsTextJobs 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 CommsTextJobTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.CommsTextJobSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CommsTextJob has methods that act as mods for the CommsTextJobTemplate -var CommsTextJobMods commsTextJobMods - -type commsTextJobMods struct{} - -func (m commsTextJobMods) RandomizeAllColumns(f *faker.Faker) CommsTextJobMod { - return CommsTextJobModSlice{ - CommsTextJobMods.RandomContent(f), - CommsTextJobMods.RandomCreated(f), - CommsTextJobMods.RandomDestination(f), - CommsTextJobMods.RandomID(f), - CommsTextJobMods.RandomType(f), - CommsTextJobMods.RandomSource(f), - CommsTextJobMods.RandomCompleted(f), - } -} - -// Set the model columns to this value -func (m commsTextJobMods) Content(val string) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Content = func() string { return val } - }) -} - -// Set the Column from the function -func (m commsTextJobMods) ContentFunc(f func() string) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Content = f - }) -} - -// Clear any values for the column -func (m commsTextJobMods) UnsetContent() CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Content = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsTextJobMods) RandomContent(f *faker.Faker) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Content = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m commsTextJobMods) Created(val time.Time) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m commsTextJobMods) CreatedFunc(f func() time.Time) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m commsTextJobMods) UnsetCreated() CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - 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 commsTextJobMods) RandomCreated(f *faker.Faker) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m commsTextJobMods) Destination(val string) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Destination = func() string { return val } - }) -} - -// Set the Column from the function -func (m commsTextJobMods) DestinationFunc(f func() string) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Destination = f - }) -} - -// Clear any values for the column -func (m commsTextJobMods) UnsetDestination() CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Destination = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsTextJobMods) RandomDestination(f *faker.Faker) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Destination = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m commsTextJobMods) ID(val int32) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m commsTextJobMods) IDFunc(f func() int32) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m commsTextJobMods) UnsetID() CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsTextJobMods) RandomID(f *faker.Faker) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m commsTextJobMods) Type(val enums.CommsTextjobtype) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Type = func() enums.CommsTextjobtype { return val } - }) -} - -// Set the Column from the function -func (m commsTextJobMods) TypeFunc(f func() enums.CommsTextjobtype) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Type = f - }) -} - -// Clear any values for the column -func (m commsTextJobMods) UnsetType() CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - 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 commsTextJobMods) RandomType(f *faker.Faker) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Type = func() enums.CommsTextjobtype { - return random_enums_CommsTextjobtype(f) - } - }) -} - -// Set the model columns to this value -func (m commsTextJobMods) Source(val enums.CommsTextjobsource) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Source = func() enums.CommsTextjobsource { return val } - }) -} - -// Set the Column from the function -func (m commsTextJobMods) SourceFunc(f func() enums.CommsTextjobsource) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Source = f - }) -} - -// Clear any values for the column -func (m commsTextJobMods) UnsetSource() CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Source = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsTextJobMods) RandomSource(f *faker.Faker) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Source = func() enums.CommsTextjobsource { - return random_enums_CommsTextjobsource(f) - } - }) -} - -// Set the model columns to this value -func (m commsTextJobMods) Completed(val null.Val[time.Time]) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Completed = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m commsTextJobMods) CompletedFunc(f func() null.Val[time.Time]) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Completed = f - }) -} - -// Clear any values for the column -func (m commsTextJobMods) UnsetCompleted() CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - 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 commsTextJobMods) RandomCompleted(f *faker.Faker) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Completed = 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 commsTextJobMods) RandomCompletedNotNull(f *faker.Faker) CommsTextJobMod { - return CommsTextJobModFunc(func(_ context.Context, o *CommsTextJobTemplate) { - o.Completed = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -func (m commsTextJobMods) WithParentsCascading() CommsTextJobMod { - return CommsTextJobModFunc(func(ctx context.Context, o *CommsTextJobTemplate) { - if isDone, _ := commsTextJobWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = commsTextJobWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewCommsPhoneWithContext(ctx, CommsPhoneMods.WithParentsCascading()) - m.WithDestinationPhone(related).Apply(ctx, o) - } - }) -} - -func (m commsTextJobMods) WithDestinationPhone(rel *CommsPhoneTemplate) CommsTextJobMod { - return CommsTextJobModFunc(func(ctx context.Context, o *CommsTextJobTemplate) { - o.r.DestinationPhone = &commsTextJobRDestinationPhoneR{ - o: rel, - } - }) -} - -func (m commsTextJobMods) WithNewDestinationPhone(mods ...CommsPhoneMod) CommsTextJobMod { - return CommsTextJobModFunc(func(ctx context.Context, o *CommsTextJobTemplate) { - related := o.f.NewCommsPhoneWithContext(ctx, mods...) - - m.WithDestinationPhone(related).Apply(ctx, o) - }) -} - -func (m commsTextJobMods) WithExistingDestinationPhone(em *models.CommsPhone) CommsTextJobMod { - return CommsTextJobModFunc(func(ctx context.Context, o *CommsTextJobTemplate) { - o.r.DestinationPhone = &commsTextJobRDestinationPhoneR{ - o: o.f.FromExistingCommsPhone(em), - } - }) -} - -func (m commsTextJobMods) WithoutDestinationPhone() CommsTextJobMod { - return CommsTextJobModFunc(func(ctx context.Context, o *CommsTextJobTemplate) { - o.r.DestinationPhone = nil - }) -} diff --git a/db/factory/comms.text_log.bob.go b/db/factory/comms.text_log.bob.go deleted file mode 100644 index b25a4a43..00000000 --- a/db/factory/comms.text_log.bob.go +++ /dev/null @@ -1,803 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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/jaswdr/faker/v2" -) - -type CommsTextLogMod interface { - Apply(context.Context, *CommsTextLogTemplate) -} - -type CommsTextLogModFunc func(context.Context, *CommsTextLogTemplate) - -func (f CommsTextLogModFunc) Apply(ctx context.Context, n *CommsTextLogTemplate) { - f(ctx, n) -} - -type CommsTextLogModSlice []CommsTextLogMod - -func (mods CommsTextLogModSlice) Apply(ctx context.Context, n *CommsTextLogTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// CommsTextLogTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type CommsTextLogTemplate struct { - Content func() string - Created func() time.Time - Destination func() string - ID func() int32 - IsWelcome func() bool - Origin func() enums.CommsTextorigin - Source func() string - TwilioSid func() null.Val[string] - TwilioStatus func() string - IsVisibleToLLM func() bool - - r commsTextLogR - f *Factory - - alreadyPersisted bool -} - -type commsTextLogR struct { - DestinationPhone *commsTextLogRDestinationPhoneR - SourcePhone *commsTextLogRSourcePhoneR -} - -type commsTextLogRDestinationPhoneR struct { - o *CommsPhoneTemplate -} -type commsTextLogRSourcePhoneR struct { - o *CommsPhoneTemplate -} - -// Apply mods to the CommsTextLogTemplate -func (o *CommsTextLogTemplate) Apply(ctx context.Context, mods ...CommsTextLogMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.CommsTextLog -// according to the relationships in the template. Nothing is inserted into the db -func (t CommsTextLogTemplate) setModelRels(o *models.CommsTextLog) { - if t.r.DestinationPhone != nil { - rel := t.r.DestinationPhone.o.Build() - rel.R.DestinationTextLogs = append(rel.R.DestinationTextLogs, o) - o.Destination = rel.E164 // h2 - o.R.DestinationPhone = rel - } - - if t.r.SourcePhone != nil { - rel := t.r.SourcePhone.o.Build() - rel.R.SourceTextLogs = append(rel.R.SourceTextLogs, o) - o.Source = rel.E164 // h2 - o.R.SourcePhone = rel - } -} - -// BuildSetter returns an *models.CommsTextLogSetter -// this does nothing with the relationship templates -func (o CommsTextLogTemplate) BuildSetter() *models.CommsTextLogSetter { - m := &models.CommsTextLogSetter{} - - if o.Content != nil { - val := o.Content() - m.Content = omit.From(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.Destination != nil { - val := o.Destination() - m.Destination = omit.From(val) - } - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.IsWelcome != nil { - val := o.IsWelcome() - m.IsWelcome = omit.From(val) - } - if o.Origin != nil { - val := o.Origin() - m.Origin = omit.From(val) - } - if o.Source != nil { - val := o.Source() - m.Source = omit.From(val) - } - if o.TwilioSid != nil { - val := o.TwilioSid() - m.TwilioSid = omitnull.FromNull(val) - } - if o.TwilioStatus != nil { - val := o.TwilioStatus() - m.TwilioStatus = omit.From(val) - } - if o.IsVisibleToLLM != nil { - val := o.IsVisibleToLLM() - m.IsVisibleToLLM = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.CommsTextLogSetter -// this does nothing with the relationship templates -func (o CommsTextLogTemplate) BuildManySetter(number int) []*models.CommsTextLogSetter { - m := make([]*models.CommsTextLogSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.CommsTextLog -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use CommsTextLogTemplate.Create -func (o CommsTextLogTemplate) Build() *models.CommsTextLog { - m := &models.CommsTextLog{} - - if o.Content != nil { - m.Content = o.Content() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.Destination != nil { - m.Destination = o.Destination() - } - if o.ID != nil { - m.ID = o.ID() - } - if o.IsWelcome != nil { - m.IsWelcome = o.IsWelcome() - } - if o.Origin != nil { - m.Origin = o.Origin() - } - if o.Source != nil { - m.Source = o.Source() - } - if o.TwilioSid != nil { - m.TwilioSid = o.TwilioSid() - } - if o.TwilioStatus != nil { - m.TwilioStatus = o.TwilioStatus() - } - if o.IsVisibleToLLM != nil { - m.IsVisibleToLLM = o.IsVisibleToLLM() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.CommsTextLogSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use CommsTextLogTemplate.CreateMany -func (o CommsTextLogTemplate) BuildMany(number int) models.CommsTextLogSlice { - m := make(models.CommsTextLogSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableCommsTextLog(m *models.CommsTextLogSetter) { - if !(m.Content.IsValue()) { - val := random_string(nil) - m.Content = omit.From(val) - } - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.Destination.IsValue()) { - val := random_string(nil) - m.Destination = omit.From(val) - } - if !(m.IsWelcome.IsValue()) { - val := random_bool(nil) - m.IsWelcome = omit.From(val) - } - if !(m.Origin.IsValue()) { - val := random_enums_CommsTextorigin(nil) - m.Origin = omit.From(val) - } - if !(m.Source.IsValue()) { - val := random_string(nil) - m.Source = omit.From(val) - } - if !(m.TwilioStatus.IsValue()) { - val := random_string(nil) - m.TwilioStatus = omit.From(val) - } - if !(m.IsVisibleToLLM.IsValue()) { - val := random_bool(nil) - m.IsVisibleToLLM = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.CommsTextLog -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *CommsTextLogTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.CommsTextLog) error { - var err error - - return err -} - -// Create builds a commsTextLog and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *CommsTextLogTemplate) Create(ctx context.Context, exec bob.Executor) (*models.CommsTextLog, error) { - var err error - opt := o.BuildSetter() - ensureCreatableCommsTextLog(opt) - - if o.r.DestinationPhone == nil { - CommsTextLogMods.WithNewDestinationPhone().Apply(ctx, o) - } - - var rel0 *models.CommsPhone - - if o.r.DestinationPhone.o.alreadyPersisted { - rel0 = o.r.DestinationPhone.o.Build() - } else { - rel0, err = o.r.DestinationPhone.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.Destination = omit.From(rel0.E164) - - if o.r.SourcePhone == nil { - CommsTextLogMods.WithNewSourcePhone().Apply(ctx, o) - } - - var rel1 *models.CommsPhone - - if o.r.SourcePhone.o.alreadyPersisted { - rel1 = o.r.SourcePhone.o.Build() - } else { - rel1, err = o.r.SourcePhone.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.Source = omit.From(rel1.E164) - - m, err := models.CommsTextLogs.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.DestinationPhone = rel0 - m.R.SourcePhone = rel1 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a commsTextLog and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *CommsTextLogTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.CommsTextLog { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a commsTextLog 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 *CommsTextLogTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.CommsTextLog { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple commsTextLogs and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o CommsTextLogTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.CommsTextLogSlice, error) { - var err error - m := make(models.CommsTextLogSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple commsTextLogs and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o CommsTextLogTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.CommsTextLogSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple commsTextLogs 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 CommsTextLogTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.CommsTextLogSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CommsTextLog has methods that act as mods for the CommsTextLogTemplate -var CommsTextLogMods commsTextLogMods - -type commsTextLogMods struct{} - -func (m commsTextLogMods) RandomizeAllColumns(f *faker.Faker) CommsTextLogMod { - return CommsTextLogModSlice{ - CommsTextLogMods.RandomContent(f), - CommsTextLogMods.RandomCreated(f), - CommsTextLogMods.RandomDestination(f), - CommsTextLogMods.RandomID(f), - CommsTextLogMods.RandomIsWelcome(f), - CommsTextLogMods.RandomOrigin(f), - CommsTextLogMods.RandomSource(f), - CommsTextLogMods.RandomTwilioSid(f), - CommsTextLogMods.RandomTwilioStatus(f), - CommsTextLogMods.RandomIsVisibleToLLM(f), - } -} - -// Set the model columns to this value -func (m commsTextLogMods) Content(val string) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.Content = func() string { return val } - }) -} - -// Set the Column from the function -func (m commsTextLogMods) ContentFunc(f func() string) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.Content = f - }) -} - -// Clear any values for the column -func (m commsTextLogMods) UnsetContent() CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.Content = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsTextLogMods) RandomContent(f *faker.Faker) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.Content = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m commsTextLogMods) Created(val time.Time) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m commsTextLogMods) CreatedFunc(f func() time.Time) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m commsTextLogMods) UnsetCreated() CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - 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 commsTextLogMods) RandomCreated(f *faker.Faker) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m commsTextLogMods) Destination(val string) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.Destination = func() string { return val } - }) -} - -// Set the Column from the function -func (m commsTextLogMods) DestinationFunc(f func() string) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.Destination = f - }) -} - -// Clear any values for the column -func (m commsTextLogMods) UnsetDestination() CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.Destination = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsTextLogMods) RandomDestination(f *faker.Faker) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.Destination = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m commsTextLogMods) ID(val int32) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m commsTextLogMods) IDFunc(f func() int32) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m commsTextLogMods) UnsetID() CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsTextLogMods) RandomID(f *faker.Faker) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m commsTextLogMods) IsWelcome(val bool) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.IsWelcome = func() bool { return val } - }) -} - -// Set the Column from the function -func (m commsTextLogMods) IsWelcomeFunc(f func() bool) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.IsWelcome = f - }) -} - -// Clear any values for the column -func (m commsTextLogMods) UnsetIsWelcome() CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.IsWelcome = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsTextLogMods) RandomIsWelcome(f *faker.Faker) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.IsWelcome = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m commsTextLogMods) Origin(val enums.CommsTextorigin) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.Origin = func() enums.CommsTextorigin { return val } - }) -} - -// Set the Column from the function -func (m commsTextLogMods) OriginFunc(f func() enums.CommsTextorigin) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.Origin = f - }) -} - -// Clear any values for the column -func (m commsTextLogMods) UnsetOrigin() CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.Origin = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsTextLogMods) RandomOrigin(f *faker.Faker) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.Origin = func() enums.CommsTextorigin { - return random_enums_CommsTextorigin(f) - } - }) -} - -// Set the model columns to this value -func (m commsTextLogMods) Source(val string) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.Source = func() string { return val } - }) -} - -// Set the Column from the function -func (m commsTextLogMods) SourceFunc(f func() string) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.Source = f - }) -} - -// Clear any values for the column -func (m commsTextLogMods) UnsetSource() CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.Source = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsTextLogMods) RandomSource(f *faker.Faker) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.Source = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m commsTextLogMods) TwilioSid(val null.Val[string]) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.TwilioSid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m commsTextLogMods) TwilioSidFunc(f func() null.Val[string]) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.TwilioSid = f - }) -} - -// Clear any values for the column -func (m commsTextLogMods) UnsetTwilioSid() CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.TwilioSid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m commsTextLogMods) RandomTwilioSid(f *faker.Faker) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.TwilioSid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m commsTextLogMods) RandomTwilioSidNotNull(f *faker.Faker) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.TwilioSid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m commsTextLogMods) TwilioStatus(val string) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.TwilioStatus = func() string { return val } - }) -} - -// Set the Column from the function -func (m commsTextLogMods) TwilioStatusFunc(f func() string) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.TwilioStatus = f - }) -} - -// Clear any values for the column -func (m commsTextLogMods) UnsetTwilioStatus() CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.TwilioStatus = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsTextLogMods) RandomTwilioStatus(f *faker.Faker) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.TwilioStatus = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m commsTextLogMods) IsVisibleToLLM(val bool) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.IsVisibleToLLM = func() bool { return val } - }) -} - -// Set the Column from the function -func (m commsTextLogMods) IsVisibleToLLMFunc(f func() bool) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.IsVisibleToLLM = f - }) -} - -// Clear any values for the column -func (m commsTextLogMods) UnsetIsVisibleToLLM() CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.IsVisibleToLLM = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m commsTextLogMods) RandomIsVisibleToLLM(f *faker.Faker) CommsTextLogMod { - return CommsTextLogModFunc(func(_ context.Context, o *CommsTextLogTemplate) { - o.IsVisibleToLLM = func() bool { - return random_bool(f) - } - }) -} - -func (m commsTextLogMods) WithParentsCascading() CommsTextLogMod { - return CommsTextLogModFunc(func(ctx context.Context, o *CommsTextLogTemplate) { - if isDone, _ := commsTextLogWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = commsTextLogWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewCommsPhoneWithContext(ctx, CommsPhoneMods.WithParentsCascading()) - m.WithDestinationPhone(related).Apply(ctx, o) - } - { - - related := o.f.NewCommsPhoneWithContext(ctx, CommsPhoneMods.WithParentsCascading()) - m.WithSourcePhone(related).Apply(ctx, o) - } - }) -} - -func (m commsTextLogMods) WithDestinationPhone(rel *CommsPhoneTemplate) CommsTextLogMod { - return CommsTextLogModFunc(func(ctx context.Context, o *CommsTextLogTemplate) { - o.r.DestinationPhone = &commsTextLogRDestinationPhoneR{ - o: rel, - } - }) -} - -func (m commsTextLogMods) WithNewDestinationPhone(mods ...CommsPhoneMod) CommsTextLogMod { - return CommsTextLogModFunc(func(ctx context.Context, o *CommsTextLogTemplate) { - related := o.f.NewCommsPhoneWithContext(ctx, mods...) - - m.WithDestinationPhone(related).Apply(ctx, o) - }) -} - -func (m commsTextLogMods) WithExistingDestinationPhone(em *models.CommsPhone) CommsTextLogMod { - return CommsTextLogModFunc(func(ctx context.Context, o *CommsTextLogTemplate) { - o.r.DestinationPhone = &commsTextLogRDestinationPhoneR{ - o: o.f.FromExistingCommsPhone(em), - } - }) -} - -func (m commsTextLogMods) WithoutDestinationPhone() CommsTextLogMod { - return CommsTextLogModFunc(func(ctx context.Context, o *CommsTextLogTemplate) { - o.r.DestinationPhone = nil - }) -} - -func (m commsTextLogMods) WithSourcePhone(rel *CommsPhoneTemplate) CommsTextLogMod { - return CommsTextLogModFunc(func(ctx context.Context, o *CommsTextLogTemplate) { - o.r.SourcePhone = &commsTextLogRSourcePhoneR{ - o: rel, - } - }) -} - -func (m commsTextLogMods) WithNewSourcePhone(mods ...CommsPhoneMod) CommsTextLogMod { - return CommsTextLogModFunc(func(ctx context.Context, o *CommsTextLogTemplate) { - related := o.f.NewCommsPhoneWithContext(ctx, mods...) - - m.WithSourcePhone(related).Apply(ctx, o) - }) -} - -func (m commsTextLogMods) WithExistingSourcePhone(em *models.CommsPhone) CommsTextLogMod { - return CommsTextLogModFunc(func(ctx context.Context, o *CommsTextLogTemplate) { - o.r.SourcePhone = &commsTextLogRSourcePhoneR{ - o: o.f.FromExistingCommsPhone(em), - } - }) -} - -func (m commsTextLogMods) WithoutSourcePhone() CommsTextLogMod { - return CommsTextLogModFunc(func(ctx context.Context, o *CommsTextLogTemplate) { - o.r.SourcePhone = nil - }) -} diff --git a/db/factory/compliance_report_request.bob.go b/db/factory/compliance_report_request.bob.go deleted file mode 100644 index 135ca877..00000000 --- a/db/factory/compliance_report_request.bob.go +++ /dev/null @@ -1,648 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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" -) - -type ComplianceReportRequestMod interface { - Apply(context.Context, *ComplianceReportRequestTemplate) -} - -type ComplianceReportRequestModFunc func(context.Context, *ComplianceReportRequestTemplate) - -func (f ComplianceReportRequestModFunc) Apply(ctx context.Context, n *ComplianceReportRequestTemplate) { - f(ctx, n) -} - -type ComplianceReportRequestModSlice []ComplianceReportRequestMod - -func (mods ComplianceReportRequestModSlice) Apply(ctx context.Context, n *ComplianceReportRequestTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// ComplianceReportRequestTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type ComplianceReportRequestTemplate struct { - Created func() time.Time - Creator func() int32 - ID func() int32 - PublicID func() string - LeadID func() null.Val[int32] - - r complianceReportRequestR - f *Factory - - alreadyPersisted bool -} - -type complianceReportRequestR struct { - CreatorUser *complianceReportRequestRCreatorUserR - Lead *complianceReportRequestRLeadR - Mailers []*complianceReportRequestRMailersR -} - -type complianceReportRequestRCreatorUserR struct { - o *UserTemplate -} -type complianceReportRequestRLeadR struct { - o *LeadTemplate -} -type complianceReportRequestRMailersR struct { - number int - o *CommsMailerTemplate -} - -// Apply mods to the ComplianceReportRequestTemplate -func (o *ComplianceReportRequestTemplate) Apply(ctx context.Context, mods ...ComplianceReportRequestMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.ComplianceReportRequest -// according to the relationships in the template. Nothing is inserted into the db -func (t ComplianceReportRequestTemplate) setModelRels(o *models.ComplianceReportRequest) { - if t.r.CreatorUser != nil { - rel := t.r.CreatorUser.o.Build() - rel.R.CreatorComplianceReportRequests = append(rel.R.CreatorComplianceReportRequests, o) - o.Creator = rel.ID // h2 - o.R.CreatorUser = rel - } - - if t.r.Lead != nil { - rel := t.r.Lead.o.Build() - rel.R.ComplianceReportRequests = append(rel.R.ComplianceReportRequests, o) - o.LeadID = null.From(rel.ID) // h2 - o.R.Lead = rel - } - - if t.r.Mailers != nil { - rel := models.CommsMailerSlice{} - for _, r := range t.r.Mailers { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.R.ComplianceReportRequests = append(rel.R.ComplianceReportRequests, o) - } - rel = append(rel, related...) - } - o.R.Mailers = rel - } -} - -// BuildSetter returns an *models.ComplianceReportRequestSetter -// this does nothing with the relationship templates -func (o ComplianceReportRequestTemplate) BuildSetter() *models.ComplianceReportRequestSetter { - m := &models.ComplianceReportRequestSetter{} - - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omit.From(val) - } - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.PublicID != nil { - val := o.PublicID() - m.PublicID = omit.From(val) - } - if o.LeadID != nil { - val := o.LeadID() - m.LeadID = omitnull.FromNull(val) - } - - return m -} - -// BuildManySetter returns an []*models.ComplianceReportRequestSetter -// this does nothing with the relationship templates -func (o ComplianceReportRequestTemplate) BuildManySetter(number int) []*models.ComplianceReportRequestSetter { - m := make([]*models.ComplianceReportRequestSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.ComplianceReportRequest -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ComplianceReportRequestTemplate.Create -func (o ComplianceReportRequestTemplate) Build() *models.ComplianceReportRequest { - m := &models.ComplianceReportRequest{} - - if o.Created != nil { - m.Created = o.Created() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.ID != nil { - m.ID = o.ID() - } - if o.PublicID != nil { - m.PublicID = o.PublicID() - } - if o.LeadID != nil { - m.LeadID = o.LeadID() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.ComplianceReportRequestSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ComplianceReportRequestTemplate.CreateMany -func (o ComplianceReportRequestTemplate) BuildMany(number int) models.ComplianceReportRequestSlice { - m := make(models.ComplianceReportRequestSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableComplianceReportRequest(m *models.ComplianceReportRequestSetter) { - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.Creator.IsValue()) { - val := random_int32(nil) - m.Creator = omit.From(val) - } - if !(m.PublicID.IsValue()) { - val := random_string(nil) - m.PublicID = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.ComplianceReportRequest -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *ComplianceReportRequestTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.ComplianceReportRequest) error { - var err error - - isLeadDone, _ := complianceReportRequestRelLeadCtx.Value(ctx) - if !isLeadDone && o.r.Lead != nil { - ctx = complianceReportRequestRelLeadCtx.WithValue(ctx, true) - if o.r.Lead.o.alreadyPersisted { - m.R.Lead = o.r.Lead.o.Build() - } else { - var rel1 *models.Lead - rel1, err = o.r.Lead.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachLead(ctx, exec, rel1) - if err != nil { - return err - } - } - - } - - return err -} - -// Create builds a complianceReportRequest and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *ComplianceReportRequestTemplate) Create(ctx context.Context, exec bob.Executor) (*models.ComplianceReportRequest, error) { - var err error - opt := o.BuildSetter() - ensureCreatableComplianceReportRequest(opt) - - if o.r.CreatorUser == nil { - ComplianceReportRequestMods.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.Creator = omit.From(rel0.ID) - - m, err := models.ComplianceReportRequests.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.CreatorUser = rel0 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a complianceReportRequest and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *ComplianceReportRequestTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.ComplianceReportRequest { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a complianceReportRequest 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 *ComplianceReportRequestTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.ComplianceReportRequest { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple complianceReportRequests and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o ComplianceReportRequestTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.ComplianceReportRequestSlice, error) { - var err error - m := make(models.ComplianceReportRequestSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple complianceReportRequests and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o ComplianceReportRequestTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.ComplianceReportRequestSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple complianceReportRequests 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 ComplianceReportRequestTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.ComplianceReportRequestSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// ComplianceReportRequest has methods that act as mods for the ComplianceReportRequestTemplate -var ComplianceReportRequestMods complianceReportRequestMods - -type complianceReportRequestMods struct{} - -func (m complianceReportRequestMods) RandomizeAllColumns(f *faker.Faker) ComplianceReportRequestMod { - return ComplianceReportRequestModSlice{ - ComplianceReportRequestMods.RandomCreated(f), - ComplianceReportRequestMods.RandomCreator(f), - ComplianceReportRequestMods.RandomID(f), - ComplianceReportRequestMods.RandomPublicID(f), - ComplianceReportRequestMods.RandomLeadID(f), - } -} - -// Set the model columns to this value -func (m complianceReportRequestMods) Created(val time.Time) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(_ context.Context, o *ComplianceReportRequestTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m complianceReportRequestMods) CreatedFunc(f func() time.Time) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(_ context.Context, o *ComplianceReportRequestTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m complianceReportRequestMods) UnsetCreated() ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(_ context.Context, o *ComplianceReportRequestTemplate) { - 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 complianceReportRequestMods) RandomCreated(f *faker.Faker) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(_ context.Context, o *ComplianceReportRequestTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m complianceReportRequestMods) Creator(val int32) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(_ context.Context, o *ComplianceReportRequestTemplate) { - o.Creator = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m complianceReportRequestMods) CreatorFunc(f func() int32) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(_ context.Context, o *ComplianceReportRequestTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m complianceReportRequestMods) UnsetCreator() ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(_ context.Context, o *ComplianceReportRequestTemplate) { - o.Creator = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m complianceReportRequestMods) RandomCreator(f *faker.Faker) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(_ context.Context, o *ComplianceReportRequestTemplate) { - o.Creator = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m complianceReportRequestMods) ID(val int32) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(_ context.Context, o *ComplianceReportRequestTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m complianceReportRequestMods) IDFunc(f func() int32) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(_ context.Context, o *ComplianceReportRequestTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m complianceReportRequestMods) UnsetID() ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(_ context.Context, o *ComplianceReportRequestTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m complianceReportRequestMods) RandomID(f *faker.Faker) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(_ context.Context, o *ComplianceReportRequestTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m complianceReportRequestMods) PublicID(val string) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(_ context.Context, o *ComplianceReportRequestTemplate) { - o.PublicID = func() string { return val } - }) -} - -// Set the Column from the function -func (m complianceReportRequestMods) PublicIDFunc(f func() string) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(_ context.Context, o *ComplianceReportRequestTemplate) { - o.PublicID = f - }) -} - -// Clear any values for the column -func (m complianceReportRequestMods) UnsetPublicID() ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(_ context.Context, o *ComplianceReportRequestTemplate) { - o.PublicID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m complianceReportRequestMods) RandomPublicID(f *faker.Faker) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(_ context.Context, o *ComplianceReportRequestTemplate) { - o.PublicID = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m complianceReportRequestMods) LeadID(val null.Val[int32]) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(_ context.Context, o *ComplianceReportRequestTemplate) { - o.LeadID = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m complianceReportRequestMods) LeadIDFunc(f func() null.Val[int32]) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(_ context.Context, o *ComplianceReportRequestTemplate) { - o.LeadID = f - }) -} - -// Clear any values for the column -func (m complianceReportRequestMods) UnsetLeadID() ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(_ context.Context, o *ComplianceReportRequestTemplate) { - o.LeadID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m complianceReportRequestMods) RandomLeadID(f *faker.Faker) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(_ context.Context, o *ComplianceReportRequestTemplate) { - o.LeadID = 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 complianceReportRequestMods) RandomLeadIDNotNull(f *faker.Faker) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(_ context.Context, o *ComplianceReportRequestTemplate) { - o.LeadID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -func (m complianceReportRequestMods) WithParentsCascading() ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(ctx context.Context, o *ComplianceReportRequestTemplate) { - if isDone, _ := complianceReportRequestWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = complianceReportRequestWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewUserWithContext(ctx, UserMods.WithParentsCascading()) - m.WithCreatorUser(related).Apply(ctx, o) - } - { - - related := o.f.NewLeadWithContext(ctx, LeadMods.WithParentsCascading()) - m.WithLead(related).Apply(ctx, o) - } - }) -} - -func (m complianceReportRequestMods) WithCreatorUser(rel *UserTemplate) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(ctx context.Context, o *ComplianceReportRequestTemplate) { - o.r.CreatorUser = &complianceReportRequestRCreatorUserR{ - o: rel, - } - }) -} - -func (m complianceReportRequestMods) WithNewCreatorUser(mods ...UserMod) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(ctx context.Context, o *ComplianceReportRequestTemplate) { - related := o.f.NewUserWithContext(ctx, mods...) - - m.WithCreatorUser(related).Apply(ctx, o) - }) -} - -func (m complianceReportRequestMods) WithExistingCreatorUser(em *models.User) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(ctx context.Context, o *ComplianceReportRequestTemplate) { - o.r.CreatorUser = &complianceReportRequestRCreatorUserR{ - o: o.f.FromExistingUser(em), - } - }) -} - -func (m complianceReportRequestMods) WithoutCreatorUser() ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(ctx context.Context, o *ComplianceReportRequestTemplate) { - o.r.CreatorUser = nil - }) -} - -func (m complianceReportRequestMods) WithLead(rel *LeadTemplate) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(ctx context.Context, o *ComplianceReportRequestTemplate) { - o.r.Lead = &complianceReportRequestRLeadR{ - o: rel, - } - }) -} - -func (m complianceReportRequestMods) WithNewLead(mods ...LeadMod) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(ctx context.Context, o *ComplianceReportRequestTemplate) { - related := o.f.NewLeadWithContext(ctx, mods...) - - m.WithLead(related).Apply(ctx, o) - }) -} - -func (m complianceReportRequestMods) WithExistingLead(em *models.Lead) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(ctx context.Context, o *ComplianceReportRequestTemplate) { - o.r.Lead = &complianceReportRequestRLeadR{ - o: o.f.FromExistingLead(em), - } - }) -} - -func (m complianceReportRequestMods) WithoutLead() ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(ctx context.Context, o *ComplianceReportRequestTemplate) { - o.r.Lead = nil - }) -} - -func (m complianceReportRequestMods) WithMailers(number int, related *CommsMailerTemplate) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(ctx context.Context, o *ComplianceReportRequestTemplate) { - o.r.Mailers = []*complianceReportRequestRMailersR{{ - number: number, - o: related, - }} - }) -} - -func (m complianceReportRequestMods) WithNewMailers(number int, mods ...CommsMailerMod) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(ctx context.Context, o *ComplianceReportRequestTemplate) { - related := o.f.NewCommsMailerWithContext(ctx, mods...) - m.WithMailers(number, related).Apply(ctx, o) - }) -} - -func (m complianceReportRequestMods) AddMailers(number int, related *CommsMailerTemplate) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(ctx context.Context, o *ComplianceReportRequestTemplate) { - o.r.Mailers = append(o.r.Mailers, &complianceReportRequestRMailersR{ - number: number, - o: related, - }) - }) -} - -func (m complianceReportRequestMods) AddNewMailers(number int, mods ...CommsMailerMod) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(ctx context.Context, o *ComplianceReportRequestTemplate) { - related := o.f.NewCommsMailerWithContext(ctx, mods...) - m.AddMailers(number, related).Apply(ctx, o) - }) -} - -func (m complianceReportRequestMods) AddExistingMailers(existingModels ...*models.CommsMailer) ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(ctx context.Context, o *ComplianceReportRequestTemplate) { - for _, em := range existingModels { - o.r.Mailers = append(o.r.Mailers, &complianceReportRequestRMailersR{ - o: o.f.FromExistingCommsMailer(em), - }) - } - }) -} - -func (m complianceReportRequestMods) WithoutMailers() ComplianceReportRequestMod { - return ComplianceReportRequestModFunc(func(ctx context.Context, o *ComplianceReportRequestTemplate) { - o.r.Mailers = nil - }) -} diff --git a/db/factory/compliance_report_request_mailer.bob.go b/db/factory/compliance_report_request_mailer.bob.go deleted file mode 100644 index e40a5245..00000000 --- a/db/factory/compliance_report_request_mailer.bob.go +++ /dev/null @@ -1,260 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/jaswdr/faker/v2" -) - -type ComplianceReportRequestMailerMod interface { - Apply(context.Context, *ComplianceReportRequestMailerTemplate) -} - -type ComplianceReportRequestMailerModFunc func(context.Context, *ComplianceReportRequestMailerTemplate) - -func (f ComplianceReportRequestMailerModFunc) Apply(ctx context.Context, n *ComplianceReportRequestMailerTemplate) { - f(ctx, n) -} - -type ComplianceReportRequestMailerModSlice []ComplianceReportRequestMailerMod - -func (mods ComplianceReportRequestMailerModSlice) Apply(ctx context.Context, n *ComplianceReportRequestMailerTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// ComplianceReportRequestMailerTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type ComplianceReportRequestMailerTemplate struct { - ComplianceReportRequestID func() int32 - MailerID func() int32 - - r complianceReportRequestMailerR - f *Factory - - alreadyPersisted bool -} - -type complianceReportRequestMailerR struct { - ComplianceReportRequest *complianceReportRequestMailerRComplianceReportRequestR - Mailer *complianceReportRequestMailerRMailerR -} - -type complianceReportRequestMailerRComplianceReportRequestR struct { - o *ComplianceReportRequestTemplate -} -type complianceReportRequestMailerRMailerR struct { - o *CommsMailerTemplate -} - -// Apply mods to the ComplianceReportRequestMailerTemplate -func (o *ComplianceReportRequestMailerTemplate) Apply(ctx context.Context, mods ...ComplianceReportRequestMailerMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.ComplianceReportRequestMailer -// according to the relationships in the template. Nothing is inserted into the db -func (t ComplianceReportRequestMailerTemplate) setModelRels(o *models.ComplianceReportRequestMailer) { - if t.r.ComplianceReportRequest != nil { - rel := t.r.ComplianceReportRequest.o.Build() - o.ComplianceReportRequestID = rel.ID // h2 - o.R.ComplianceReportRequest = rel - } - - if t.r.Mailer != nil { - rel := t.r.Mailer.o.Build() - o.MailerID = rel.ID // h2 - o.R.Mailer = rel - } -} - -// Build returns an *models.ComplianceReportRequestMailer -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ComplianceReportRequestMailerTemplate.Create -func (o ComplianceReportRequestMailerTemplate) Build() *models.ComplianceReportRequestMailer { - m := &models.ComplianceReportRequestMailer{} - - if o.ComplianceReportRequestID != nil { - m.ComplianceReportRequestID = o.ComplianceReportRequestID() - } - if o.MailerID != nil { - m.MailerID = o.MailerID() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.ComplianceReportRequestMailerSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ComplianceReportRequestMailerTemplate.CreateMany -func (o ComplianceReportRequestMailerTemplate) BuildMany(number int) models.ComplianceReportRequestMailerSlice { - m := make(models.ComplianceReportRequestMailerSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -// ComplianceReportRequestMailer has methods that act as mods for the ComplianceReportRequestMailerTemplate -var ComplianceReportRequestMailerMods complianceReportRequestMailerMods - -type complianceReportRequestMailerMods struct{} - -func (m complianceReportRequestMailerMods) RandomizeAllColumns(f *faker.Faker) ComplianceReportRequestMailerMod { - return ComplianceReportRequestMailerModSlice{ - ComplianceReportRequestMailerMods.RandomComplianceReportRequestID(f), - ComplianceReportRequestMailerMods.RandomMailerID(f), - } -} - -// Set the model columns to this value -func (m complianceReportRequestMailerMods) ComplianceReportRequestID(val int32) ComplianceReportRequestMailerMod { - return ComplianceReportRequestMailerModFunc(func(_ context.Context, o *ComplianceReportRequestMailerTemplate) { - o.ComplianceReportRequestID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m complianceReportRequestMailerMods) ComplianceReportRequestIDFunc(f func() int32) ComplianceReportRequestMailerMod { - return ComplianceReportRequestMailerModFunc(func(_ context.Context, o *ComplianceReportRequestMailerTemplate) { - o.ComplianceReportRequestID = f - }) -} - -// Clear any values for the column -func (m complianceReportRequestMailerMods) UnsetComplianceReportRequestID() ComplianceReportRequestMailerMod { - return ComplianceReportRequestMailerModFunc(func(_ context.Context, o *ComplianceReportRequestMailerTemplate) { - o.ComplianceReportRequestID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m complianceReportRequestMailerMods) RandomComplianceReportRequestID(f *faker.Faker) ComplianceReportRequestMailerMod { - return ComplianceReportRequestMailerModFunc(func(_ context.Context, o *ComplianceReportRequestMailerTemplate) { - o.ComplianceReportRequestID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m complianceReportRequestMailerMods) MailerID(val int32) ComplianceReportRequestMailerMod { - return ComplianceReportRequestMailerModFunc(func(_ context.Context, o *ComplianceReportRequestMailerTemplate) { - o.MailerID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m complianceReportRequestMailerMods) MailerIDFunc(f func() int32) ComplianceReportRequestMailerMod { - return ComplianceReportRequestMailerModFunc(func(_ context.Context, o *ComplianceReportRequestMailerTemplate) { - o.MailerID = f - }) -} - -// Clear any values for the column -func (m complianceReportRequestMailerMods) UnsetMailerID() ComplianceReportRequestMailerMod { - return ComplianceReportRequestMailerModFunc(func(_ context.Context, o *ComplianceReportRequestMailerTemplate) { - o.MailerID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m complianceReportRequestMailerMods) RandomMailerID(f *faker.Faker) ComplianceReportRequestMailerMod { - return ComplianceReportRequestMailerModFunc(func(_ context.Context, o *ComplianceReportRequestMailerTemplate) { - o.MailerID = func() int32 { - return random_int32(f) - } - }) -} - -func (m complianceReportRequestMailerMods) WithParentsCascading() ComplianceReportRequestMailerMod { - return ComplianceReportRequestMailerModFunc(func(ctx context.Context, o *ComplianceReportRequestMailerTemplate) { - if isDone, _ := complianceReportRequestMailerWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = complianceReportRequestMailerWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewComplianceReportRequestWithContext(ctx, ComplianceReportRequestMods.WithParentsCascading()) - m.WithComplianceReportRequest(related).Apply(ctx, o) - } - { - - related := o.f.NewCommsMailerWithContext(ctx, CommsMailerMods.WithParentsCascading()) - m.WithMailer(related).Apply(ctx, o) - } - }) -} - -func (m complianceReportRequestMailerMods) WithComplianceReportRequest(rel *ComplianceReportRequestTemplate) ComplianceReportRequestMailerMod { - return ComplianceReportRequestMailerModFunc(func(ctx context.Context, o *ComplianceReportRequestMailerTemplate) { - o.r.ComplianceReportRequest = &complianceReportRequestMailerRComplianceReportRequestR{ - o: rel, - } - }) -} - -func (m complianceReportRequestMailerMods) WithNewComplianceReportRequest(mods ...ComplianceReportRequestMod) ComplianceReportRequestMailerMod { - return ComplianceReportRequestMailerModFunc(func(ctx context.Context, o *ComplianceReportRequestMailerTemplate) { - related := o.f.NewComplianceReportRequestWithContext(ctx, mods...) - - m.WithComplianceReportRequest(related).Apply(ctx, o) - }) -} - -func (m complianceReportRequestMailerMods) WithExistingComplianceReportRequest(em *models.ComplianceReportRequest) ComplianceReportRequestMailerMod { - return ComplianceReportRequestMailerModFunc(func(ctx context.Context, o *ComplianceReportRequestMailerTemplate) { - o.r.ComplianceReportRequest = &complianceReportRequestMailerRComplianceReportRequestR{ - o: o.f.FromExistingComplianceReportRequest(em), - } - }) -} - -func (m complianceReportRequestMailerMods) WithoutComplianceReportRequest() ComplianceReportRequestMailerMod { - return ComplianceReportRequestMailerModFunc(func(ctx context.Context, o *ComplianceReportRequestMailerTemplate) { - o.r.ComplianceReportRequest = nil - }) -} - -func (m complianceReportRequestMailerMods) WithMailer(rel *CommsMailerTemplate) ComplianceReportRequestMailerMod { - return ComplianceReportRequestMailerModFunc(func(ctx context.Context, o *ComplianceReportRequestMailerTemplate) { - o.r.Mailer = &complianceReportRequestMailerRMailerR{ - o: rel, - } - }) -} - -func (m complianceReportRequestMailerMods) WithNewMailer(mods ...CommsMailerMod) ComplianceReportRequestMailerMod { - return ComplianceReportRequestMailerModFunc(func(ctx context.Context, o *ComplianceReportRequestMailerTemplate) { - related := o.f.NewCommsMailerWithContext(ctx, mods...) - - m.WithMailer(related).Apply(ctx, o) - }) -} - -func (m complianceReportRequestMailerMods) WithExistingMailer(em *models.CommsMailer) ComplianceReportRequestMailerMod { - return ComplianceReportRequestMailerModFunc(func(ctx context.Context, o *ComplianceReportRequestMailerTemplate) { - o.r.Mailer = &complianceReportRequestMailerRMailerR{ - o: o.f.FromExistingCommsMailer(em), - } - }) -} - -func (m complianceReportRequestMailerMods) WithoutMailer() ComplianceReportRequestMailerMod { - return ComplianceReportRequestMailerModFunc(func(ctx context.Context, o *ComplianceReportRequestMailerTemplate) { - o.r.Mailer = nil - }) -} diff --git a/db/factory/district_subscription_email.bob.go b/db/factory/district_subscription_email.bob.go deleted file mode 100644 index bfa7e834..00000000 --- a/db/factory/district_subscription_email.bob.go +++ /dev/null @@ -1,431 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/omit" - "github.com/jaswdr/faker/v2" -) - -type DistrictSubscriptionEmailMod interface { - Apply(context.Context, *DistrictSubscriptionEmailTemplate) -} - -type DistrictSubscriptionEmailModFunc func(context.Context, *DistrictSubscriptionEmailTemplate) - -func (f DistrictSubscriptionEmailModFunc) Apply(ctx context.Context, n *DistrictSubscriptionEmailTemplate) { - f(ctx, n) -} - -type DistrictSubscriptionEmailModSlice []DistrictSubscriptionEmailMod - -func (mods DistrictSubscriptionEmailModSlice) Apply(ctx context.Context, n *DistrictSubscriptionEmailTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// DistrictSubscriptionEmailTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type DistrictSubscriptionEmailTemplate struct { - OrganizationID func() int32 - EmailContactAddress func() string - - r districtSubscriptionEmailR - f *Factory - - alreadyPersisted bool -} - -type districtSubscriptionEmailR struct { - EmailContactAddressEmailContact *districtSubscriptionEmailREmailContactAddressEmailContactR - Organization *districtSubscriptionEmailROrganizationR -} - -type districtSubscriptionEmailREmailContactAddressEmailContactR struct { - o *CommsEmailContactTemplate -} -type districtSubscriptionEmailROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the DistrictSubscriptionEmailTemplate -func (o *DistrictSubscriptionEmailTemplate) Apply(ctx context.Context, mods ...DistrictSubscriptionEmailMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.DistrictSubscriptionEmail -// according to the relationships in the template. Nothing is inserted into the db -func (t DistrictSubscriptionEmailTemplate) setModelRels(o *models.DistrictSubscriptionEmail) { - if t.r.EmailContactAddressEmailContact != nil { - rel := t.r.EmailContactAddressEmailContact.o.Build() - o.EmailContactAddress = rel.Address // h2 - o.R.EmailContactAddressEmailContact = rel - } - - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.DistrictSubscriptionEmailSetter -// this does nothing with the relationship templates -func (o DistrictSubscriptionEmailTemplate) BuildSetter() *models.DistrictSubscriptionEmailSetter { - m := &models.DistrictSubscriptionEmailSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.EmailContactAddress != nil { - val := o.EmailContactAddress() - m.EmailContactAddress = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.DistrictSubscriptionEmailSetter -// this does nothing with the relationship templates -func (o DistrictSubscriptionEmailTemplate) BuildManySetter(number int) []*models.DistrictSubscriptionEmailSetter { - m := make([]*models.DistrictSubscriptionEmailSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.DistrictSubscriptionEmail -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use DistrictSubscriptionEmailTemplate.Create -func (o DistrictSubscriptionEmailTemplate) Build() *models.DistrictSubscriptionEmail { - m := &models.DistrictSubscriptionEmail{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.EmailContactAddress != nil { - m.EmailContactAddress = o.EmailContactAddress() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.DistrictSubscriptionEmailSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use DistrictSubscriptionEmailTemplate.CreateMany -func (o DistrictSubscriptionEmailTemplate) BuildMany(number int) models.DistrictSubscriptionEmailSlice { - m := make(models.DistrictSubscriptionEmailSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableDistrictSubscriptionEmail(m *models.DistrictSubscriptionEmailSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.EmailContactAddress.IsValue()) { - val := random_string(nil) - m.EmailContactAddress = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.DistrictSubscriptionEmail -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *DistrictSubscriptionEmailTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.DistrictSubscriptionEmail) error { - var err error - - return err -} - -// Create builds a districtSubscriptionEmail and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *DistrictSubscriptionEmailTemplate) Create(ctx context.Context, exec bob.Executor) (*models.DistrictSubscriptionEmail, error) { - var err error - opt := o.BuildSetter() - ensureCreatableDistrictSubscriptionEmail(opt) - - if o.r.EmailContactAddressEmailContact == nil { - DistrictSubscriptionEmailMods.WithNewEmailContactAddressEmailContact().Apply(ctx, o) - } - - var rel0 *models.CommsEmailContact - - if o.r.EmailContactAddressEmailContact.o.alreadyPersisted { - rel0 = o.r.EmailContactAddressEmailContact.o.Build() - } else { - rel0, err = o.r.EmailContactAddressEmailContact.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.EmailContactAddress = omit.From(rel0.Address) - - if o.r.Organization == nil { - DistrictSubscriptionEmailMods.WithNewOrganization().Apply(ctx, o) - } - - var rel1 *models.Organization - - if o.r.Organization.o.alreadyPersisted { - rel1 = o.r.Organization.o.Build() - } else { - rel1, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.OrganizationID = omit.From(rel1.ID) - - m, err := models.DistrictSubscriptionEmails.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.EmailContactAddressEmailContact = rel0 - m.R.Organization = rel1 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a districtSubscriptionEmail and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *DistrictSubscriptionEmailTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.DistrictSubscriptionEmail { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a districtSubscriptionEmail 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 *DistrictSubscriptionEmailTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.DistrictSubscriptionEmail { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple districtSubscriptionEmails and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o DistrictSubscriptionEmailTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.DistrictSubscriptionEmailSlice, error) { - var err error - m := make(models.DistrictSubscriptionEmailSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple districtSubscriptionEmails and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o DistrictSubscriptionEmailTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.DistrictSubscriptionEmailSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple districtSubscriptionEmails 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 DistrictSubscriptionEmailTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.DistrictSubscriptionEmailSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// DistrictSubscriptionEmail has methods that act as mods for the DistrictSubscriptionEmailTemplate -var DistrictSubscriptionEmailMods districtSubscriptionEmailMods - -type districtSubscriptionEmailMods struct{} - -func (m districtSubscriptionEmailMods) RandomizeAllColumns(f *faker.Faker) DistrictSubscriptionEmailMod { - return DistrictSubscriptionEmailModSlice{ - DistrictSubscriptionEmailMods.RandomOrganizationID(f), - DistrictSubscriptionEmailMods.RandomEmailContactAddress(f), - } -} - -// Set the model columns to this value -func (m districtSubscriptionEmailMods) OrganizationID(val int32) DistrictSubscriptionEmailMod { - return DistrictSubscriptionEmailModFunc(func(_ context.Context, o *DistrictSubscriptionEmailTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m districtSubscriptionEmailMods) OrganizationIDFunc(f func() int32) DistrictSubscriptionEmailMod { - return DistrictSubscriptionEmailModFunc(func(_ context.Context, o *DistrictSubscriptionEmailTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m districtSubscriptionEmailMods) UnsetOrganizationID() DistrictSubscriptionEmailMod { - return DistrictSubscriptionEmailModFunc(func(_ context.Context, o *DistrictSubscriptionEmailTemplate) { - 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 districtSubscriptionEmailMods) RandomOrganizationID(f *faker.Faker) DistrictSubscriptionEmailMod { - return DistrictSubscriptionEmailModFunc(func(_ context.Context, o *DistrictSubscriptionEmailTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m districtSubscriptionEmailMods) EmailContactAddress(val string) DistrictSubscriptionEmailMod { - return DistrictSubscriptionEmailModFunc(func(_ context.Context, o *DistrictSubscriptionEmailTemplate) { - o.EmailContactAddress = func() string { return val } - }) -} - -// Set the Column from the function -func (m districtSubscriptionEmailMods) EmailContactAddressFunc(f func() string) DistrictSubscriptionEmailMod { - return DistrictSubscriptionEmailModFunc(func(_ context.Context, o *DistrictSubscriptionEmailTemplate) { - o.EmailContactAddress = f - }) -} - -// Clear any values for the column -func (m districtSubscriptionEmailMods) UnsetEmailContactAddress() DistrictSubscriptionEmailMod { - return DistrictSubscriptionEmailModFunc(func(_ context.Context, o *DistrictSubscriptionEmailTemplate) { - o.EmailContactAddress = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m districtSubscriptionEmailMods) RandomEmailContactAddress(f *faker.Faker) DistrictSubscriptionEmailMod { - return DistrictSubscriptionEmailModFunc(func(_ context.Context, o *DistrictSubscriptionEmailTemplate) { - o.EmailContactAddress = func() string { - return random_string(f) - } - }) -} - -func (m districtSubscriptionEmailMods) WithParentsCascading() DistrictSubscriptionEmailMod { - return DistrictSubscriptionEmailModFunc(func(ctx context.Context, o *DistrictSubscriptionEmailTemplate) { - if isDone, _ := districtSubscriptionEmailWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = districtSubscriptionEmailWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewCommsEmailContactWithContext(ctx, CommsEmailContactMods.WithParentsCascading()) - m.WithEmailContactAddressEmailContact(related).Apply(ctx, o) - } - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m districtSubscriptionEmailMods) WithEmailContactAddressEmailContact(rel *CommsEmailContactTemplate) DistrictSubscriptionEmailMod { - return DistrictSubscriptionEmailModFunc(func(ctx context.Context, o *DistrictSubscriptionEmailTemplate) { - o.r.EmailContactAddressEmailContact = &districtSubscriptionEmailREmailContactAddressEmailContactR{ - o: rel, - } - }) -} - -func (m districtSubscriptionEmailMods) WithNewEmailContactAddressEmailContact(mods ...CommsEmailContactMod) DistrictSubscriptionEmailMod { - return DistrictSubscriptionEmailModFunc(func(ctx context.Context, o *DistrictSubscriptionEmailTemplate) { - related := o.f.NewCommsEmailContactWithContext(ctx, mods...) - - m.WithEmailContactAddressEmailContact(related).Apply(ctx, o) - }) -} - -func (m districtSubscriptionEmailMods) WithExistingEmailContactAddressEmailContact(em *models.CommsEmailContact) DistrictSubscriptionEmailMod { - return DistrictSubscriptionEmailModFunc(func(ctx context.Context, o *DistrictSubscriptionEmailTemplate) { - o.r.EmailContactAddressEmailContact = &districtSubscriptionEmailREmailContactAddressEmailContactR{ - o: o.f.FromExistingCommsEmailContact(em), - } - }) -} - -func (m districtSubscriptionEmailMods) WithoutEmailContactAddressEmailContact() DistrictSubscriptionEmailMod { - return DistrictSubscriptionEmailModFunc(func(ctx context.Context, o *DistrictSubscriptionEmailTemplate) { - o.r.EmailContactAddressEmailContact = nil - }) -} - -func (m districtSubscriptionEmailMods) WithOrganization(rel *OrganizationTemplate) DistrictSubscriptionEmailMod { - return DistrictSubscriptionEmailModFunc(func(ctx context.Context, o *DistrictSubscriptionEmailTemplate) { - o.r.Organization = &districtSubscriptionEmailROrganizationR{ - o: rel, - } - }) -} - -func (m districtSubscriptionEmailMods) WithNewOrganization(mods ...OrganizationMod) DistrictSubscriptionEmailMod { - return DistrictSubscriptionEmailModFunc(func(ctx context.Context, o *DistrictSubscriptionEmailTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m districtSubscriptionEmailMods) WithExistingOrganization(em *models.Organization) DistrictSubscriptionEmailMod { - return DistrictSubscriptionEmailModFunc(func(ctx context.Context, o *DistrictSubscriptionEmailTemplate) { - o.r.Organization = &districtSubscriptionEmailROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m districtSubscriptionEmailMods) WithoutOrganization() DistrictSubscriptionEmailMod { - return DistrictSubscriptionEmailModFunc(func(ctx context.Context, o *DistrictSubscriptionEmailTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/district_subscription_phone.bob.go b/db/factory/district_subscription_phone.bob.go deleted file mode 100644 index 225d1a00..00000000 --- a/db/factory/district_subscription_phone.bob.go +++ /dev/null @@ -1,431 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/omit" - "github.com/jaswdr/faker/v2" -) - -type DistrictSubscriptionPhoneMod interface { - Apply(context.Context, *DistrictSubscriptionPhoneTemplate) -} - -type DistrictSubscriptionPhoneModFunc func(context.Context, *DistrictSubscriptionPhoneTemplate) - -func (f DistrictSubscriptionPhoneModFunc) Apply(ctx context.Context, n *DistrictSubscriptionPhoneTemplate) { - f(ctx, n) -} - -type DistrictSubscriptionPhoneModSlice []DistrictSubscriptionPhoneMod - -func (mods DistrictSubscriptionPhoneModSlice) Apply(ctx context.Context, n *DistrictSubscriptionPhoneTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// DistrictSubscriptionPhoneTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type DistrictSubscriptionPhoneTemplate struct { - OrganizationID func() int32 - PhoneE164 func() string - - r districtSubscriptionPhoneR - f *Factory - - alreadyPersisted bool -} - -type districtSubscriptionPhoneR struct { - Organization *districtSubscriptionPhoneROrganizationR - PhoneE164Phone *districtSubscriptionPhoneRPhoneE164PhoneR -} - -type districtSubscriptionPhoneROrganizationR struct { - o *OrganizationTemplate -} -type districtSubscriptionPhoneRPhoneE164PhoneR struct { - o *CommsPhoneTemplate -} - -// Apply mods to the DistrictSubscriptionPhoneTemplate -func (o *DistrictSubscriptionPhoneTemplate) Apply(ctx context.Context, mods ...DistrictSubscriptionPhoneMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.DistrictSubscriptionPhone -// according to the relationships in the template. Nothing is inserted into the db -func (t DistrictSubscriptionPhoneTemplate) setModelRels(o *models.DistrictSubscriptionPhone) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } - - if t.r.PhoneE164Phone != nil { - rel := t.r.PhoneE164Phone.o.Build() - o.PhoneE164 = rel.E164 // h2 - o.R.PhoneE164Phone = rel - } -} - -// BuildSetter returns an *models.DistrictSubscriptionPhoneSetter -// this does nothing with the relationship templates -func (o DistrictSubscriptionPhoneTemplate) BuildSetter() *models.DistrictSubscriptionPhoneSetter { - m := &models.DistrictSubscriptionPhoneSetter{} - - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.PhoneE164 != nil { - val := o.PhoneE164() - m.PhoneE164 = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.DistrictSubscriptionPhoneSetter -// this does nothing with the relationship templates -func (o DistrictSubscriptionPhoneTemplate) BuildManySetter(number int) []*models.DistrictSubscriptionPhoneSetter { - m := make([]*models.DistrictSubscriptionPhoneSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.DistrictSubscriptionPhone -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use DistrictSubscriptionPhoneTemplate.Create -func (o DistrictSubscriptionPhoneTemplate) Build() *models.DistrictSubscriptionPhone { - m := &models.DistrictSubscriptionPhone{} - - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.PhoneE164 != nil { - m.PhoneE164 = o.PhoneE164() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.DistrictSubscriptionPhoneSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use DistrictSubscriptionPhoneTemplate.CreateMany -func (o DistrictSubscriptionPhoneTemplate) BuildMany(number int) models.DistrictSubscriptionPhoneSlice { - m := make(models.DistrictSubscriptionPhoneSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableDistrictSubscriptionPhone(m *models.DistrictSubscriptionPhoneSetter) { - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.PhoneE164.IsValue()) { - val := random_string(nil) - m.PhoneE164 = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.DistrictSubscriptionPhone -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *DistrictSubscriptionPhoneTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.DistrictSubscriptionPhone) error { - var err error - - return err -} - -// Create builds a districtSubscriptionPhone and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *DistrictSubscriptionPhoneTemplate) Create(ctx context.Context, exec bob.Executor) (*models.DistrictSubscriptionPhone, error) { - var err error - opt := o.BuildSetter() - ensureCreatableDistrictSubscriptionPhone(opt) - - if o.r.Organization == nil { - DistrictSubscriptionPhoneMods.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) - - if o.r.PhoneE164Phone == nil { - DistrictSubscriptionPhoneMods.WithNewPhoneE164Phone().Apply(ctx, o) - } - - var rel1 *models.CommsPhone - - if o.r.PhoneE164Phone.o.alreadyPersisted { - rel1 = o.r.PhoneE164Phone.o.Build() - } else { - rel1, err = o.r.PhoneE164Phone.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.PhoneE164 = omit.From(rel1.E164) - - m, err := models.DistrictSubscriptionPhones.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.Organization = rel0 - m.R.PhoneE164Phone = rel1 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a districtSubscriptionPhone and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *DistrictSubscriptionPhoneTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.DistrictSubscriptionPhone { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a districtSubscriptionPhone 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 *DistrictSubscriptionPhoneTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.DistrictSubscriptionPhone { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple districtSubscriptionPhones and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o DistrictSubscriptionPhoneTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.DistrictSubscriptionPhoneSlice, error) { - var err error - m := make(models.DistrictSubscriptionPhoneSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple districtSubscriptionPhones and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o DistrictSubscriptionPhoneTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.DistrictSubscriptionPhoneSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple districtSubscriptionPhones 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 DistrictSubscriptionPhoneTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.DistrictSubscriptionPhoneSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// DistrictSubscriptionPhone has methods that act as mods for the DistrictSubscriptionPhoneTemplate -var DistrictSubscriptionPhoneMods districtSubscriptionPhoneMods - -type districtSubscriptionPhoneMods struct{} - -func (m districtSubscriptionPhoneMods) RandomizeAllColumns(f *faker.Faker) DistrictSubscriptionPhoneMod { - return DistrictSubscriptionPhoneModSlice{ - DistrictSubscriptionPhoneMods.RandomOrganizationID(f), - DistrictSubscriptionPhoneMods.RandomPhoneE164(f), - } -} - -// Set the model columns to this value -func (m districtSubscriptionPhoneMods) OrganizationID(val int32) DistrictSubscriptionPhoneMod { - return DistrictSubscriptionPhoneModFunc(func(_ context.Context, o *DistrictSubscriptionPhoneTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m districtSubscriptionPhoneMods) OrganizationIDFunc(f func() int32) DistrictSubscriptionPhoneMod { - return DistrictSubscriptionPhoneModFunc(func(_ context.Context, o *DistrictSubscriptionPhoneTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m districtSubscriptionPhoneMods) UnsetOrganizationID() DistrictSubscriptionPhoneMod { - return DistrictSubscriptionPhoneModFunc(func(_ context.Context, o *DistrictSubscriptionPhoneTemplate) { - 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 districtSubscriptionPhoneMods) RandomOrganizationID(f *faker.Faker) DistrictSubscriptionPhoneMod { - return DistrictSubscriptionPhoneModFunc(func(_ context.Context, o *DistrictSubscriptionPhoneTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m districtSubscriptionPhoneMods) PhoneE164(val string) DistrictSubscriptionPhoneMod { - return DistrictSubscriptionPhoneModFunc(func(_ context.Context, o *DistrictSubscriptionPhoneTemplate) { - o.PhoneE164 = func() string { return val } - }) -} - -// Set the Column from the function -func (m districtSubscriptionPhoneMods) PhoneE164Func(f func() string) DistrictSubscriptionPhoneMod { - return DistrictSubscriptionPhoneModFunc(func(_ context.Context, o *DistrictSubscriptionPhoneTemplate) { - o.PhoneE164 = f - }) -} - -// Clear any values for the column -func (m districtSubscriptionPhoneMods) UnsetPhoneE164() DistrictSubscriptionPhoneMod { - return DistrictSubscriptionPhoneModFunc(func(_ context.Context, o *DistrictSubscriptionPhoneTemplate) { - o.PhoneE164 = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m districtSubscriptionPhoneMods) RandomPhoneE164(f *faker.Faker) DistrictSubscriptionPhoneMod { - return DistrictSubscriptionPhoneModFunc(func(_ context.Context, o *DistrictSubscriptionPhoneTemplate) { - o.PhoneE164 = func() string { - return random_string(f) - } - }) -} - -func (m districtSubscriptionPhoneMods) WithParentsCascading() DistrictSubscriptionPhoneMod { - return DistrictSubscriptionPhoneModFunc(func(ctx context.Context, o *DistrictSubscriptionPhoneTemplate) { - if isDone, _ := districtSubscriptionPhoneWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = districtSubscriptionPhoneWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - { - - related := o.f.NewCommsPhoneWithContext(ctx, CommsPhoneMods.WithParentsCascading()) - m.WithPhoneE164Phone(related).Apply(ctx, o) - } - }) -} - -func (m districtSubscriptionPhoneMods) WithOrganization(rel *OrganizationTemplate) DistrictSubscriptionPhoneMod { - return DistrictSubscriptionPhoneModFunc(func(ctx context.Context, o *DistrictSubscriptionPhoneTemplate) { - o.r.Organization = &districtSubscriptionPhoneROrganizationR{ - o: rel, - } - }) -} - -func (m districtSubscriptionPhoneMods) WithNewOrganization(mods ...OrganizationMod) DistrictSubscriptionPhoneMod { - return DistrictSubscriptionPhoneModFunc(func(ctx context.Context, o *DistrictSubscriptionPhoneTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m districtSubscriptionPhoneMods) WithExistingOrganization(em *models.Organization) DistrictSubscriptionPhoneMod { - return DistrictSubscriptionPhoneModFunc(func(ctx context.Context, o *DistrictSubscriptionPhoneTemplate) { - o.r.Organization = &districtSubscriptionPhoneROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m districtSubscriptionPhoneMods) WithoutOrganization() DistrictSubscriptionPhoneMod { - return DistrictSubscriptionPhoneModFunc(func(ctx context.Context, o *DistrictSubscriptionPhoneTemplate) { - o.r.Organization = nil - }) -} - -func (m districtSubscriptionPhoneMods) WithPhoneE164Phone(rel *CommsPhoneTemplate) DistrictSubscriptionPhoneMod { - return DistrictSubscriptionPhoneModFunc(func(ctx context.Context, o *DistrictSubscriptionPhoneTemplate) { - o.r.PhoneE164Phone = &districtSubscriptionPhoneRPhoneE164PhoneR{ - o: rel, - } - }) -} - -func (m districtSubscriptionPhoneMods) WithNewPhoneE164Phone(mods ...CommsPhoneMod) DistrictSubscriptionPhoneMod { - return DistrictSubscriptionPhoneModFunc(func(ctx context.Context, o *DistrictSubscriptionPhoneTemplate) { - related := o.f.NewCommsPhoneWithContext(ctx, mods...) - - m.WithPhoneE164Phone(related).Apply(ctx, o) - }) -} - -func (m districtSubscriptionPhoneMods) WithExistingPhoneE164Phone(em *models.CommsPhone) DistrictSubscriptionPhoneMod { - return DistrictSubscriptionPhoneModFunc(func(ctx context.Context, o *DistrictSubscriptionPhoneTemplate) { - o.r.PhoneE164Phone = &districtSubscriptionPhoneRPhoneE164PhoneR{ - o: o.f.FromExistingCommsPhone(em), - } - }) -} - -func (m districtSubscriptionPhoneMods) WithoutPhoneE164Phone() DistrictSubscriptionPhoneMod { - return DistrictSubscriptionPhoneModFunc(func(ctx context.Context, o *DistrictSubscriptionPhoneTemplate) { - o.r.PhoneE164Phone = nil - }) -} diff --git a/db/factory/fieldseeker.containerrelate.bob.go b/db/factory/fieldseeker.containerrelate.bob.go deleted file mode 100644 index 4cead88c..00000000 --- a/db/factory/fieldseeker.containerrelate.bob.go +++ /dev/null @@ -1,1309 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerContainerrelateMod interface { - Apply(context.Context, *FieldseekerContainerrelateTemplate) -} - -type FieldseekerContainerrelateModFunc func(context.Context, *FieldseekerContainerrelateTemplate) - -func (f FieldseekerContainerrelateModFunc) Apply(ctx context.Context, n *FieldseekerContainerrelateTemplate) { - f(ctx, n) -} - -type FieldseekerContainerrelateModSlice []FieldseekerContainerrelateMod - -func (mods FieldseekerContainerrelateModSlice) Apply(ctx context.Context, n *FieldseekerContainerrelateTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerContainerrelateTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerContainerrelateTemplate struct { - Objectid func() int64 - Globalid func() uuid.UUID - CreatedUser func() null.Val[string] - CreatedDate func() null.Val[time.Time] - LastEditedUser func() null.Val[string] - LastEditedDate func() null.Val[time.Time] - Inspsampleid func() null.Val[uuid.UUID] - Mosquitoinspid func() null.Val[uuid.UUID] - Treatmentid func() null.Val[uuid.UUID] - 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerContainerrelateTemplate) BuildSetter() *models.FieldseekerContainerrelateSetter { - m := &models.FieldseekerContainerrelateSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = 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.Treatmentid != nil { - val := o.Treatmentid() - m.Treatmentid = omitnull.FromNull(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.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 -} - -// BuildManySetter returns an []*models.FieldseekerContainerrelateSetter -// this does nothing with the relationship templates -func (o FieldseekerContainerrelateTemplate) BuildManySetter(number int) []*models.FieldseekerContainerrelateSetter { - m := make([]*models.FieldseekerContainerrelateSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerContainerrelate -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerContainerrelateTemplate.Create -func (o FieldseekerContainerrelateTemplate) Build() *models.FieldseekerContainerrelate { - m := &models.FieldseekerContainerrelate{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.Inspsampleid != nil { - m.Inspsampleid = o.Inspsampleid() - } - if o.Mosquitoinspid != nil { - m.Mosquitoinspid = o.Mosquitoinspid() - } - if o.Treatmentid != nil { - m.Treatmentid = o.Treatmentid() - } - 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.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) - - return m -} - -// BuildMany returns an models.FieldseekerContainerrelateSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerContainerrelateTemplate.CreateMany -func (o FieldseekerContainerrelateTemplate) BuildMany(number int) models.FieldseekerContainerrelateSlice { - m := make(models.FieldseekerContainerrelateSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerContainerrelate(m *models.FieldseekerContainerrelateSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerContainerrelateTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerContainerrelate) error { - var err error - - return err -} - -// Create builds a fieldseekerContainerrelate and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerContainerrelateTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerContainerrelate, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerContainerrelate and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerContainerrelateTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerContainerrelate { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerContainerrelate 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 *FieldseekerContainerrelateTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerContainerrelate { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerContainerrelates and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerContainerrelateTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerContainerrelateSlice, error) { - var err error - m := make(models.FieldseekerContainerrelateSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerContainerrelates and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerContainerrelateTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerContainerrelateSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerContainerrelates 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 FieldseekerContainerrelateTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerContainerrelateSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerContainerrelate has methods that act as mods for the FieldseekerContainerrelateTemplate -var FieldseekerContainerrelateMods fieldseekerContainerrelateMods - -type fieldseekerContainerrelateMods struct{} - -func (m fieldseekerContainerrelateMods) RandomizeAllColumns(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModSlice{ - FieldseekerContainerrelateMods.RandomObjectid(f), - FieldseekerContainerrelateMods.RandomGlobalid(f), - FieldseekerContainerrelateMods.RandomCreatedUser(f), - FieldseekerContainerrelateMods.RandomCreatedDate(f), - FieldseekerContainerrelateMods.RandomLastEditedUser(f), - FieldseekerContainerrelateMods.RandomLastEditedDate(f), - FieldseekerContainerrelateMods.RandomInspsampleid(f), - FieldseekerContainerrelateMods.RandomMosquitoinspid(f), - FieldseekerContainerrelateMods.RandomTreatmentid(f), - FieldseekerContainerrelateMods.RandomContainertype(f), - FieldseekerContainerrelateMods.RandomCreationdate(f), - FieldseekerContainerrelateMods.RandomCreator(f), - FieldseekerContainerrelateMods.RandomEditdate(f), - FieldseekerContainerrelateMods.RandomEditor(f), - FieldseekerContainerrelateMods.RandomGeometry(f), - FieldseekerContainerrelateMods.RandomGeospatial(f), - FieldseekerContainerrelateMods.RandomVersion(f), - FieldseekerContainerrelateMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerContainerrelateMods) Objectid(val int64) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerContainerrelateMods) ObjectidFunc(f func() int64) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerContainerrelateMods) UnsetObjectid() FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - 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 fieldseekerContainerrelateMods) RandomObjectid(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerContainerrelateMods) Globalid(val uuid.UUID) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerContainerrelateMods) GlobalidFunc(f func() uuid.UUID) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerContainerrelateMods) UnsetGlobalid() FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - 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 fieldseekerContainerrelateMods) RandomGlobalid(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerContainerrelateMods) CreatedUser(val null.Val[string]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerContainerrelateMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerContainerrelateMods) UnsetCreatedUser() FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - 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 fieldseekerContainerrelateMods) RandomCreatedUser(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerContainerrelateMods) CreatedDate(val null.Val[time.Time]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerContainerrelateMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerContainerrelateMods) UnsetCreatedDate() FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - 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 fieldseekerContainerrelateMods) RandomCreatedDate(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.CreatedDate = 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 fieldseekerContainerrelateMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.CreatedDate = 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 fieldseekerContainerrelateMods) LastEditedUser(val null.Val[string]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerContainerrelateMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerContainerrelateMods) UnsetLastEditedUser() FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - 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 fieldseekerContainerrelateMods) RandomLastEditedUser(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerContainerrelateMods) LastEditedDate(val null.Val[time.Time]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerContainerrelateMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerContainerrelateMods) UnsetLastEditedDate() FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - 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 fieldseekerContainerrelateMods) RandomLastEditedDate(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.LastEditedDate = 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 fieldseekerContainerrelateMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.LastEditedDate = 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 fieldseekerContainerrelateMods) Inspsampleid(val null.Val[uuid.UUID]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Inspsampleid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerContainerrelateMods) InspsampleidFunc(f func() null.Val[uuid.UUID]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Inspsampleid = f - }) -} - -// Clear any values for the column -func (m fieldseekerContainerrelateMods) UnsetInspsampleid() FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - 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 fieldseekerContainerrelateMods) RandomInspsampleid(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Inspsampleid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomInspsampleidNotNull(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Inspsampleid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerContainerrelateMods) Mosquitoinspid(val null.Val[uuid.UUID]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Mosquitoinspid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerContainerrelateMods) MosquitoinspidFunc(f func() null.Val[uuid.UUID]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Mosquitoinspid = f - }) -} - -// Clear any values for the column -func (m fieldseekerContainerrelateMods) UnsetMosquitoinspid() FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - 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 fieldseekerContainerrelateMods) RandomMosquitoinspid(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Mosquitoinspid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomMosquitoinspidNotNull(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Mosquitoinspid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerContainerrelateMods) Treatmentid(val null.Val[uuid.UUID]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Treatmentid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerContainerrelateMods) TreatmentidFunc(f func() null.Val[uuid.UUID]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Treatmentid = f - }) -} - -// Clear any values for the column -func (m fieldseekerContainerrelateMods) UnsetTreatmentid() FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - 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 fieldseekerContainerrelateMods) RandomTreatmentid(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Treatmentid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomTreatmentidNotNull(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Treatmentid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerContainerrelateMods) Containertype(val null.Val[string]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Containertype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerContainerrelateMods) ContainertypeFunc(f func() null.Val[string]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Containertype = f - }) -} - -// Clear any values for the column -func (m fieldseekerContainerrelateMods) UnsetContainertype() FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - 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 fieldseekerContainerrelateMods) RandomContainertype(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Containertype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomContainertypeNotNull(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Containertype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerContainerrelateMods) Creationdate(val null.Val[time.Time]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerContainerrelateMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerContainerrelateMods) UnsetCreationdate() FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - 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 fieldseekerContainerrelateMods) RandomCreationdate(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Creationdate = 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 fieldseekerContainerrelateMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Creationdate = 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 fieldseekerContainerrelateMods) Creator(val null.Val[string]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerContainerrelateMods) CreatorFunc(f func() null.Val[string]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerContainerrelateMods) UnsetCreator() FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - 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 fieldseekerContainerrelateMods) RandomCreator(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerContainerrelateMods) Editdate(val null.Val[time.Time]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerContainerrelateMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerContainerrelateMods) UnsetEditdate() FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - 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 fieldseekerContainerrelateMods) RandomEditdate(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Editdate = 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 fieldseekerContainerrelateMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Editdate = 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 fieldseekerContainerrelateMods) Editor(val null.Val[string]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerContainerrelateMods) EditorFunc(f func() null.Val[string]) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerContainerrelateMods) UnsetEditor() FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - 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 fieldseekerContainerrelateMods) RandomEditor(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerContainerrelateMods) VersionFunc(f func() int32) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerContainerrelateMods) UnsetVersion() FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - 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 fieldseekerContainerrelateMods) RandomVersion(f *faker.Faker) FieldseekerContainerrelateMod { - return FieldseekerContainerrelateModFunc(func(_ context.Context, o *FieldseekerContainerrelateTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index ebc104ac..00000000 --- a/db/factory/fieldseeker.fieldscoutinglog.bob.go +++ /dev/null @@ -1,1123 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerFieldscoutinglogMod interface { - Apply(context.Context, *FieldseekerFieldscoutinglogTemplate) -} - -type FieldseekerFieldscoutinglogModFunc func(context.Context, *FieldseekerFieldscoutinglogTemplate) - -func (f FieldseekerFieldscoutinglogModFunc) Apply(ctx context.Context, n *FieldseekerFieldscoutinglogTemplate) { - f(ctx, n) -} - -type FieldseekerFieldscoutinglogModSlice []FieldseekerFieldscoutinglogMod - -func (mods FieldseekerFieldscoutinglogModSlice) Apply(ctx context.Context, n *FieldseekerFieldscoutinglogTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerFieldscoutinglogTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerFieldscoutinglogTemplate struct { - Objectid func() int64 - Status func() null.Val[int16] - Globalid func() uuid.UUID - CreatedUser func() null.Val[string] - CreatedDate func() null.Val[time.Time] - LastEditedUser func() null.Val[string] - LastEditedDate func() null.Val[time.Time] - 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 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerFieldscoutinglogTemplate) BuildSetter() *models.FieldseekerFieldscoutinglogSetter { - m := &models.FieldseekerFieldscoutinglogSetter{} - - 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.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = 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.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 -} - -// BuildManySetter returns an []*models.FieldseekerFieldscoutinglogSetter -// this does nothing with the relationship templates -func (o FieldseekerFieldscoutinglogTemplate) BuildManySetter(number int) []*models.FieldseekerFieldscoutinglogSetter { - m := make([]*models.FieldseekerFieldscoutinglogSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerFieldscoutinglog -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerFieldscoutinglogTemplate.Create -func (o FieldseekerFieldscoutinglogTemplate) Build() *models.FieldseekerFieldscoutinglog { - m := &models.FieldseekerFieldscoutinglog{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Status != nil { - m.Status = o.Status() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - 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.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) - - return m -} - -// BuildMany returns an models.FieldseekerFieldscoutinglogSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerFieldscoutinglogTemplate.CreateMany -func (o FieldseekerFieldscoutinglogTemplate) BuildMany(number int) models.FieldseekerFieldscoutinglogSlice { - m := make(models.FieldseekerFieldscoutinglogSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerFieldscoutinglog(m *models.FieldseekerFieldscoutinglogSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerFieldscoutinglogTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerFieldscoutinglog) error { - var err error - - return err -} - -// Create builds a fieldseekerFieldscoutinglog and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerFieldscoutinglogTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerFieldscoutinglog, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerFieldscoutinglog and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerFieldscoutinglogTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerFieldscoutinglog { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerFieldscoutinglog 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 *FieldseekerFieldscoutinglogTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerFieldscoutinglog { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerFieldscoutinglogs and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerFieldscoutinglogTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerFieldscoutinglogSlice, error) { - var err error - m := make(models.FieldseekerFieldscoutinglogSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerFieldscoutinglogs and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerFieldscoutinglogTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerFieldscoutinglogSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerFieldscoutinglogs 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 FieldseekerFieldscoutinglogTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerFieldscoutinglogSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerFieldscoutinglog has methods that act as mods for the FieldseekerFieldscoutinglogTemplate -var FieldseekerFieldscoutinglogMods fieldseekerFieldscoutinglogMods - -type fieldseekerFieldscoutinglogMods struct{} - -func (m fieldseekerFieldscoutinglogMods) RandomizeAllColumns(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModSlice{ - FieldseekerFieldscoutinglogMods.RandomObjectid(f), - FieldseekerFieldscoutinglogMods.RandomStatus(f), - FieldseekerFieldscoutinglogMods.RandomGlobalid(f), - FieldseekerFieldscoutinglogMods.RandomCreatedUser(f), - FieldseekerFieldscoutinglogMods.RandomCreatedDate(f), - FieldseekerFieldscoutinglogMods.RandomLastEditedUser(f), - FieldseekerFieldscoutinglogMods.RandomLastEditedDate(f), - FieldseekerFieldscoutinglogMods.RandomCreationdate(f), - FieldseekerFieldscoutinglogMods.RandomCreator(f), - FieldseekerFieldscoutinglogMods.RandomEditdate(f), - FieldseekerFieldscoutinglogMods.RandomEditor(f), - FieldseekerFieldscoutinglogMods.RandomGeometry(f), - FieldseekerFieldscoutinglogMods.RandomGeospatial(f), - FieldseekerFieldscoutinglogMods.RandomVersion(f), - FieldseekerFieldscoutinglogMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerFieldscoutinglogMods) Objectid(val int64) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerFieldscoutinglogMods) ObjectidFunc(f func() int64) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerFieldscoutinglogMods) UnsetObjectid() FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - 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 fieldseekerFieldscoutinglogMods) RandomObjectid(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerFieldscoutinglogMods) Status(val null.Val[int16]) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Status = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerFieldscoutinglogMods) StatusFunc(f func() null.Val[int16]) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Status = f - }) -} - -// Clear any values for the column -func (m fieldseekerFieldscoutinglogMods) UnsetStatus() FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - 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 fieldseekerFieldscoutinglogMods) RandomStatus(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - 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 fieldseekerFieldscoutinglogMods) RandomStatusNotNull(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - 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 fieldseekerFieldscoutinglogMods) Globalid(val uuid.UUID) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerFieldscoutinglogMods) GlobalidFunc(f func() uuid.UUID) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerFieldscoutinglogMods) UnsetGlobalid() FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - 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 fieldseekerFieldscoutinglogMods) RandomGlobalid(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerFieldscoutinglogMods) CreatedUser(val null.Val[string]) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerFieldscoutinglogMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerFieldscoutinglogMods) UnsetCreatedUser() FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - 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 fieldseekerFieldscoutinglogMods) RandomCreatedUser(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerFieldscoutinglogMods) CreatedDate(val null.Val[time.Time]) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerFieldscoutinglogMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerFieldscoutinglogMods) UnsetCreatedDate() FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - 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 fieldseekerFieldscoutinglogMods) RandomCreatedDate(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.CreatedDate = 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 fieldseekerFieldscoutinglogMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.CreatedDate = 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 fieldseekerFieldscoutinglogMods) LastEditedUser(val null.Val[string]) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerFieldscoutinglogMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerFieldscoutinglogMods) UnsetLastEditedUser() FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - 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 fieldseekerFieldscoutinglogMods) RandomLastEditedUser(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerFieldscoutinglogMods) LastEditedDate(val null.Val[time.Time]) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerFieldscoutinglogMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerFieldscoutinglogMods) UnsetLastEditedDate() FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - 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 fieldseekerFieldscoutinglogMods) RandomLastEditedDate(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.LastEditedDate = 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 fieldseekerFieldscoutinglogMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.LastEditedDate = 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 fieldseekerFieldscoutinglogMods) Creationdate(val null.Val[time.Time]) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerFieldscoutinglogMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerFieldscoutinglogMods) UnsetCreationdate() FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - 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 fieldseekerFieldscoutinglogMods) RandomCreationdate(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Creationdate = 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 fieldseekerFieldscoutinglogMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Creationdate = 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 fieldseekerFieldscoutinglogMods) Creator(val null.Val[string]) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerFieldscoutinglogMods) CreatorFunc(f func() null.Val[string]) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerFieldscoutinglogMods) UnsetCreator() FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - 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 fieldseekerFieldscoutinglogMods) RandomCreator(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerFieldscoutinglogMods) Editdate(val null.Val[time.Time]) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerFieldscoutinglogMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerFieldscoutinglogMods) UnsetEditdate() FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - 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 fieldseekerFieldscoutinglogMods) RandomEditdate(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Editdate = 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 fieldseekerFieldscoutinglogMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Editdate = 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 fieldseekerFieldscoutinglogMods) Editor(val null.Val[string]) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerFieldscoutinglogMods) EditorFunc(f func() null.Val[string]) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerFieldscoutinglogMods) UnsetEditor() FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - 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 fieldseekerFieldscoutinglogMods) RandomEditor(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerFieldscoutinglogMods) VersionFunc(f func() int32) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerFieldscoutinglogMods) UnsetVersion() FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - 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 fieldseekerFieldscoutinglogMods) RandomVersion(f *faker.Faker) FieldseekerFieldscoutinglogMod { - return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index 7081f663..00000000 --- a/db/factory/fieldseeker.habitatrelate.bob.go +++ /dev/null @@ -1,1185 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerHabitatrelateMod interface { - Apply(context.Context, *FieldseekerHabitatrelateTemplate) -} - -type FieldseekerHabitatrelateModFunc func(context.Context, *FieldseekerHabitatrelateTemplate) - -func (f FieldseekerHabitatrelateModFunc) Apply(ctx context.Context, n *FieldseekerHabitatrelateTemplate) { - f(ctx, n) -} - -type FieldseekerHabitatrelateModSlice []FieldseekerHabitatrelateMod - -func (mods FieldseekerHabitatrelateModSlice) Apply(ctx context.Context, n *FieldseekerHabitatrelateTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerHabitatrelateTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerHabitatrelateTemplate struct { - Objectid func() int64 - ForeignID func() null.Val[uuid.UUID] - Globalid func() uuid.UUID - CreatedUser func() null.Val[string] - CreatedDate func() null.Val[time.Time] - LastEditedUser func() null.Val[string] - LastEditedDate func() null.Val[time.Time] - 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerHabitatrelateTemplate) BuildSetter() *models.FieldseekerHabitatrelateSetter { - m := &models.FieldseekerHabitatrelateSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(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.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.Habitattype != nil { - val := o.Habitattype() - m.Habitattype = 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.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 -} - -// BuildManySetter returns an []*models.FieldseekerHabitatrelateSetter -// this does nothing with the relationship templates -func (o FieldseekerHabitatrelateTemplate) BuildManySetter(number int) []*models.FieldseekerHabitatrelateSetter { - m := make([]*models.FieldseekerHabitatrelateSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerHabitatrelate -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerHabitatrelateTemplate.Create -func (o FieldseekerHabitatrelateTemplate) Build() *models.FieldseekerHabitatrelate { - m := &models.FieldseekerHabitatrelate{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.ForeignID != nil { - m.ForeignID = o.ForeignID() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.Habitattype != nil { - m.Habitattype = o.Habitattype() - } - 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.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) - - return m -} - -// BuildMany returns an models.FieldseekerHabitatrelateSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerHabitatrelateTemplate.CreateMany -func (o FieldseekerHabitatrelateTemplate) BuildMany(number int) models.FieldseekerHabitatrelateSlice { - m := make(models.FieldseekerHabitatrelateSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerHabitatrelate(m *models.FieldseekerHabitatrelateSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerHabitatrelateTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerHabitatrelate) error { - var err error - - return err -} - -// Create builds a fieldseekerHabitatrelate and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerHabitatrelateTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerHabitatrelate, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerHabitatrelate and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerHabitatrelateTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerHabitatrelate { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerHabitatrelate 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 *FieldseekerHabitatrelateTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerHabitatrelate { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerHabitatrelates and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerHabitatrelateTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerHabitatrelateSlice, error) { - var err error - m := make(models.FieldseekerHabitatrelateSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerHabitatrelates and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerHabitatrelateTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerHabitatrelateSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerHabitatrelates 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 FieldseekerHabitatrelateTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerHabitatrelateSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerHabitatrelate has methods that act as mods for the FieldseekerHabitatrelateTemplate -var FieldseekerHabitatrelateMods fieldseekerHabitatrelateMods - -type fieldseekerHabitatrelateMods struct{} - -func (m fieldseekerHabitatrelateMods) RandomizeAllColumns(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModSlice{ - FieldseekerHabitatrelateMods.RandomObjectid(f), - FieldseekerHabitatrelateMods.RandomForeignID(f), - FieldseekerHabitatrelateMods.RandomGlobalid(f), - FieldseekerHabitatrelateMods.RandomCreatedUser(f), - FieldseekerHabitatrelateMods.RandomCreatedDate(f), - FieldseekerHabitatrelateMods.RandomLastEditedUser(f), - FieldseekerHabitatrelateMods.RandomLastEditedDate(f), - FieldseekerHabitatrelateMods.RandomHabitattype(f), - FieldseekerHabitatrelateMods.RandomCreationdate(f), - FieldseekerHabitatrelateMods.RandomCreator(f), - FieldseekerHabitatrelateMods.RandomEditdate(f), - FieldseekerHabitatrelateMods.RandomEditor(f), - FieldseekerHabitatrelateMods.RandomGeometry(f), - FieldseekerHabitatrelateMods.RandomGeospatial(f), - FieldseekerHabitatrelateMods.RandomVersion(f), - FieldseekerHabitatrelateMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerHabitatrelateMods) Objectid(val int64) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerHabitatrelateMods) ObjectidFunc(f func() int64) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerHabitatrelateMods) UnsetObjectid() FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - 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 fieldseekerHabitatrelateMods) RandomObjectid(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerHabitatrelateMods) ForeignID(val null.Val[uuid.UUID]) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.ForeignID = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerHabitatrelateMods) ForeignIDFunc(f func() null.Val[uuid.UUID]) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.ForeignID = f - }) -} - -// Clear any values for the column -func (m fieldseekerHabitatrelateMods) UnsetForeignID() FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - 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 fieldseekerHabitatrelateMods) RandomForeignID(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.ForeignID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomForeignIDNotNull(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.ForeignID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerHabitatrelateMods) Globalid(val uuid.UUID) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerHabitatrelateMods) GlobalidFunc(f func() uuid.UUID) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerHabitatrelateMods) UnsetGlobalid() FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - 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 fieldseekerHabitatrelateMods) RandomGlobalid(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerHabitatrelateMods) CreatedUser(val null.Val[string]) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerHabitatrelateMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerHabitatrelateMods) UnsetCreatedUser() FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - 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 fieldseekerHabitatrelateMods) RandomCreatedUser(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerHabitatrelateMods) CreatedDate(val null.Val[time.Time]) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerHabitatrelateMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerHabitatrelateMods) UnsetCreatedDate() FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - 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 fieldseekerHabitatrelateMods) RandomCreatedDate(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.CreatedDate = 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 fieldseekerHabitatrelateMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.CreatedDate = 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 fieldseekerHabitatrelateMods) LastEditedUser(val null.Val[string]) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerHabitatrelateMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerHabitatrelateMods) UnsetLastEditedUser() FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - 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 fieldseekerHabitatrelateMods) RandomLastEditedUser(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerHabitatrelateMods) LastEditedDate(val null.Val[time.Time]) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerHabitatrelateMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerHabitatrelateMods) UnsetLastEditedDate() FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - 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 fieldseekerHabitatrelateMods) RandomLastEditedDate(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.LastEditedDate = 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 fieldseekerHabitatrelateMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.LastEditedDate = 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 fieldseekerHabitatrelateMods) Habitattype(val null.Val[string]) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Habitattype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerHabitatrelateMods) HabitattypeFunc(f func() null.Val[string]) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Habitattype = f - }) -} - -// Clear any values for the column -func (m fieldseekerHabitatrelateMods) UnsetHabitattype() FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - 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 fieldseekerHabitatrelateMods) RandomHabitattype(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Habitattype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomHabitattypeNotNull(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Habitattype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerHabitatrelateMods) Creationdate(val null.Val[time.Time]) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerHabitatrelateMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerHabitatrelateMods) UnsetCreationdate() FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - 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 fieldseekerHabitatrelateMods) RandomCreationdate(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Creationdate = 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 fieldseekerHabitatrelateMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Creationdate = 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 fieldseekerHabitatrelateMods) Creator(val null.Val[string]) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerHabitatrelateMods) CreatorFunc(f func() null.Val[string]) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerHabitatrelateMods) UnsetCreator() FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - 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 fieldseekerHabitatrelateMods) RandomCreator(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerHabitatrelateMods) Editdate(val null.Val[time.Time]) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerHabitatrelateMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerHabitatrelateMods) UnsetEditdate() FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - 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 fieldseekerHabitatrelateMods) RandomEditdate(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Editdate = 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 fieldseekerHabitatrelateMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Editdate = 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 fieldseekerHabitatrelateMods) Editor(val null.Val[string]) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerHabitatrelateMods) EditorFunc(f func() null.Val[string]) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerHabitatrelateMods) UnsetEditor() FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - 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 fieldseekerHabitatrelateMods) RandomEditor(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerHabitatrelateMods) VersionFunc(f func() int32) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerHabitatrelateMods) UnsetVersion() FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - 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 fieldseekerHabitatrelateMods) RandomVersion(f *faker.Faker) FieldseekerHabitatrelateMod { - return FieldseekerHabitatrelateModFunc(func(_ context.Context, o *FieldseekerHabitatrelateTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index a735a71d..00000000 --- a/db/factory/fieldseeker.inspectionsample.bob.go +++ /dev/null @@ -1,1309 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerInspectionsampleMod interface { - Apply(context.Context, *FieldseekerInspectionsampleTemplate) -} - -type FieldseekerInspectionsampleModFunc func(context.Context, *FieldseekerInspectionsampleTemplate) - -func (f FieldseekerInspectionsampleModFunc) Apply(ctx context.Context, n *FieldseekerInspectionsampleTemplate) { - f(ctx, n) -} - -type FieldseekerInspectionsampleModSlice []FieldseekerInspectionsampleMod - -func (mods FieldseekerInspectionsampleModSlice) Apply(ctx context.Context, n *FieldseekerInspectionsampleTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerInspectionsampleTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerInspectionsampleTemplate struct { - Objectid func() int64 - InspID func() null.Val[uuid.UUID] - Sampleid func() null.Val[string] - Processed func() null.Val[int16] - Idbytech func() null.Val[string] - Globalid func() uuid.UUID - CreatedUser func() null.Val[string] - CreatedDate func() null.Val[time.Time] - LastEditedUser func() null.Val[string] - LastEditedDate func() null.Val[time.Time] - 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 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerInspectionsampleTemplate) BuildSetter() *models.FieldseekerInspectionsampleSetter { - m := &models.FieldseekerInspectionsampleSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.InspID != nil { - val := o.InspID() - m.InspID = omitnull.FromNull(val) - } - if o.Sampleid != nil { - val := o.Sampleid() - m.Sampleid = omitnull.FromNull(val) - } - if o.Processed != nil { - val := o.Processed() - m.Processed = omitnull.FromNull(val) - } - if o.Idbytech != nil { - val := o.Idbytech() - m.Idbytech = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = 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.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 -} - -// BuildManySetter returns an []*models.FieldseekerInspectionsampleSetter -// this does nothing with the relationship templates -func (o FieldseekerInspectionsampleTemplate) BuildManySetter(number int) []*models.FieldseekerInspectionsampleSetter { - m := make([]*models.FieldseekerInspectionsampleSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerInspectionsample -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerInspectionsampleTemplate.Create -func (o FieldseekerInspectionsampleTemplate) Build() *models.FieldseekerInspectionsample { - m := &models.FieldseekerInspectionsample{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.InspID != nil { - m.InspID = o.InspID() - } - if o.Sampleid != nil { - m.Sampleid = o.Sampleid() - } - if o.Processed != nil { - m.Processed = o.Processed() - } - if o.Idbytech != nil { - m.Idbytech = o.Idbytech() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - 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.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) - - return m -} - -// BuildMany returns an models.FieldseekerInspectionsampleSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerInspectionsampleTemplate.CreateMany -func (o FieldseekerInspectionsampleTemplate) BuildMany(number int) models.FieldseekerInspectionsampleSlice { - m := make(models.FieldseekerInspectionsampleSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerInspectionsample(m *models.FieldseekerInspectionsampleSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerInspectionsampleTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerInspectionsample) error { - var err error - - return err -} - -// Create builds a fieldseekerInspectionsample and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerInspectionsampleTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerInspectionsample, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerInspectionsample and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerInspectionsampleTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerInspectionsample { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerInspectionsample 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 *FieldseekerInspectionsampleTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerInspectionsample { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerInspectionsamples and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerInspectionsampleTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerInspectionsampleSlice, error) { - var err error - m := make(models.FieldseekerInspectionsampleSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerInspectionsamples and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerInspectionsampleTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerInspectionsampleSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerInspectionsamples 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 FieldseekerInspectionsampleTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerInspectionsampleSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerInspectionsample has methods that act as mods for the FieldseekerInspectionsampleTemplate -var FieldseekerInspectionsampleMods fieldseekerInspectionsampleMods - -type fieldseekerInspectionsampleMods struct{} - -func (m fieldseekerInspectionsampleMods) RandomizeAllColumns(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModSlice{ - FieldseekerInspectionsampleMods.RandomObjectid(f), - FieldseekerInspectionsampleMods.RandomInspID(f), - FieldseekerInspectionsampleMods.RandomSampleid(f), - FieldseekerInspectionsampleMods.RandomProcessed(f), - FieldseekerInspectionsampleMods.RandomIdbytech(f), - FieldseekerInspectionsampleMods.RandomGlobalid(f), - FieldseekerInspectionsampleMods.RandomCreatedUser(f), - FieldseekerInspectionsampleMods.RandomCreatedDate(f), - FieldseekerInspectionsampleMods.RandomLastEditedUser(f), - FieldseekerInspectionsampleMods.RandomLastEditedDate(f), - FieldseekerInspectionsampleMods.RandomCreationdate(f), - FieldseekerInspectionsampleMods.RandomCreator(f), - FieldseekerInspectionsampleMods.RandomEditdate(f), - FieldseekerInspectionsampleMods.RandomEditor(f), - FieldseekerInspectionsampleMods.RandomGeometry(f), - FieldseekerInspectionsampleMods.RandomGeospatial(f), - FieldseekerInspectionsampleMods.RandomVersion(f), - FieldseekerInspectionsampleMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampleMods) Objectid(val int64) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampleMods) ObjectidFunc(f func() int64) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampleMods) UnsetObjectid() FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - 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 fieldseekerInspectionsampleMods) RandomObjectid(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampleMods) InspID(val null.Val[uuid.UUID]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.InspID = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampleMods) InspIDFunc(f func() null.Val[uuid.UUID]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.InspID = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampleMods) UnsetInspID() FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - 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 fieldseekerInspectionsampleMods) RandomInspID(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.InspID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomInspIDNotNull(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.InspID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampleMods) Sampleid(val null.Val[string]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Sampleid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampleMods) SampleidFunc(f func() null.Val[string]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Sampleid = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampleMods) UnsetSampleid() FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - 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 fieldseekerInspectionsampleMods) RandomSampleid(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Sampleid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSampleidNotNull(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Sampleid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampleMods) Processed(val null.Val[int16]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Processed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampleMods) ProcessedFunc(f func() null.Val[int16]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Processed = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampleMods) UnsetProcessed() FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - 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 fieldseekerInspectionsampleMods) RandomProcessed(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - 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 fieldseekerInspectionsampleMods) RandomProcessedNotNull(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - 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 fieldseekerInspectionsampleMods) Idbytech(val null.Val[string]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Idbytech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampleMods) IdbytechFunc(f func() null.Val[string]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Idbytech = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampleMods) UnsetIdbytech() FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - 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 fieldseekerInspectionsampleMods) RandomIdbytech(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Idbytech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomIdbytechNotNull(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Idbytech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampleMods) Globalid(val uuid.UUID) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampleMods) GlobalidFunc(f func() uuid.UUID) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampleMods) UnsetGlobalid() FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - 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 fieldseekerInspectionsampleMods) RandomGlobalid(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampleMods) CreatedUser(val null.Val[string]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampleMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampleMods) UnsetCreatedUser() FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - 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 fieldseekerInspectionsampleMods) RandomCreatedUser(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampleMods) CreatedDate(val null.Val[time.Time]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampleMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampleMods) UnsetCreatedDate() FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - 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 fieldseekerInspectionsampleMods) RandomCreatedDate(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.CreatedDate = 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 fieldseekerInspectionsampleMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.CreatedDate = 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 fieldseekerInspectionsampleMods) LastEditedUser(val null.Val[string]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampleMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampleMods) UnsetLastEditedUser() FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - 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 fieldseekerInspectionsampleMods) RandomLastEditedUser(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampleMods) LastEditedDate(val null.Val[time.Time]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampleMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampleMods) UnsetLastEditedDate() FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - 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 fieldseekerInspectionsampleMods) RandomLastEditedDate(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.LastEditedDate = 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 fieldseekerInspectionsampleMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.LastEditedDate = 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 fieldseekerInspectionsampleMods) Creationdate(val null.Val[time.Time]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampleMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampleMods) UnsetCreationdate() FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - 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 fieldseekerInspectionsampleMods) RandomCreationdate(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Creationdate = 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 fieldseekerInspectionsampleMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Creationdate = 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 fieldseekerInspectionsampleMods) Creator(val null.Val[string]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampleMods) CreatorFunc(f func() null.Val[string]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampleMods) UnsetCreator() FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - 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 fieldseekerInspectionsampleMods) RandomCreator(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampleMods) Editdate(val null.Val[time.Time]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampleMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampleMods) UnsetEditdate() FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - 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 fieldseekerInspectionsampleMods) RandomEditdate(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Editdate = 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 fieldseekerInspectionsampleMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Editdate = 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 fieldseekerInspectionsampleMods) Editor(val null.Val[string]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampleMods) EditorFunc(f func() null.Val[string]) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampleMods) UnsetEditor() FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - 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 fieldseekerInspectionsampleMods) RandomEditor(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampleMods) VersionFunc(f func() int32) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampleMods) UnsetVersion() FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - 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 fieldseekerInspectionsampleMods) RandomVersion(f *faker.Faker) FieldseekerInspectionsampleMod { - return FieldseekerInspectionsampleModFunc(func(_ context.Context, o *FieldseekerInspectionsampleTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index 827b0942..00000000 --- a/db/factory/fieldseeker.inspectionsampledetail.bob.go +++ /dev/null @@ -1,1991 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerInspectionsampledetailMod interface { - Apply(context.Context, *FieldseekerInspectionsampledetailTemplate) -} - -type FieldseekerInspectionsampledetailModFunc func(context.Context, *FieldseekerInspectionsampledetailTemplate) - -func (f FieldseekerInspectionsampledetailModFunc) Apply(ctx context.Context, n *FieldseekerInspectionsampledetailTemplate) { - f(ctx, n) -} - -type FieldseekerInspectionsampledetailModSlice []FieldseekerInspectionsampledetailMod - -func (mods FieldseekerInspectionsampledetailModSlice) Apply(ctx context.Context, n *FieldseekerInspectionsampledetailTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerInspectionsampledetailTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerInspectionsampledetailTemplate struct { - Objectid func() int64 - InspsampleID func() null.Val[uuid.UUID] - 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[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[string] - Comments func() null.Val[string] - Globalid func() uuid.UUID - CreatedUser func() null.Val[string] - CreatedDate func() null.Val[time.Time] - LastEditedUser func() null.Val[string] - LastEditedDate func() null.Val[time.Time] - Processed 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] - 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 { - mod.Apply(ctx, o) - } -} - -// 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 -// this does nothing with the relationship templates -func (o FieldseekerInspectionsampledetailTemplate) BuildSetter() *models.FieldseekerInspectionsampledetailSetter { - m := &models.FieldseekerInspectionsampledetailSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.InspsampleID != nil { - val := o.InspsampleID() - m.InspsampleID = 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.Fpupcount != nil { - val := o.Fpupcount() - m.Fpupcount = omitnull.FromNull(val) - } - if o.Feggcount != nil { - val := o.Feggcount() - m.Feggcount = omitnull.FromNull(val) - } - if o.Flstages != nil { - val := o.Flstages() - m.Flstages = omitnull.FromNull(val) - } - if o.Fdomstage != nil { - val := o.Fdomstage() - m.Fdomstage = omitnull.FromNull(val) - } - if o.Fadultact != nil { - val := o.Fadultact() - m.Fadultact = omitnull.FromNull(val) - } - if o.Labspecies != nil { - val := o.Labspecies() - m.Labspecies = 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.Leggcount != nil { - val := o.Leggcount() - m.Leggcount = omitnull.FromNull(val) - } - if o.Ldomstage != nil { - val := o.Ldomstage() - m.Ldomstage = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.Processed != nil { - val := o.Processed() - m.Processed = 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.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 -} - -// BuildManySetter returns an []*models.FieldseekerInspectionsampledetailSetter -// this does nothing with the relationship templates -func (o FieldseekerInspectionsampledetailTemplate) BuildManySetter(number int) []*models.FieldseekerInspectionsampledetailSetter { - m := make([]*models.FieldseekerInspectionsampledetailSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerInspectionsampledetail -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerInspectionsampledetailTemplate.Create -func (o FieldseekerInspectionsampledetailTemplate) Build() *models.FieldseekerInspectionsampledetail { - m := &models.FieldseekerInspectionsampledetail{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.InspsampleID != nil { - m.InspsampleID = o.InspsampleID() - } - if o.Fieldspecies != nil { - m.Fieldspecies = o.Fieldspecies() - } - if o.Flarvcount != nil { - m.Flarvcount = o.Flarvcount() - } - if o.Fpupcount != nil { - m.Fpupcount = o.Fpupcount() - } - if o.Feggcount != nil { - m.Feggcount = o.Feggcount() - } - if o.Flstages != nil { - m.Flstages = o.Flstages() - } - if o.Fdomstage != nil { - m.Fdomstage = o.Fdomstage() - } - if o.Fadultact != nil { - m.Fadultact = o.Fadultact() - } - if o.Labspecies != nil { - m.Labspecies = o.Labspecies() - } - if o.Llarvcount != nil { - m.Llarvcount = o.Llarvcount() - } - if o.Lpupcount != nil { - m.Lpupcount = o.Lpupcount() - } - if o.Leggcount != nil { - m.Leggcount = o.Leggcount() - } - if o.Ldomstage != nil { - m.Ldomstage = o.Ldomstage() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.Processed != nil { - m.Processed = o.Processed() - } - 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.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) - - return m -} - -// BuildMany returns an models.FieldseekerInspectionsampledetailSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerInspectionsampledetailTemplate.CreateMany -func (o FieldseekerInspectionsampledetailTemplate) BuildMany(number int) models.FieldseekerInspectionsampledetailSlice { - m := make(models.FieldseekerInspectionsampledetailSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerInspectionsampledetail(m *models.FieldseekerInspectionsampledetailSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerInspectionsampledetailTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerInspectionsampledetail) error { - var err error - - return err -} - -// Create builds a fieldseekerInspectionsampledetail and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerInspectionsampledetailTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerInspectionsampledetail, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerInspectionsampledetail and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerInspectionsampledetailTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerInspectionsampledetail { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerInspectionsampledetail 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 *FieldseekerInspectionsampledetailTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerInspectionsampledetail { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerInspectionsampledetails and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerInspectionsampledetailTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerInspectionsampledetailSlice, error) { - var err error - m := make(models.FieldseekerInspectionsampledetailSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerInspectionsampledetails and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerInspectionsampledetailTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerInspectionsampledetailSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerInspectionsampledetails 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 FieldseekerInspectionsampledetailTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerInspectionsampledetailSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerInspectionsampledetail has methods that act as mods for the FieldseekerInspectionsampledetailTemplate -var FieldseekerInspectionsampledetailMods fieldseekerInspectionsampledetailMods - -type fieldseekerInspectionsampledetailMods struct{} - -func (m fieldseekerInspectionsampledetailMods) RandomizeAllColumns(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModSlice{ - FieldseekerInspectionsampledetailMods.RandomObjectid(f), - FieldseekerInspectionsampledetailMods.RandomInspsampleID(f), - FieldseekerInspectionsampledetailMods.RandomFieldspecies(f), - FieldseekerInspectionsampledetailMods.RandomFlarvcount(f), - FieldseekerInspectionsampledetailMods.RandomFpupcount(f), - FieldseekerInspectionsampledetailMods.RandomFeggcount(f), - FieldseekerInspectionsampledetailMods.RandomFlstages(f), - FieldseekerInspectionsampledetailMods.RandomFdomstage(f), - FieldseekerInspectionsampledetailMods.RandomFadultact(f), - FieldseekerInspectionsampledetailMods.RandomLabspecies(f), - FieldseekerInspectionsampledetailMods.RandomLlarvcount(f), - FieldseekerInspectionsampledetailMods.RandomLpupcount(f), - FieldseekerInspectionsampledetailMods.RandomLeggcount(f), - FieldseekerInspectionsampledetailMods.RandomLdomstage(f), - FieldseekerInspectionsampledetailMods.RandomComments(f), - FieldseekerInspectionsampledetailMods.RandomGlobalid(f), - FieldseekerInspectionsampledetailMods.RandomCreatedUser(f), - FieldseekerInspectionsampledetailMods.RandomCreatedDate(f), - FieldseekerInspectionsampledetailMods.RandomLastEditedUser(f), - FieldseekerInspectionsampledetailMods.RandomLastEditedDate(f), - FieldseekerInspectionsampledetailMods.RandomProcessed(f), - FieldseekerInspectionsampledetailMods.RandomCreationdate(f), - FieldseekerInspectionsampledetailMods.RandomCreator(f), - FieldseekerInspectionsampledetailMods.RandomEditdate(f), - FieldseekerInspectionsampledetailMods.RandomEditor(f), - FieldseekerInspectionsampledetailMods.RandomGeometry(f), - FieldseekerInspectionsampledetailMods.RandomGeospatial(f), - FieldseekerInspectionsampledetailMods.RandomVersion(f), - FieldseekerInspectionsampledetailMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampledetailMods) Objectid(val int64) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) ObjectidFunc(f func() int64) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetObjectid() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomObjectid(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampledetailMods) InspsampleID(val null.Val[uuid.UUID]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.InspsampleID = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) InspsampleIDFunc(f func() null.Val[uuid.UUID]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.InspsampleID = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetInspsampleID() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomInspsampleID(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.InspsampleID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomInspsampleIDNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.InspsampleID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampledetailMods) Fieldspecies(val null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fieldspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) FieldspeciesFunc(f func() null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fieldspecies = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetFieldspecies() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomFieldspecies(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fieldspecies = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomFieldspeciesNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fieldspecies = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampledetailMods) Flarvcount(val null.Val[int16]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Flarvcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) FlarvcountFunc(f func() null.Val[int16]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Flarvcount = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetFlarvcount() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomFlarvcount(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomFlarvcountNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) Fpupcount(val null.Val[int16]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fpupcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) FpupcountFunc(f func() null.Val[int16]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fpupcount = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetFpupcount() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomFpupcount(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomFpupcountNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) Feggcount(val null.Val[int16]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Feggcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) FeggcountFunc(f func() null.Val[int16]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Feggcount = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetFeggcount() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomFeggcount(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomFeggcountNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) Flstages(val null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Flstages = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) FlstagesFunc(f func() null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Flstages = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetFlstages() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomFlstages(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Flstages = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomFlstagesNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Flstages = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampledetailMods) Fdomstage(val null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fdomstage = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) FdomstageFunc(f func() null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fdomstage = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetFdomstage() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomFdomstage(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fdomstage = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomFdomstageNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fdomstage = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampledetailMods) Fadultact(val null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fadultact = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) FadultactFunc(f func() null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fadultact = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetFadultact() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomFadultact(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fadultact = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomFadultactNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Fadultact = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampledetailMods) Labspecies(val null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Labspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) LabspeciesFunc(f func() null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Labspecies = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetLabspecies() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomLabspecies(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Labspecies = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLabspeciesNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Labspecies = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampledetailMods) Llarvcount(val null.Val[int16]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Llarvcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) LlarvcountFunc(f func() null.Val[int16]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Llarvcount = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetLlarvcount() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomLlarvcount(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomLlarvcountNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) Lpupcount(val null.Val[int16]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Lpupcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) LpupcountFunc(f func() null.Val[int16]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Lpupcount = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetLpupcount() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomLpupcount(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomLpupcountNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) Leggcount(val null.Val[int16]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Leggcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) LeggcountFunc(f func() null.Val[int16]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Leggcount = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetLeggcount() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomLeggcount(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomLeggcountNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) Ldomstage(val null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Ldomstage = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) LdomstageFunc(f func() null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Ldomstage = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetLdomstage() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomLdomstage(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Ldomstage = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLdomstageNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Ldomstage = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampledetailMods) Comments(val null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) CommentsFunc(f func() null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetComments() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomComments(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCommentsNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampledetailMods) Globalid(val uuid.UUID) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) GlobalidFunc(f func() uuid.UUID) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetGlobalid() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomGlobalid(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampledetailMods) CreatedUser(val null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetCreatedUser() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomCreatedUser(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampledetailMods) CreatedDate(val null.Val[time.Time]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetCreatedDate() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomCreatedDate(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.CreatedDate = 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 fieldseekerInspectionsampledetailMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.CreatedDate = 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 fieldseekerInspectionsampledetailMods) LastEditedUser(val null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetLastEditedUser() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomLastEditedUser(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampledetailMods) LastEditedDate(val null.Val[time.Time]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetLastEditedDate() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomLastEditedDate(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.LastEditedDate = 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 fieldseekerInspectionsampledetailMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.LastEditedDate = 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 fieldseekerInspectionsampledetailMods) Processed(val null.Val[int16]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Processed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) ProcessedFunc(f func() null.Val[int16]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Processed = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetProcessed() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomProcessed(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomProcessedNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) Creationdate(val null.Val[time.Time]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetCreationdate() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomCreationdate(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Creationdate = 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 fieldseekerInspectionsampledetailMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Creationdate = 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 fieldseekerInspectionsampledetailMods) Creator(val null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) CreatorFunc(f func() null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetCreator() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomCreator(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerInspectionsampledetailMods) Editdate(val null.Val[time.Time]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetEditdate() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomEditdate(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Editdate = 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 fieldseekerInspectionsampledetailMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Editdate = 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 fieldseekerInspectionsampledetailMods) Editor(val null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) EditorFunc(f func() null.Val[string]) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetEditor() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomEditor(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerInspectionsampledetailMods) VersionFunc(f func() int32) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerInspectionsampledetailMods) UnsetVersion() FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - 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 fieldseekerInspectionsampledetailMods) RandomVersion(f *faker.Faker) FieldseekerInspectionsampledetailMod { - return FieldseekerInspectionsampledetailModFunc(func(_ context.Context, o *FieldseekerInspectionsampledetailTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index cf5b71c9..00000000 --- a/db/factory/fieldseeker.linelocation.bob.go +++ /dev/null @@ -1,3417 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerLinelocationMod interface { - Apply(context.Context, *FieldseekerLinelocationTemplate) -} - -type FieldseekerLinelocationModFunc func(context.Context, *FieldseekerLinelocationTemplate) - -func (f FieldseekerLinelocationModFunc) Apply(ctx context.Context, n *FieldseekerLinelocationTemplate) { - f(ctx, n) -} - -type FieldseekerLinelocationModSlice []FieldseekerLinelocationMod - -func (mods FieldseekerLinelocationModSlice) Apply(ctx context.Context, n *FieldseekerLinelocationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerLinelocationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerLinelocationTemplate struct { - Objectid func() int64 - Name func() null.Val[string] - Zone func() null.Val[string] - 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[string] - Externalid func() null.Val[string] - Acres func() null.Val[float64] - Nextactiondatescheduled func() null.Val[time.Time] - Larvinspectinterval func() null.Val[int16] - LengthFT func() null.Val[float64] - WidthFT func() null.Val[float64] - Zone2 func() null.Val[string] - Locationnumber func() null.Val[int32] - Globalid func() uuid.UUID - CreatedUser func() null.Val[string] - CreatedDate func() null.Val[time.Time] - LastEditedUser func() null.Val[string] - LastEditedDate func() null.Val[time.Time] - Lastinspectdate func() null.Val[time.Time] - Lastinspectbreeding func() null.Val[string] - Lastinspectavglarvae func() null.Val[float64] - Lastinspectavgpupae func() null.Val[float64] - Lastinspectlstages func() null.Val[string] - Lastinspectactiontaken func() null.Val[string] - Lastinspectfieldspecies func() null.Val[string] - Lasttreatdate func() null.Val[time.Time] - Lasttreatproduct func() null.Val[string] - Lasttreatqty func() null.Val[float64] - Lasttreatqtyunit func() null.Val[string] - Hectares func() null.Val[float64] - Lastinspectactivity func() null.Val[string] - Lasttreatactivity func() null.Val[string] - LengthMeters func() null.Val[float64] - WidthMeters func() null.Val[float64] - Lastinspectconditions func() null.Val[string] - 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerLinelocationTemplate) BuildSetter() *models.FieldseekerLinelocationSetter { - m := &models.FieldseekerLinelocationSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Habitat != nil { - val := o.Habitat() - m.Habitat = omitnull.FromNull(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.Active != nil { - val := o.Active() - m.Active = omitnull.FromNull(val) - } - if o.Description != nil { - val := o.Description() - m.Description = omitnull.FromNull(val) - } - if o.Accessdesc != nil { - val := o.Accessdesc() - m.Accessdesc = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Symbology != nil { - val := o.Symbology() - m.Symbology = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Acres != nil { - val := o.Acres() - m.Acres = omitnull.FromNull(val) - } - if o.Nextactiondatescheduled != nil { - val := o.Nextactiondatescheduled() - m.Nextactiondatescheduled = omitnull.FromNull(val) - } - if o.Larvinspectinterval != nil { - val := o.Larvinspectinterval() - m.Larvinspectinterval = omitnull.FromNull(val) - } - if o.LengthFT != nil { - val := o.LengthFT() - m.LengthFT = omitnull.FromNull(val) - } - if o.WidthFT != nil { - val := o.WidthFT() - m.WidthFT = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.Locationnumber != nil { - val := o.Locationnumber() - m.Locationnumber = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.Lastinspectdate != nil { - val := o.Lastinspectdate() - m.Lastinspectdate = omitnull.FromNull(val) - } - if o.Lastinspectbreeding != nil { - val := o.Lastinspectbreeding() - m.Lastinspectbreeding = 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.Lastinspectlstages != nil { - val := o.Lastinspectlstages() - m.Lastinspectlstages = omitnull.FromNull(val) - } - if o.Lastinspectactiontaken != nil { - val := o.Lastinspectactiontaken() - m.Lastinspectactiontaken = omitnull.FromNull(val) - } - if o.Lastinspectfieldspecies != nil { - val := o.Lastinspectfieldspecies() - m.Lastinspectfieldspecies = 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.Hectares != nil { - val := o.Hectares() - m.Hectares = omitnull.FromNull(val) - } - if o.Lastinspectactivity != nil { - val := o.Lastinspectactivity() - m.Lastinspectactivity = omitnull.FromNull(val) - } - if o.Lasttreatactivity != nil { - val := o.Lasttreatactivity() - m.Lasttreatactivity = omitnull.FromNull(val) - } - if o.LengthMeters != nil { - val := o.LengthMeters() - m.LengthMeters = omitnull.FromNull(val) - } - if o.WidthMeters != nil { - val := o.WidthMeters() - m.WidthMeters = omitnull.FromNull(val) - } - if o.Lastinspectconditions != nil { - val := o.Lastinspectconditions() - m.Lastinspectconditions = omitnull.FromNull(val) - } - if o.Waterorigin != nil { - val := o.Waterorigin() - m.Waterorigin = 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.Jurisdiction != nil { - val := o.Jurisdiction() - m.Jurisdiction = omitnull.FromNull(val) - } - if o.ShapeLength != nil { - 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 -} - -// BuildManySetter returns an []*models.FieldseekerLinelocationSetter -// this does nothing with the relationship templates -func (o FieldseekerLinelocationTemplate) BuildManySetter(number int) []*models.FieldseekerLinelocationSetter { - m := make([]*models.FieldseekerLinelocationSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerLinelocation -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerLinelocationTemplate.Create -func (o FieldseekerLinelocationTemplate) Build() *models.FieldseekerLinelocation { - m := &models.FieldseekerLinelocation{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Habitat != nil { - m.Habitat = o.Habitat() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Usetype != nil { - m.Usetype = o.Usetype() - } - if o.Active != nil { - m.Active = o.Active() - } - if o.Description != nil { - m.Description = o.Description() - } - if o.Accessdesc != nil { - m.Accessdesc = o.Accessdesc() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Symbology != nil { - m.Symbology = o.Symbology() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Acres != nil { - m.Acres = o.Acres() - } - if o.Nextactiondatescheduled != nil { - m.Nextactiondatescheduled = o.Nextactiondatescheduled() - } - if o.Larvinspectinterval != nil { - m.Larvinspectinterval = o.Larvinspectinterval() - } - if o.LengthFT != nil { - m.LengthFT = o.LengthFT() - } - if o.WidthFT != nil { - m.WidthFT = o.WidthFT() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Locationnumber != nil { - m.Locationnumber = o.Locationnumber() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.Lastinspectdate != nil { - m.Lastinspectdate = o.Lastinspectdate() - } - if o.Lastinspectbreeding != nil { - m.Lastinspectbreeding = o.Lastinspectbreeding() - } - if o.Lastinspectavglarvae != nil { - m.Lastinspectavglarvae = o.Lastinspectavglarvae() - } - if o.Lastinspectavgpupae != nil { - m.Lastinspectavgpupae = o.Lastinspectavgpupae() - } - if o.Lastinspectlstages != nil { - m.Lastinspectlstages = o.Lastinspectlstages() - } - if o.Lastinspectactiontaken != nil { - m.Lastinspectactiontaken = o.Lastinspectactiontaken() - } - if o.Lastinspectfieldspecies != nil { - m.Lastinspectfieldspecies = o.Lastinspectfieldspecies() - } - 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.Hectares != nil { - m.Hectares = o.Hectares() - } - if o.Lastinspectactivity != nil { - m.Lastinspectactivity = o.Lastinspectactivity() - } - if o.Lasttreatactivity != nil { - m.Lasttreatactivity = o.Lasttreatactivity() - } - if o.LengthMeters != nil { - m.LengthMeters = o.LengthMeters() - } - if o.WidthMeters != nil { - m.WidthMeters = o.WidthMeters() - } - if o.Lastinspectconditions != nil { - m.Lastinspectconditions = o.Lastinspectconditions() - } - if o.Waterorigin != nil { - m.Waterorigin = o.Waterorigin() - } - 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.Jurisdiction != nil { - m.Jurisdiction = o.Jurisdiction() - } - 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) - - return m -} - -// BuildMany returns an models.FieldseekerLinelocationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerLinelocationTemplate.CreateMany -func (o FieldseekerLinelocationTemplate) BuildMany(number int) models.FieldseekerLinelocationSlice { - m := make(models.FieldseekerLinelocationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerLinelocation(m *models.FieldseekerLinelocationSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerLinelocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerLinelocation) error { - var err error - - return err -} - -// Create builds a fieldseekerLinelocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerLinelocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerLinelocation, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerLinelocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerLinelocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerLinelocation { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerLinelocation 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 *FieldseekerLinelocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerLinelocation { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerLinelocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerLinelocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerLinelocationSlice, error) { - var err error - m := make(models.FieldseekerLinelocationSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerLinelocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerLinelocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerLinelocationSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerLinelocations 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 FieldseekerLinelocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerLinelocationSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerLinelocation has methods that act as mods for the FieldseekerLinelocationTemplate -var FieldseekerLinelocationMods fieldseekerLinelocationMods - -type fieldseekerLinelocationMods struct{} - -func (m fieldseekerLinelocationMods) RandomizeAllColumns(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModSlice{ - FieldseekerLinelocationMods.RandomObjectid(f), - FieldseekerLinelocationMods.RandomName(f), - FieldseekerLinelocationMods.RandomZone(f), - FieldseekerLinelocationMods.RandomHabitat(f), - FieldseekerLinelocationMods.RandomPriority(f), - FieldseekerLinelocationMods.RandomUsetype(f), - FieldseekerLinelocationMods.RandomActive(f), - FieldseekerLinelocationMods.RandomDescription(f), - FieldseekerLinelocationMods.RandomAccessdesc(f), - FieldseekerLinelocationMods.RandomComments(f), - FieldseekerLinelocationMods.RandomSymbology(f), - FieldseekerLinelocationMods.RandomExternalid(f), - FieldseekerLinelocationMods.RandomAcres(f), - FieldseekerLinelocationMods.RandomNextactiondatescheduled(f), - FieldseekerLinelocationMods.RandomLarvinspectinterval(f), - FieldseekerLinelocationMods.RandomLengthFT(f), - FieldseekerLinelocationMods.RandomWidthFT(f), - FieldseekerLinelocationMods.RandomZone2(f), - FieldseekerLinelocationMods.RandomLocationnumber(f), - FieldseekerLinelocationMods.RandomGlobalid(f), - FieldseekerLinelocationMods.RandomCreatedUser(f), - FieldseekerLinelocationMods.RandomCreatedDate(f), - FieldseekerLinelocationMods.RandomLastEditedUser(f), - FieldseekerLinelocationMods.RandomLastEditedDate(f), - FieldseekerLinelocationMods.RandomLastinspectdate(f), - FieldseekerLinelocationMods.RandomLastinspectbreeding(f), - FieldseekerLinelocationMods.RandomLastinspectavglarvae(f), - FieldseekerLinelocationMods.RandomLastinspectavgpupae(f), - FieldseekerLinelocationMods.RandomLastinspectlstages(f), - FieldseekerLinelocationMods.RandomLastinspectactiontaken(f), - FieldseekerLinelocationMods.RandomLastinspectfieldspecies(f), - FieldseekerLinelocationMods.RandomLasttreatdate(f), - FieldseekerLinelocationMods.RandomLasttreatproduct(f), - FieldseekerLinelocationMods.RandomLasttreatqty(f), - FieldseekerLinelocationMods.RandomLasttreatqtyunit(f), - FieldseekerLinelocationMods.RandomHectares(f), - FieldseekerLinelocationMods.RandomLastinspectactivity(f), - FieldseekerLinelocationMods.RandomLasttreatactivity(f), - FieldseekerLinelocationMods.RandomLengthMeters(f), - FieldseekerLinelocationMods.RandomWidthMeters(f), - FieldseekerLinelocationMods.RandomLastinspectconditions(f), - FieldseekerLinelocationMods.RandomWaterorigin(f), - FieldseekerLinelocationMods.RandomCreationdate(f), - FieldseekerLinelocationMods.RandomCreator(f), - FieldseekerLinelocationMods.RandomEditdate(f), - FieldseekerLinelocationMods.RandomEditor(f), - FieldseekerLinelocationMods.RandomJurisdiction(f), - FieldseekerLinelocationMods.RandomShapeLength(f), - FieldseekerLinelocationMods.RandomGeometry(f), - FieldseekerLinelocationMods.RandomGeospatial(f), - FieldseekerLinelocationMods.RandomVersion(f), - FieldseekerLinelocationMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Objectid(val int64) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) ObjectidFunc(f func() int64) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetObjectid() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomObjectid(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Name(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) NameFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetName() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomName(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Name = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomNameNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Name = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Zone(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) ZoneFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetZone() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomZone(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZoneNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Habitat(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Habitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) HabitatFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Habitat = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetHabitat() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomHabitat(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Habitat = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomHabitatNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Habitat = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Priority(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) PriorityFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetPriority() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomPriority(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Priority = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomPriorityNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Priority = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Usetype(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Usetype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) UsetypeFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Usetype = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetUsetype() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomUsetype(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Usetype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomUsetypeNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Usetype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Active(val null.Val[int16]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Active = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) ActiveFunc(f func() null.Val[int16]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Active = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetActive() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomActive(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomActiveNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) Description(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Description = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) DescriptionFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Description = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetDescription() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomDescription(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Description = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomDescriptionNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Description = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Accessdesc(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Accessdesc = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) AccessdescFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Accessdesc = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetAccessdesc() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomAccessdesc(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Accessdesc = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomAccessdescNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Accessdesc = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Comments(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) CommentsFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetComments() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomComments(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCommentsNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Symbology(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Symbology = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) SymbologyFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Symbology = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetSymbology() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomSymbology(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Symbology = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "10") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSymbologyNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Symbology = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "10") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Externalid(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) ExternalidFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetExternalid() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomExternalid(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Externalid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomExternalidNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Externalid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Acres(val null.Val[float64]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Acres = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) AcresFunc(f func() null.Val[float64]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Acres = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetAcres() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomAcres(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomAcresNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) Nextactiondatescheduled(val null.Val[time.Time]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) NextactiondatescheduledFunc(f func() null.Val[time.Time]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Nextactiondatescheduled = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetNextactiondatescheduled() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomNextactiondatescheduled(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Nextactiondatescheduled = 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 fieldseekerLinelocationMods) RandomNextactiondatescheduledNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Nextactiondatescheduled = 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 fieldseekerLinelocationMods) Larvinspectinterval(val null.Val[int16]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Larvinspectinterval = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) LarvinspectintervalFunc(f func() null.Val[int16]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Larvinspectinterval = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetLarvinspectinterval() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLarvinspectinterval(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLarvinspectintervalNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) LengthFT(val null.Val[float64]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.LengthFT = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) LengthFTFunc(f func() null.Val[float64]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.LengthFT = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetLengthFT() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLengthFT(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLengthFTNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) WidthFT(val null.Val[float64]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.WidthFT = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) WidthFTFunc(f func() null.Val[float64]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.WidthFT = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetWidthFT() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomWidthFT(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomWidthFTNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) Zone2(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) Zone2Func(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetZone2() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomZone2(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZone2NotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Locationnumber(val null.Val[int32]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Locationnumber = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) LocationnumberFunc(f func() null.Val[int32]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Locationnumber = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetLocationnumber() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLocationnumber(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Locationnumber = 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 fieldseekerLinelocationMods) RandomLocationnumberNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Locationnumber = 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 fieldseekerLinelocationMods) Globalid(val uuid.UUID) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) GlobalidFunc(f func() uuid.UUID) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetGlobalid() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomGlobalid(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) CreatedUser(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetCreatedUser() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomCreatedUser(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) CreatedDate(val null.Val[time.Time]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetCreatedDate() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomCreatedDate(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.CreatedDate = 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 fieldseekerLinelocationMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.CreatedDate = 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 fieldseekerLinelocationMods) LastEditedUser(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetLastEditedUser() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLastEditedUser(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) LastEditedDate(val null.Val[time.Time]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetLastEditedDate() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLastEditedDate(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.LastEditedDate = 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 fieldseekerLinelocationMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.LastEditedDate = 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 fieldseekerLinelocationMods) Lastinspectdate(val null.Val[time.Time]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) LastinspectdateFunc(f func() null.Val[time.Time]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetLastinspectdate() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLastinspectdate(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectdate = 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 fieldseekerLinelocationMods) RandomLastinspectdateNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectdate = 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 fieldseekerLinelocationMods) Lastinspectbreeding(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectbreeding = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) LastinspectbreedingFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectbreeding = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetLastinspectbreeding() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLastinspectbreeding(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectbreeding = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectbreedingNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectbreeding = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Lastinspectavglarvae(val null.Val[float64]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectavglarvae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) LastinspectavglarvaeFunc(f func() null.Val[float64]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectavglarvae = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetLastinspectavglarvae() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLastinspectavglarvae(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLastinspectavglarvaeNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) Lastinspectavgpupae(val null.Val[float64]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectavgpupae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) LastinspectavgpupaeFunc(f func() null.Val[float64]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectavgpupae = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetLastinspectavgpupae() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLastinspectavgpupae(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLastinspectavgpupaeNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) Lastinspectlstages(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectlstages = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) LastinspectlstagesFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectlstages = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetLastinspectlstages() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLastinspectlstages(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectlstages = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectlstagesNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectlstages = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Lastinspectactiontaken(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectactiontaken = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) LastinspectactiontakenFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectactiontaken = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetLastinspectactiontaken() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLastinspectactiontaken(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectactiontaken = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectactiontakenNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectactiontaken = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Lastinspectfieldspecies(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectfieldspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) LastinspectfieldspeciesFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectfieldspecies = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetLastinspectfieldspecies() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLastinspectfieldspecies(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectfieldspecies = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectfieldspeciesNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectfieldspecies = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Lasttreatdate(val null.Val[time.Time]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lasttreatdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) LasttreatdateFunc(f func() null.Val[time.Time]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lasttreatdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetLasttreatdate() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLasttreatdate(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lasttreatdate = 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 fieldseekerLinelocationMods) RandomLasttreatdateNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lasttreatdate = 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 fieldseekerLinelocationMods) Lasttreatproduct(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lasttreatproduct = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) LasttreatproductFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lasttreatproduct = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetLasttreatproduct() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLasttreatproduct(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lasttreatproduct = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLasttreatproductNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lasttreatproduct = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Lasttreatqty(val null.Val[float64]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lasttreatqty = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) LasttreatqtyFunc(f func() null.Val[float64]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lasttreatqty = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetLasttreatqty() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLasttreatqty(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLasttreatqtyNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) Lasttreatqtyunit(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lasttreatqtyunit = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) LasttreatqtyunitFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lasttreatqtyunit = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetLasttreatqtyunit() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLasttreatqtyunit(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lasttreatqtyunit = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "10") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLasttreatqtyunitNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lasttreatqtyunit = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "10") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Hectares(val null.Val[float64]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Hectares = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) HectaresFunc(f func() null.Val[float64]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Hectares = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetHectares() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomHectares(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomHectaresNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) Lastinspectactivity(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectactivity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) LastinspectactivityFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectactivity = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetLastinspectactivity() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLastinspectactivity(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectactivity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectactivityNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectactivity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Lasttreatactivity(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lasttreatactivity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) LasttreatactivityFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lasttreatactivity = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetLasttreatactivity() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLasttreatactivity(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lasttreatactivity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLasttreatactivityNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lasttreatactivity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) LengthMeters(val null.Val[float64]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.LengthMeters = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) LengthMetersFunc(f func() null.Val[float64]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.LengthMeters = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetLengthMeters() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLengthMeters(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLengthMetersNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) WidthMeters(val null.Val[float64]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.WidthMeters = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) WidthMetersFunc(f func() null.Val[float64]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.WidthMeters = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetWidthMeters() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomWidthMeters(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomWidthMetersNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) Lastinspectconditions(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectconditions = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) LastinspectconditionsFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectconditions = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetLastinspectconditions() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomLastinspectconditions(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectconditions = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectconditionsNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Lastinspectconditions = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Waterorigin(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Waterorigin = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) WateroriginFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Waterorigin = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetWaterorigin() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomWaterorigin(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Waterorigin = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomWateroriginNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Waterorigin = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Creationdate(val null.Val[time.Time]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetCreationdate() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomCreationdate(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Creationdate = 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 fieldseekerLinelocationMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Creationdate = 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 fieldseekerLinelocationMods) Creator(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) CreatorFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetCreator() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomCreator(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Editdate(val null.Val[time.Time]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetEditdate() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomEditdate(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Editdate = 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 fieldseekerLinelocationMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Editdate = 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 fieldseekerLinelocationMods) Editor(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) EditorFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetEditor() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomEditor(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) Jurisdiction(val null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Jurisdiction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) JurisdictionFunc(f func() null.Val[string]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Jurisdiction = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetJurisdiction() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomJurisdiction(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Jurisdiction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomJurisdictionNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Jurisdiction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLinelocationMods) ShapeLength(val null.Val[float64]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.ShapeLength = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) ShapeLengthFunc(f func() null.Val[float64]) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.ShapeLength = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetShapeLength() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomShapeLength(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomShapeLengthNotNull(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLinelocationMods) VersionFunc(f func() int32) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerLinelocationMods) UnsetVersion() FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - 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 fieldseekerLinelocationMods) RandomVersion(f *faker.Faker) FieldseekerLinelocationMod { - return FieldseekerLinelocationModFunc(func(_ context.Context, o *FieldseekerLinelocationTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index 5cafc232..00000000 --- a/db/factory/fieldseeker.locationtracking.bob.go +++ /dev/null @@ -1,1185 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerLocationtrackingMod interface { - Apply(context.Context, *FieldseekerLocationtrackingTemplate) -} - -type FieldseekerLocationtrackingModFunc func(context.Context, *FieldseekerLocationtrackingTemplate) - -func (f FieldseekerLocationtrackingModFunc) Apply(ctx context.Context, n *FieldseekerLocationtrackingTemplate) { - f(ctx, n) -} - -type FieldseekerLocationtrackingModSlice []FieldseekerLocationtrackingMod - -func (mods FieldseekerLocationtrackingModSlice) Apply(ctx context.Context, n *FieldseekerLocationtrackingTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerLocationtrackingTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerLocationtrackingTemplate struct { - Objectid func() int64 - Accuracy func() null.Val[float64] - CreatedUser func() null.Val[string] - CreatedDate func() null.Val[time.Time] - LastEditedUser func() null.Val[string] - LastEditedDate func() null.Val[time.Time] - Globalid func() uuid.UUID - Fieldtech 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 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerLocationtrackingTemplate) BuildSetter() *models.FieldseekerLocationtrackingSetter { - m := &models.FieldseekerLocationtrackingSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Accuracy != nil { - val := o.Accuracy() - m.Accuracy = omitnull.FromNull(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Fieldtech != nil { - val := o.Fieldtech() - m.Fieldtech = 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.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 -} - -// BuildManySetter returns an []*models.FieldseekerLocationtrackingSetter -// this does nothing with the relationship templates -func (o FieldseekerLocationtrackingTemplate) BuildManySetter(number int) []*models.FieldseekerLocationtrackingSetter { - m := make([]*models.FieldseekerLocationtrackingSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerLocationtracking -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerLocationtrackingTemplate.Create -func (o FieldseekerLocationtrackingTemplate) Build() *models.FieldseekerLocationtracking { - m := &models.FieldseekerLocationtracking{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Accuracy != nil { - m.Accuracy = o.Accuracy() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Fieldtech != nil { - m.Fieldtech = o.Fieldtech() - } - 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.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) - - return m -} - -// BuildMany returns an models.FieldseekerLocationtrackingSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerLocationtrackingTemplate.CreateMany -func (o FieldseekerLocationtrackingTemplate) BuildMany(number int) models.FieldseekerLocationtrackingSlice { - m := make(models.FieldseekerLocationtrackingSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerLocationtracking(m *models.FieldseekerLocationtrackingSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerLocationtrackingTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerLocationtracking) error { - var err error - - return err -} - -// Create builds a fieldseekerLocationtracking and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerLocationtrackingTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerLocationtracking, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerLocationtracking and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerLocationtrackingTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerLocationtracking { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerLocationtracking 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 *FieldseekerLocationtrackingTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerLocationtracking { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerLocationtrackings and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerLocationtrackingTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerLocationtrackingSlice, error) { - var err error - m := make(models.FieldseekerLocationtrackingSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerLocationtrackings and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerLocationtrackingTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerLocationtrackingSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerLocationtrackings 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 FieldseekerLocationtrackingTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerLocationtrackingSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerLocationtracking has methods that act as mods for the FieldseekerLocationtrackingTemplate -var FieldseekerLocationtrackingMods fieldseekerLocationtrackingMods - -type fieldseekerLocationtrackingMods struct{} - -func (m fieldseekerLocationtrackingMods) RandomizeAllColumns(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModSlice{ - FieldseekerLocationtrackingMods.RandomObjectid(f), - FieldseekerLocationtrackingMods.RandomAccuracy(f), - FieldseekerLocationtrackingMods.RandomCreatedUser(f), - FieldseekerLocationtrackingMods.RandomCreatedDate(f), - FieldseekerLocationtrackingMods.RandomLastEditedUser(f), - FieldseekerLocationtrackingMods.RandomLastEditedDate(f), - FieldseekerLocationtrackingMods.RandomGlobalid(f), - FieldseekerLocationtrackingMods.RandomFieldtech(f), - FieldseekerLocationtrackingMods.RandomCreationdate(f), - FieldseekerLocationtrackingMods.RandomCreator(f), - FieldseekerLocationtrackingMods.RandomEditdate(f), - FieldseekerLocationtrackingMods.RandomEditor(f), - FieldseekerLocationtrackingMods.RandomGeometry(f), - FieldseekerLocationtrackingMods.RandomGeospatial(f), - FieldseekerLocationtrackingMods.RandomVersion(f), - FieldseekerLocationtrackingMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerLocationtrackingMods) Objectid(val int64) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLocationtrackingMods) ObjectidFunc(f func() int64) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerLocationtrackingMods) UnsetObjectid() FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - 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 fieldseekerLocationtrackingMods) RandomObjectid(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLocationtrackingMods) Accuracy(val null.Val[float64]) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Accuracy = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLocationtrackingMods) AccuracyFunc(f func() null.Val[float64]) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Accuracy = f - }) -} - -// Clear any values for the column -func (m fieldseekerLocationtrackingMods) UnsetAccuracy() FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - 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 fieldseekerLocationtrackingMods) RandomAccuracy(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - 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 fieldseekerLocationtrackingMods) RandomAccuracyNotNull(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - 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 fieldseekerLocationtrackingMods) CreatedUser(val null.Val[string]) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLocationtrackingMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerLocationtrackingMods) UnsetCreatedUser() FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - 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 fieldseekerLocationtrackingMods) RandomCreatedUser(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLocationtrackingMods) CreatedDate(val null.Val[time.Time]) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLocationtrackingMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerLocationtrackingMods) UnsetCreatedDate() FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - 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 fieldseekerLocationtrackingMods) RandomCreatedDate(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.CreatedDate = 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 fieldseekerLocationtrackingMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.CreatedDate = 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 fieldseekerLocationtrackingMods) LastEditedUser(val null.Val[string]) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLocationtrackingMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerLocationtrackingMods) UnsetLastEditedUser() FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - 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 fieldseekerLocationtrackingMods) RandomLastEditedUser(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLocationtrackingMods) LastEditedDate(val null.Val[time.Time]) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLocationtrackingMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerLocationtrackingMods) UnsetLastEditedDate() FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - 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 fieldseekerLocationtrackingMods) RandomLastEditedDate(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.LastEditedDate = 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 fieldseekerLocationtrackingMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.LastEditedDate = 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 fieldseekerLocationtrackingMods) Globalid(val uuid.UUID) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLocationtrackingMods) GlobalidFunc(f func() uuid.UUID) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerLocationtrackingMods) UnsetGlobalid() FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - 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 fieldseekerLocationtrackingMods) RandomGlobalid(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLocationtrackingMods) Fieldtech(val null.Val[string]) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Fieldtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLocationtrackingMods) FieldtechFunc(f func() null.Val[string]) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Fieldtech = f - }) -} - -// Clear any values for the column -func (m fieldseekerLocationtrackingMods) UnsetFieldtech() FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - 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 fieldseekerLocationtrackingMods) RandomFieldtech(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Fieldtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomFieldtechNotNull(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Fieldtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLocationtrackingMods) Creationdate(val null.Val[time.Time]) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLocationtrackingMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerLocationtrackingMods) UnsetCreationdate() FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - 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 fieldseekerLocationtrackingMods) RandomCreationdate(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Creationdate = 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 fieldseekerLocationtrackingMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Creationdate = 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 fieldseekerLocationtrackingMods) Creator(val null.Val[string]) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLocationtrackingMods) CreatorFunc(f func() null.Val[string]) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerLocationtrackingMods) UnsetCreator() FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - 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 fieldseekerLocationtrackingMods) RandomCreator(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerLocationtrackingMods) Editdate(val null.Val[time.Time]) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLocationtrackingMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerLocationtrackingMods) UnsetEditdate() FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - 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 fieldseekerLocationtrackingMods) RandomEditdate(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Editdate = 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 fieldseekerLocationtrackingMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Editdate = 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 fieldseekerLocationtrackingMods) Editor(val null.Val[string]) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLocationtrackingMods) EditorFunc(f func() null.Val[string]) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerLocationtrackingMods) UnsetEditor() FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - 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 fieldseekerLocationtrackingMods) RandomEditor(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerLocationtrackingMods) VersionFunc(f func() int32) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerLocationtrackingMods) UnsetVersion() FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - 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 fieldseekerLocationtrackingMods) RandomVersion(f *faker.Faker) FieldseekerLocationtrackingMod { - return FieldseekerLocationtrackingModFunc(func(_ context.Context, o *FieldseekerLocationtrackingTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index 3420f5d7..00000000 --- a/db/factory/fieldseeker.mosquitoinspection.bob.go +++ /dev/null @@ -1,3975 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerMosquitoinspectionMod interface { - Apply(context.Context, *FieldseekerMosquitoinspectionTemplate) -} - -type FieldseekerMosquitoinspectionModFunc func(context.Context, *FieldseekerMosquitoinspectionTemplate) - -func (f FieldseekerMosquitoinspectionModFunc) Apply(ctx context.Context, n *FieldseekerMosquitoinspectionTemplate) { - f(ctx, n) -} - -type FieldseekerMosquitoinspectionModSlice []FieldseekerMosquitoinspectionMod - -func (mods FieldseekerMosquitoinspectionModSlice) Apply(ctx context.Context, n *FieldseekerMosquitoinspectionTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerMosquitoinspectionTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerMosquitoinspectionTemplate struct { - Objectid func() int64 - Numdips func() null.Val[int16] - 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[string] - Lstages func() null.Val[string] - 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[string] - Avglarvae func() null.Val[float64] - Avgpupae func() null.Val[float64] - 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[int16] - Tirecount func() null.Val[int16] - Cbcount func() null.Val[int16] - Containercount func() null.Val[int16] - Fieldspecies func() null.Val[string] - Globalid func() uuid.UUID - CreatedUser func() null.Val[string] - CreatedDate func() null.Val[time.Time] - LastEditedUser func() null.Val[string] - LastEditedDate func() null.Val[time.Time] - Linelocid func() null.Val[uuid.UUID] - Pointlocid func() null.Val[uuid.UUID] - Polygonlocid func() null.Val[uuid.UUID] - Srid func() null.Val[uuid.UUID] - Fieldtech func() null.Val[string] - Larvaepresent func() null.Val[int16] - Pupaepresent func() null.Val[int16] - Sdid func() null.Val[uuid.UUID] - 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[int16] - Vmcomments func() null.Val[string] - 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 { - mod.Apply(ctx, o) - } -} - -// 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 -// this does nothing with the relationship templates -func (o FieldseekerMosquitoinspectionTemplate) BuildSetter() *models.FieldseekerMosquitoinspectionSetter { - m := &models.FieldseekerMosquitoinspectionSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Numdips != nil { - val := o.Numdips() - m.Numdips = omitnull.FromNull(val) - } - if o.Activity != nil { - val := o.Activity() - m.Activity = omitnull.FromNull(val) - } - if o.Breeding != nil { - val := o.Breeding() - m.Breeding = 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.Eggs != nil { - val := o.Eggs() - m.Eggs = omitnull.FromNull(val) - } - if o.Posdips != nil { - val := o.Posdips() - m.Posdips = omitnull.FromNull(val) - } - if o.Adultact != nil { - val := o.Adultact() - m.Adultact = omitnull.FromNull(val) - } - if o.Lstages != nil { - val := o.Lstages() - m.Lstages = omitnull.FromNull(val) - } - if o.Domstage != nil { - val := o.Domstage() - m.Domstage = omitnull.FromNull(val) - } - if o.Actiontaken != nil { - val := o.Actiontaken() - m.Actiontaken = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Avetemp != nil { - val := o.Avetemp() - m.Avetemp = omitnull.FromNull(val) - } - if o.Windspeed != nil { - val := o.Windspeed() - m.Windspeed = omitnull.FromNull(val) - } - if o.Raingauge != nil { - val := o.Raingauge() - m.Raingauge = omitnull.FromNull(val) - } - if o.Startdatetime != nil { - val := o.Startdatetime() - m.Startdatetime = omitnull.FromNull(val) - } - if o.Enddatetime != nil { - val := o.Enddatetime() - m.Enddatetime = omitnull.FromNull(val) - } - if o.Winddir != nil { - val := o.Winddir() - m.Winddir = 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.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.Locationname != nil { - val := o.Locationname() - m.Locationname = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Recordstatus != nil { - val := o.Recordstatus() - m.Recordstatus = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.Personalcontact != nil { - val := o.Personalcontact() - m.Personalcontact = omitnull.FromNull(val) - } - if o.Tirecount != nil { - val := o.Tirecount() - m.Tirecount = omitnull.FromNull(val) - } - if o.Cbcount != nil { - val := o.Cbcount() - m.Cbcount = omitnull.FromNull(val) - } - if o.Containercount != nil { - val := o.Containercount() - m.Containercount = omitnull.FromNull(val) - } - if o.Fieldspecies != nil { - val := o.Fieldspecies() - m.Fieldspecies = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.Linelocid != nil { - val := o.Linelocid() - m.Linelocid = 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.Srid != nil { - val := o.Srid() - m.Srid = omitnull.FromNull(val) - } - if o.Fieldtech != nil { - val := o.Fieldtech() - m.Fieldtech = omitnull.FromNull(val) - } - if o.Larvaepresent != nil { - val := o.Larvaepresent() - m.Larvaepresent = omitnull.FromNull(val) - } - if o.Pupaepresent != nil { - val := o.Pupaepresent() - m.Pupaepresent = 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.Positivecontainercount != nil { - val := o.Positivecontainercount() - m.Positivecontainercount = 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.Jurisdiction != nil { - val := o.Jurisdiction() - m.Jurisdiction = 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.Adminaction != nil { - val := o.Adminaction() - m.Adminaction = omitnull.FromNull(val) - } - if o.Ptaid != nil { - 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 -} - -// BuildManySetter returns an []*models.FieldseekerMosquitoinspectionSetter -// this does nothing with the relationship templates -func (o FieldseekerMosquitoinspectionTemplate) BuildManySetter(number int) []*models.FieldseekerMosquitoinspectionSetter { - m := make([]*models.FieldseekerMosquitoinspectionSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerMosquitoinspection -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerMosquitoinspectionTemplate.Create -func (o FieldseekerMosquitoinspectionTemplate) Build() *models.FieldseekerMosquitoinspection { - m := &models.FieldseekerMosquitoinspection{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Numdips != nil { - m.Numdips = o.Numdips() - } - if o.Activity != nil { - m.Activity = o.Activity() - } - if o.Breeding != nil { - m.Breeding = o.Breeding() - } - if o.Totlarvae != nil { - m.Totlarvae = o.Totlarvae() - } - if o.Totpupae != nil { - m.Totpupae = o.Totpupae() - } - if o.Eggs != nil { - m.Eggs = o.Eggs() - } - if o.Posdips != nil { - m.Posdips = o.Posdips() - } - if o.Adultact != nil { - m.Adultact = o.Adultact() - } - if o.Lstages != nil { - m.Lstages = o.Lstages() - } - if o.Domstage != nil { - m.Domstage = o.Domstage() - } - if o.Actiontaken != nil { - m.Actiontaken = o.Actiontaken() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Avetemp != nil { - m.Avetemp = o.Avetemp() - } - if o.Windspeed != nil { - m.Windspeed = o.Windspeed() - } - if o.Raingauge != nil { - m.Raingauge = o.Raingauge() - } - if o.Startdatetime != nil { - m.Startdatetime = o.Startdatetime() - } - if o.Enddatetime != nil { - m.Enddatetime = o.Enddatetime() - } - if o.Winddir != nil { - m.Winddir = o.Winddir() - } - if o.Avglarvae != nil { - m.Avglarvae = o.Avglarvae() - } - if o.Avgpupae != nil { - m.Avgpupae = o.Avgpupae() - } - 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.Locationname != nil { - m.Locationname = o.Locationname() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Recordstatus != nil { - m.Recordstatus = o.Recordstatus() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Personalcontact != nil { - m.Personalcontact = o.Personalcontact() - } - if o.Tirecount != nil { - m.Tirecount = o.Tirecount() - } - if o.Cbcount != nil { - m.Cbcount = o.Cbcount() - } - if o.Containercount != nil { - m.Containercount = o.Containercount() - } - if o.Fieldspecies != nil { - m.Fieldspecies = o.Fieldspecies() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.Linelocid != nil { - m.Linelocid = o.Linelocid() - } - if o.Pointlocid != nil { - m.Pointlocid = o.Pointlocid() - } - if o.Polygonlocid != nil { - m.Polygonlocid = o.Polygonlocid() - } - if o.Srid != nil { - m.Srid = o.Srid() - } - if o.Fieldtech != nil { - m.Fieldtech = o.Fieldtech() - } - if o.Larvaepresent != nil { - m.Larvaepresent = o.Larvaepresent() - } - if o.Pupaepresent != nil { - m.Pupaepresent = o.Pupaepresent() - } - if o.Sdid != nil { - m.Sdid = o.Sdid() - } - if o.Sitecond != nil { - m.Sitecond = o.Sitecond() - } - if o.Positivecontainercount != nil { - m.Positivecontainercount = o.Positivecontainercount() - } - 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.Jurisdiction != nil { - m.Jurisdiction = o.Jurisdiction() - } - if o.Visualmonitoring != nil { - m.Visualmonitoring = o.Visualmonitoring() - } - if o.Vmcomments != nil { - m.Vmcomments = o.Vmcomments() - } - if o.Adminaction != nil { - m.Adminaction = o.Adminaction() - } - 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) - - return m -} - -// BuildMany returns an models.FieldseekerMosquitoinspectionSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerMosquitoinspectionTemplate.CreateMany -func (o FieldseekerMosquitoinspectionTemplate) BuildMany(number int) models.FieldseekerMosquitoinspectionSlice { - m := make(models.FieldseekerMosquitoinspectionSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerMosquitoinspection(m *models.FieldseekerMosquitoinspectionSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerMosquitoinspectionTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerMosquitoinspection) error { - var err error - - return err -} - -// Create builds a fieldseekerMosquitoinspection and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerMosquitoinspectionTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerMosquitoinspection, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerMosquitoinspection and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerMosquitoinspectionTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerMosquitoinspection { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerMosquitoinspection 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 *FieldseekerMosquitoinspectionTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerMosquitoinspection { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerMosquitoinspections and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerMosquitoinspectionTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerMosquitoinspectionSlice, error) { - var err error - m := make(models.FieldseekerMosquitoinspectionSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerMosquitoinspections and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerMosquitoinspectionTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerMosquitoinspectionSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerMosquitoinspections 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 FieldseekerMosquitoinspectionTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerMosquitoinspectionSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerMosquitoinspection has methods that act as mods for the FieldseekerMosquitoinspectionTemplate -var FieldseekerMosquitoinspectionMods fieldseekerMosquitoinspectionMods - -type fieldseekerMosquitoinspectionMods struct{} - -func (m fieldseekerMosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModSlice{ - FieldseekerMosquitoinspectionMods.RandomObjectid(f), - FieldseekerMosquitoinspectionMods.RandomNumdips(f), - FieldseekerMosquitoinspectionMods.RandomActivity(f), - FieldseekerMosquitoinspectionMods.RandomBreeding(f), - FieldseekerMosquitoinspectionMods.RandomTotlarvae(f), - FieldseekerMosquitoinspectionMods.RandomTotpupae(f), - FieldseekerMosquitoinspectionMods.RandomEggs(f), - FieldseekerMosquitoinspectionMods.RandomPosdips(f), - FieldseekerMosquitoinspectionMods.RandomAdultact(f), - FieldseekerMosquitoinspectionMods.RandomLstages(f), - FieldseekerMosquitoinspectionMods.RandomDomstage(f), - FieldseekerMosquitoinspectionMods.RandomActiontaken(f), - FieldseekerMosquitoinspectionMods.RandomComments(f), - FieldseekerMosquitoinspectionMods.RandomAvetemp(f), - FieldseekerMosquitoinspectionMods.RandomWindspeed(f), - FieldseekerMosquitoinspectionMods.RandomRaingauge(f), - FieldseekerMosquitoinspectionMods.RandomStartdatetime(f), - FieldseekerMosquitoinspectionMods.RandomEnddatetime(f), - FieldseekerMosquitoinspectionMods.RandomWinddir(f), - FieldseekerMosquitoinspectionMods.RandomAvglarvae(f), - FieldseekerMosquitoinspectionMods.RandomAvgpupae(f), - FieldseekerMosquitoinspectionMods.RandomReviewed(f), - FieldseekerMosquitoinspectionMods.RandomReviewedby(f), - FieldseekerMosquitoinspectionMods.RandomRevieweddate(f), - FieldseekerMosquitoinspectionMods.RandomLocationname(f), - FieldseekerMosquitoinspectionMods.RandomZone(f), - FieldseekerMosquitoinspectionMods.RandomRecordstatus(f), - FieldseekerMosquitoinspectionMods.RandomZone2(f), - FieldseekerMosquitoinspectionMods.RandomPersonalcontact(f), - FieldseekerMosquitoinspectionMods.RandomTirecount(f), - FieldseekerMosquitoinspectionMods.RandomCbcount(f), - FieldseekerMosquitoinspectionMods.RandomContainercount(f), - FieldseekerMosquitoinspectionMods.RandomFieldspecies(f), - FieldseekerMosquitoinspectionMods.RandomGlobalid(f), - FieldseekerMosquitoinspectionMods.RandomCreatedUser(f), - FieldseekerMosquitoinspectionMods.RandomCreatedDate(f), - FieldseekerMosquitoinspectionMods.RandomLastEditedUser(f), - FieldseekerMosquitoinspectionMods.RandomLastEditedDate(f), - FieldseekerMosquitoinspectionMods.RandomLinelocid(f), - FieldseekerMosquitoinspectionMods.RandomPointlocid(f), - FieldseekerMosquitoinspectionMods.RandomPolygonlocid(f), - FieldseekerMosquitoinspectionMods.RandomSrid(f), - FieldseekerMosquitoinspectionMods.RandomFieldtech(f), - FieldseekerMosquitoinspectionMods.RandomLarvaepresent(f), - FieldseekerMosquitoinspectionMods.RandomPupaepresent(f), - FieldseekerMosquitoinspectionMods.RandomSdid(f), - FieldseekerMosquitoinspectionMods.RandomSitecond(f), - FieldseekerMosquitoinspectionMods.RandomPositivecontainercount(f), - FieldseekerMosquitoinspectionMods.RandomCreationdate(f), - FieldseekerMosquitoinspectionMods.RandomCreator(f), - FieldseekerMosquitoinspectionMods.RandomEditdate(f), - FieldseekerMosquitoinspectionMods.RandomEditor(f), - FieldseekerMosquitoinspectionMods.RandomJurisdiction(f), - FieldseekerMosquitoinspectionMods.RandomVisualmonitoring(f), - FieldseekerMosquitoinspectionMods.RandomVmcomments(f), - FieldseekerMosquitoinspectionMods.RandomAdminaction(f), - FieldseekerMosquitoinspectionMods.RandomPtaid(f), - FieldseekerMosquitoinspectionMods.RandomGeometry(f), - FieldseekerMosquitoinspectionMods.RandomGeospatial(f), - FieldseekerMosquitoinspectionMods.RandomVersion(f), - FieldseekerMosquitoinspectionMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Objectid(val int64) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) ObjectidFunc(f func() int64) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetObjectid() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomObjectid(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Numdips(val null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Numdips = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) NumdipsFunc(f func() null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Numdips = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetNumdips() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomNumdips(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomNumdipsNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) Activity(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Activity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) ActivityFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Activity = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetActivity() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomActivity(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Activity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomActivityNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Activity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Breeding(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Breeding = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) BreedingFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Breeding = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetBreeding() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomBreeding(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Breeding = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomBreedingNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Breeding = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Totlarvae(val null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Totlarvae = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) TotlarvaeFunc(f func() null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Totlarvae = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetTotlarvae() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomTotlarvae(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomTotlarvaeNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) Totpupae(val null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Totpupae = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) TotpupaeFunc(f func() null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Totpupae = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetTotpupae() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomTotpupae(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomTotpupaeNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) Eggs(val null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Eggs = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) EggsFunc(f func() null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Eggs = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetEggs() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomEggs(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomEggsNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) Posdips(val null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Posdips = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) PosdipsFunc(f func() null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Posdips = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetPosdips() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomPosdips(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomPosdipsNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) Adultact(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Adultact = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) AdultactFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Adultact = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetAdultact() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomAdultact(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Adultact = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomAdultactNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Adultact = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Lstages(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Lstages = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) LstagesFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Lstages = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetLstages() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomLstages(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Lstages = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLstagesNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Lstages = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Domstage(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Domstage = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) DomstageFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Domstage = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetDomstage() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomDomstage(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Domstage = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomDomstageNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Domstage = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Actiontaken(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Actiontaken = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) ActiontakenFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Actiontaken = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetActiontaken() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomActiontaken(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Actiontaken = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomActiontakenNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Actiontaken = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Comments(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) CommentsFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetComments() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomComments(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCommentsNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Avetemp(val null.Val[float64]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Avetemp = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) AvetempFunc(f func() null.Val[float64]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Avetemp = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetAvetemp() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomAvetemp(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomAvetempNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) Windspeed(val null.Val[float64]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Windspeed = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) WindspeedFunc(f func() null.Val[float64]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Windspeed = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetWindspeed() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomWindspeed(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomWindspeedNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) Raingauge(val null.Val[float64]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Raingauge = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) RaingaugeFunc(f func() null.Val[float64]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Raingauge = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetRaingauge() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomRaingauge(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomRaingaugeNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) Startdatetime(val null.Val[time.Time]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Startdatetime = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) StartdatetimeFunc(f func() null.Val[time.Time]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Startdatetime = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetStartdatetime() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomStartdatetime(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Startdatetime = 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 fieldseekerMosquitoinspectionMods) RandomStartdatetimeNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Startdatetime = 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 fieldseekerMosquitoinspectionMods) Enddatetime(val null.Val[time.Time]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Enddatetime = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) EnddatetimeFunc(f func() null.Val[time.Time]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Enddatetime = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetEnddatetime() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomEnddatetime(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Enddatetime = 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 fieldseekerMosquitoinspectionMods) RandomEnddatetimeNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Enddatetime = 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 fieldseekerMosquitoinspectionMods) Winddir(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Winddir = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) WinddirFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Winddir = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetWinddir() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomWinddir(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Winddir = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "3") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomWinddirNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Winddir = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "3") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Avglarvae(val null.Val[float64]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Avglarvae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) AvglarvaeFunc(f func() null.Val[float64]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Avglarvae = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetAvglarvae() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomAvglarvae(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomAvglarvaeNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) Avgpupae(val null.Val[float64]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Avgpupae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) AvgpupaeFunc(f func() null.Val[float64]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Avgpupae = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetAvgpupae() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomAvgpupae(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomAvgpupaeNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) Reviewed(val null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Reviewed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) ReviewedFunc(f func() null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Reviewed = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetReviewed() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomReviewed(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomReviewedNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) Reviewedby(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Reviewedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) ReviewedbyFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Reviewedby = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetReviewedby() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomReviewedby(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Reviewedby = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReviewedbyNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Reviewedby = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Revieweddate(val null.Val[time.Time]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Revieweddate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) RevieweddateFunc(f func() null.Val[time.Time]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Revieweddate = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetRevieweddate() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomRevieweddate(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Revieweddate = 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 fieldseekerMosquitoinspectionMods) RandomRevieweddateNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Revieweddate = 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 fieldseekerMosquitoinspectionMods) Locationname(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Locationname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) LocationnameFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Locationname = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetLocationname() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomLocationname(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Locationname = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLocationnameNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Locationname = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Zone(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) ZoneFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetZone() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomZone(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZoneNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Recordstatus(val null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Recordstatus = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) RecordstatusFunc(f func() null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Recordstatus = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetRecordstatus() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomRecordstatus(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomRecordstatusNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) Zone2(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) Zone2Func(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetZone2() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomZone2(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZone2NotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Personalcontact(val null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Personalcontact = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) PersonalcontactFunc(f func() null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Personalcontact = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetPersonalcontact() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomPersonalcontact(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomPersonalcontactNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) Tirecount(val null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Tirecount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) TirecountFunc(f func() null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Tirecount = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetTirecount() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomTirecount(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomTirecountNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) Cbcount(val null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Cbcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) CbcountFunc(f func() null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Cbcount = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetCbcount() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomCbcount(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomCbcountNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) Containercount(val null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Containercount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) ContainercountFunc(f func() null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Containercount = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetContainercount() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomContainercount(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomContainercountNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) Fieldspecies(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Fieldspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) FieldspeciesFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Fieldspecies = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetFieldspecies() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomFieldspecies(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Fieldspecies = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomFieldspeciesNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Fieldspecies = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Globalid(val uuid.UUID) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) GlobalidFunc(f func() uuid.UUID) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetGlobalid() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomGlobalid(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) CreatedUser(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetCreatedUser() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomCreatedUser(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) CreatedDate(val null.Val[time.Time]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetCreatedDate() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomCreatedDate(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.CreatedDate = 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 fieldseekerMosquitoinspectionMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.CreatedDate = 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 fieldseekerMosquitoinspectionMods) LastEditedUser(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetLastEditedUser() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomLastEditedUser(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) LastEditedDate(val null.Val[time.Time]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetLastEditedDate() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomLastEditedDate(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.LastEditedDate = 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 fieldseekerMosquitoinspectionMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.LastEditedDate = 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 fieldseekerMosquitoinspectionMods) Linelocid(val null.Val[uuid.UUID]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Linelocid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) LinelocidFunc(f func() null.Val[uuid.UUID]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Linelocid = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetLinelocid() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomLinelocid(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Linelocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLinelocidNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Linelocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Pointlocid(val null.Val[uuid.UUID]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Pointlocid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) PointlocidFunc(f func() null.Val[uuid.UUID]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Pointlocid = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetPointlocid() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomPointlocid(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Pointlocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomPointlocidNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Pointlocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Polygonlocid(val null.Val[uuid.UUID]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Polygonlocid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) PolygonlocidFunc(f func() null.Val[uuid.UUID]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Polygonlocid = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetPolygonlocid() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomPolygonlocid(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Polygonlocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomPolygonlocidNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Polygonlocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Srid(val null.Val[uuid.UUID]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Srid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) SridFunc(f func() null.Val[uuid.UUID]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Srid = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetSrid() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomSrid(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Srid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSridNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Srid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Fieldtech(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Fieldtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) FieldtechFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Fieldtech = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetFieldtech() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomFieldtech(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Fieldtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomFieldtechNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Fieldtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Larvaepresent(val null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Larvaepresent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) LarvaepresentFunc(f func() null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Larvaepresent = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetLarvaepresent() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomLarvaepresent(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomLarvaepresentNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) Pupaepresent(val null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Pupaepresent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) PupaepresentFunc(f func() null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Pupaepresent = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetPupaepresent() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomPupaepresent(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomPupaepresentNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) Sdid(val null.Val[uuid.UUID]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Sdid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) SdidFunc(f func() null.Val[uuid.UUID]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Sdid = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetSdid() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomSdid(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Sdid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSdidNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Sdid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Sitecond(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Sitecond = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) SitecondFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Sitecond = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetSitecond() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomSitecond(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Sitecond = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSitecondNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Sitecond = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Positivecontainercount(val null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Positivecontainercount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) PositivecontainercountFunc(f func() null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Positivecontainercount = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetPositivecontainercount() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomPositivecontainercount(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomPositivecontainercountNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) Creationdate(val null.Val[time.Time]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetCreationdate() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomCreationdate(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Creationdate = 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 fieldseekerMosquitoinspectionMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Creationdate = 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 fieldseekerMosquitoinspectionMods) Creator(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) CreatorFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetCreator() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomCreator(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Editdate(val null.Val[time.Time]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetEditdate() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomEditdate(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Editdate = 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 fieldseekerMosquitoinspectionMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Editdate = 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 fieldseekerMosquitoinspectionMods) Editor(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) EditorFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetEditor() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomEditor(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Jurisdiction(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Jurisdiction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) JurisdictionFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Jurisdiction = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetJurisdiction() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomJurisdiction(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Jurisdiction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomJurisdictionNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Jurisdiction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Visualmonitoring(val null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Visualmonitoring = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) VisualmonitoringFunc(f func() null.Val[int16]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Visualmonitoring = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetVisualmonitoring() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomVisualmonitoring(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomVisualmonitoringNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) Vmcomments(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Vmcomments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) VmcommentsFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Vmcomments = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetVmcomments() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomVmcomments(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Vmcomments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomVmcommentsNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Vmcomments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Adminaction(val null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Adminaction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) AdminactionFunc(f func() null.Val[string]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Adminaction = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetAdminaction() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomAdminaction(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Adminaction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "256") - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fieldseekerMosquitoinspectionMods) RandomAdminactionNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Adminaction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "256") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerMosquitoinspectionMods) Ptaid(val null.Val[uuid.UUID]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Ptaid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) PtaidFunc(f func() null.Val[uuid.UUID]) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Ptaid = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetPtaid() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomPtaid(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Ptaid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomPtaidNotNull(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Ptaid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerMosquitoinspectionMods) VersionFunc(f func() int32) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerMosquitoinspectionMods) UnsetVersion() FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - 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 fieldseekerMosquitoinspectionMods) RandomVersion(f *faker.Faker) FieldseekerMosquitoinspectionMod { - return FieldseekerMosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerMosquitoinspectionTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index 5eeb395f..00000000 --- a/db/factory/fieldseeker.pointlocation.bob.go +++ /dev/null @@ -1,3227 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerPointlocationMod interface { - Apply(context.Context, *FieldseekerPointlocationTemplate) -} - -type FieldseekerPointlocationModFunc func(context.Context, *FieldseekerPointlocationTemplate) - -func (f FieldseekerPointlocationModFunc) Apply(ctx context.Context, n *FieldseekerPointlocationTemplate) { - f(ctx, n) -} - -type FieldseekerPointlocationModSlice []FieldseekerPointlocationMod - -func (mods FieldseekerPointlocationModSlice) Apply(ctx context.Context, n *FieldseekerPointlocationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerPointlocationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerPointlocationTemplate struct { - Objectid func() int64 - Name func() null.Val[string] - Zone func() null.Val[string] - 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[string] - Externalid func() null.Val[string] - Nextactiondatescheduled func() null.Val[time.Time] - Larvinspectinterval func() null.Val[int16] - Zone2 func() null.Val[string] - Locationnumber func() null.Val[int32] - Globalid func() uuid.UUID - Stype func() null.Val[string] - Lastinspectdate func() null.Val[time.Time] - Lastinspectbreeding func() null.Val[string] - Lastinspectavglarvae func() null.Val[float64] - Lastinspectavgpupae func() null.Val[float64] - Lastinspectlstages func() null.Val[string] - Lastinspectactiontaken func() null.Val[string] - Lastinspectfieldspecies func() null.Val[string] - Lasttreatdate func() null.Val[time.Time] - Lasttreatproduct func() null.Val[string] - Lasttreatqty func() null.Val[float64] - Lasttreatqtyunit func() null.Val[string] - Lastinspectactivity func() null.Val[string] - Lasttreatactivity func() null.Val[string] - Lastinspectconditions func() null.Val[string] - Waterorigin func() null.Val[string] - X func() null.Val[float64] - Y func() null.Val[float64] - 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[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 - H3cell func() null.Val[string] - - 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerPointlocationTemplate) BuildSetter() *models.FieldseekerPointlocationSetter { - m := &models.FieldseekerPointlocationSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Habitat != nil { - val := o.Habitat() - m.Habitat = omitnull.FromNull(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.Active != nil { - val := o.Active() - m.Active = omitnull.FromNull(val) - } - if o.Description != nil { - val := o.Description() - m.Description = omitnull.FromNull(val) - } - if o.Accessdesc != nil { - val := o.Accessdesc() - m.Accessdesc = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Symbology != nil { - val := o.Symbology() - m.Symbology = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Nextactiondatescheduled != nil { - val := o.Nextactiondatescheduled() - m.Nextactiondatescheduled = omitnull.FromNull(val) - } - if o.Larvinspectinterval != nil { - val := o.Larvinspectinterval() - m.Larvinspectinterval = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.Locationnumber != nil { - val := o.Locationnumber() - m.Locationnumber = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Stype != nil { - val := o.Stype() - m.Stype = omitnull.FromNull(val) - } - if o.Lastinspectdate != nil { - val := o.Lastinspectdate() - m.Lastinspectdate = omitnull.FromNull(val) - } - if o.Lastinspectbreeding != nil { - val := o.Lastinspectbreeding() - m.Lastinspectbreeding = 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.Lastinspectlstages != nil { - val := o.Lastinspectlstages() - m.Lastinspectlstages = omitnull.FromNull(val) - } - if o.Lastinspectactiontaken != nil { - val := o.Lastinspectactiontaken() - m.Lastinspectactiontaken = omitnull.FromNull(val) - } - if o.Lastinspectfieldspecies != nil { - val := o.Lastinspectfieldspecies() - m.Lastinspectfieldspecies = 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.Lastinspectactivity != nil { - val := o.Lastinspectactivity() - m.Lastinspectactivity = omitnull.FromNull(val) - } - if o.Lasttreatactivity != nil { - val := o.Lasttreatactivity() - m.Lasttreatactivity = omitnull.FromNull(val) - } - if o.Lastinspectconditions != nil { - val := o.Lastinspectconditions() - m.Lastinspectconditions = 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.Assignedtech != nil { - val := o.Assignedtech() - m.Assignedtech = 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.Jurisdiction != nil { - val := o.Jurisdiction() - m.Jurisdiction = 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.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 -} - -// BuildManySetter returns an []*models.FieldseekerPointlocationSetter -// this does nothing with the relationship templates -func (o FieldseekerPointlocationTemplate) BuildManySetter(number int) []*models.FieldseekerPointlocationSetter { - m := make([]*models.FieldseekerPointlocationSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerPointlocation -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerPointlocationTemplate.Create -func (o FieldseekerPointlocationTemplate) Build() *models.FieldseekerPointlocation { - m := &models.FieldseekerPointlocation{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Habitat != nil { - m.Habitat = o.Habitat() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Usetype != nil { - m.Usetype = o.Usetype() - } - if o.Active != nil { - m.Active = o.Active() - } - if o.Description != nil { - m.Description = o.Description() - } - if o.Accessdesc != nil { - m.Accessdesc = o.Accessdesc() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Symbology != nil { - m.Symbology = o.Symbology() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Nextactiondatescheduled != nil { - m.Nextactiondatescheduled = o.Nextactiondatescheduled() - } - if o.Larvinspectinterval != nil { - m.Larvinspectinterval = o.Larvinspectinterval() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Locationnumber != nil { - m.Locationnumber = o.Locationnumber() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Stype != nil { - m.Stype = o.Stype() - } - if o.Lastinspectdate != nil { - m.Lastinspectdate = o.Lastinspectdate() - } - if o.Lastinspectbreeding != nil { - m.Lastinspectbreeding = o.Lastinspectbreeding() - } - if o.Lastinspectavglarvae != nil { - m.Lastinspectavglarvae = o.Lastinspectavglarvae() - } - if o.Lastinspectavgpupae != nil { - m.Lastinspectavgpupae = o.Lastinspectavgpupae() - } - if o.Lastinspectlstages != nil { - m.Lastinspectlstages = o.Lastinspectlstages() - } - if o.Lastinspectactiontaken != nil { - m.Lastinspectactiontaken = o.Lastinspectactiontaken() - } - if o.Lastinspectfieldspecies != nil { - m.Lastinspectfieldspecies = o.Lastinspectfieldspecies() - } - 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.Lastinspectactivity != nil { - m.Lastinspectactivity = o.Lastinspectactivity() - } - if o.Lasttreatactivity != nil { - m.Lasttreatactivity = o.Lasttreatactivity() - } - if o.Lastinspectconditions != nil { - m.Lastinspectconditions = o.Lastinspectconditions() - } - 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.Assignedtech != nil { - m.Assignedtech = o.Assignedtech() - } - 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.Jurisdiction != nil { - m.Jurisdiction = o.Jurisdiction() - } - 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.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() - } - if o.H3cell != nil { - m.H3cell = o.H3cell() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FieldseekerPointlocationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerPointlocationTemplate.CreateMany -func (o FieldseekerPointlocationTemplate) BuildMany(number int) models.FieldseekerPointlocationSlice { - m := make(models.FieldseekerPointlocationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerPointlocation(m *models.FieldseekerPointlocationSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerPointlocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerPointlocation) error { - var err error - - return err -} - -// Create builds a fieldseekerPointlocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerPointlocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerPointlocation, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerPointlocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerPointlocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerPointlocation { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerPointlocation 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 *FieldseekerPointlocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerPointlocation { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerPointlocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerPointlocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerPointlocationSlice, error) { - var err error - m := make(models.FieldseekerPointlocationSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerPointlocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerPointlocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerPointlocationSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerPointlocations 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 FieldseekerPointlocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerPointlocationSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerPointlocation has methods that act as mods for the FieldseekerPointlocationTemplate -var FieldseekerPointlocationMods fieldseekerPointlocationMods - -type fieldseekerPointlocationMods struct{} - -func (m fieldseekerPointlocationMods) RandomizeAllColumns(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModSlice{ - FieldseekerPointlocationMods.RandomObjectid(f), - FieldseekerPointlocationMods.RandomName(f), - FieldseekerPointlocationMods.RandomZone(f), - FieldseekerPointlocationMods.RandomHabitat(f), - FieldseekerPointlocationMods.RandomPriority(f), - FieldseekerPointlocationMods.RandomUsetype(f), - FieldseekerPointlocationMods.RandomActive(f), - FieldseekerPointlocationMods.RandomDescription(f), - FieldseekerPointlocationMods.RandomAccessdesc(f), - FieldseekerPointlocationMods.RandomComments(f), - FieldseekerPointlocationMods.RandomSymbology(f), - FieldseekerPointlocationMods.RandomExternalid(f), - FieldseekerPointlocationMods.RandomNextactiondatescheduled(f), - FieldseekerPointlocationMods.RandomLarvinspectinterval(f), - FieldseekerPointlocationMods.RandomZone2(f), - FieldseekerPointlocationMods.RandomLocationnumber(f), - FieldseekerPointlocationMods.RandomGlobalid(f), - FieldseekerPointlocationMods.RandomStype(f), - FieldseekerPointlocationMods.RandomLastinspectdate(f), - FieldseekerPointlocationMods.RandomLastinspectbreeding(f), - FieldseekerPointlocationMods.RandomLastinspectavglarvae(f), - FieldseekerPointlocationMods.RandomLastinspectavgpupae(f), - FieldseekerPointlocationMods.RandomLastinspectlstages(f), - FieldseekerPointlocationMods.RandomLastinspectactiontaken(f), - FieldseekerPointlocationMods.RandomLastinspectfieldspecies(f), - FieldseekerPointlocationMods.RandomLasttreatdate(f), - FieldseekerPointlocationMods.RandomLasttreatproduct(f), - FieldseekerPointlocationMods.RandomLasttreatqty(f), - FieldseekerPointlocationMods.RandomLasttreatqtyunit(f), - FieldseekerPointlocationMods.RandomLastinspectactivity(f), - FieldseekerPointlocationMods.RandomLasttreatactivity(f), - FieldseekerPointlocationMods.RandomLastinspectconditions(f), - FieldseekerPointlocationMods.RandomWaterorigin(f), - FieldseekerPointlocationMods.RandomX(f), - FieldseekerPointlocationMods.RandomY(f), - FieldseekerPointlocationMods.RandomAssignedtech(f), - FieldseekerPointlocationMods.RandomCreationdate(f), - FieldseekerPointlocationMods.RandomCreator(f), - FieldseekerPointlocationMods.RandomEditdate(f), - FieldseekerPointlocationMods.RandomEditor(f), - FieldseekerPointlocationMods.RandomJurisdiction(f), - FieldseekerPointlocationMods.RandomDeactivateReason(f), - FieldseekerPointlocationMods.RandomScalarpriority(f), - FieldseekerPointlocationMods.RandomSourcestatus(f), - FieldseekerPointlocationMods.RandomGeometry(f), - FieldseekerPointlocationMods.RandomGeospatial(f), - FieldseekerPointlocationMods.RandomVersion(f), - FieldseekerPointlocationMods.RandomOrganizationID(f), - FieldseekerPointlocationMods.RandomH3cell(f), - } -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Objectid(val int64) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) ObjectidFunc(f func() int64) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetObjectid() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomObjectid(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Name(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) NameFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetName() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomName(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Name = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomNameNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Name = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Zone(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) ZoneFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetZone() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomZone(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZoneNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Habitat(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Habitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) HabitatFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Habitat = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetHabitat() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomHabitat(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Habitat = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomHabitatNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Habitat = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Priority(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) PriorityFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetPriority() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomPriority(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Priority = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomPriorityNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Priority = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Usetype(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Usetype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) UsetypeFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Usetype = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetUsetype() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomUsetype(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Usetype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomUsetypeNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Usetype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Active(val null.Val[int16]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Active = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) ActiveFunc(f func() null.Val[int16]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Active = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetActive() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomActive(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomActiveNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) Description(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Description = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) DescriptionFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Description = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetDescription() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomDescription(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Description = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomDescriptionNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Description = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Accessdesc(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Accessdesc = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) AccessdescFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Accessdesc = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetAccessdesc() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomAccessdesc(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Accessdesc = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomAccessdescNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Accessdesc = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Comments(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) CommentsFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetComments() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomComments(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCommentsNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Symbology(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Symbology = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) SymbologyFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Symbology = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetSymbology() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomSymbology(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Symbology = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "10") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSymbologyNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Symbology = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "10") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Externalid(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) ExternalidFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetExternalid() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomExternalid(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Externalid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomExternalidNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Externalid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Nextactiondatescheduled(val null.Val[time.Time]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) NextactiondatescheduledFunc(f func() null.Val[time.Time]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Nextactiondatescheduled = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetNextactiondatescheduled() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomNextactiondatescheduled(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Nextactiondatescheduled = 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 fieldseekerPointlocationMods) RandomNextactiondatescheduledNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Nextactiondatescheduled = 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 fieldseekerPointlocationMods) Larvinspectinterval(val null.Val[int16]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Larvinspectinterval = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) LarvinspectintervalFunc(f func() null.Val[int16]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Larvinspectinterval = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetLarvinspectinterval() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomLarvinspectinterval(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomLarvinspectintervalNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) Zone2(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) Zone2Func(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetZone2() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomZone2(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZone2NotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Locationnumber(val null.Val[int32]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Locationnumber = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) LocationnumberFunc(f func() null.Val[int32]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Locationnumber = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetLocationnumber() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomLocationnumber(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Locationnumber = 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 fieldseekerPointlocationMods) RandomLocationnumberNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Locationnumber = 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 fieldseekerPointlocationMods) Globalid(val uuid.UUID) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) GlobalidFunc(f func() uuid.UUID) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetGlobalid() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomGlobalid(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Stype(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Stype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) StypeFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Stype = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetStype() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomStype(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Stype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "3") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomStypeNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Stype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "3") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Lastinspectdate(val null.Val[time.Time]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) LastinspectdateFunc(f func() null.Val[time.Time]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetLastinspectdate() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomLastinspectdate(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectdate = 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 fieldseekerPointlocationMods) RandomLastinspectdateNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectdate = 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 fieldseekerPointlocationMods) Lastinspectbreeding(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectbreeding = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) LastinspectbreedingFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectbreeding = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetLastinspectbreeding() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomLastinspectbreeding(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectbreeding = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectbreedingNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectbreeding = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Lastinspectavglarvae(val null.Val[float64]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectavglarvae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) LastinspectavglarvaeFunc(f func() null.Val[float64]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectavglarvae = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetLastinspectavglarvae() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomLastinspectavglarvae(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomLastinspectavglarvaeNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) Lastinspectavgpupae(val null.Val[float64]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectavgpupae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) LastinspectavgpupaeFunc(f func() null.Val[float64]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectavgpupae = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetLastinspectavgpupae() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomLastinspectavgpupae(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomLastinspectavgpupaeNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) Lastinspectlstages(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectlstages = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) LastinspectlstagesFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectlstages = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetLastinspectlstages() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomLastinspectlstages(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectlstages = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectlstagesNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectlstages = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Lastinspectactiontaken(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectactiontaken = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) LastinspectactiontakenFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectactiontaken = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetLastinspectactiontaken() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomLastinspectactiontaken(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectactiontaken = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectactiontakenNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectactiontaken = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Lastinspectfieldspecies(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectfieldspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) LastinspectfieldspeciesFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectfieldspecies = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetLastinspectfieldspecies() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomLastinspectfieldspecies(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectfieldspecies = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectfieldspeciesNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectfieldspecies = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Lasttreatdate(val null.Val[time.Time]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lasttreatdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) LasttreatdateFunc(f func() null.Val[time.Time]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lasttreatdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetLasttreatdate() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomLasttreatdate(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lasttreatdate = 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 fieldseekerPointlocationMods) RandomLasttreatdateNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lasttreatdate = 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 fieldseekerPointlocationMods) Lasttreatproduct(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lasttreatproduct = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) LasttreatproductFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lasttreatproduct = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetLasttreatproduct() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomLasttreatproduct(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lasttreatproduct = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLasttreatproductNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lasttreatproduct = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Lasttreatqty(val null.Val[float64]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lasttreatqty = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) LasttreatqtyFunc(f func() null.Val[float64]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lasttreatqty = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetLasttreatqty() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomLasttreatqty(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomLasttreatqtyNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) Lasttreatqtyunit(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lasttreatqtyunit = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) LasttreatqtyunitFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lasttreatqtyunit = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetLasttreatqtyunit() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomLasttreatqtyunit(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lasttreatqtyunit = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "10") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLasttreatqtyunitNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lasttreatqtyunit = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "10") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Lastinspectactivity(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectactivity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) LastinspectactivityFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectactivity = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetLastinspectactivity() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomLastinspectactivity(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectactivity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectactivityNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectactivity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Lasttreatactivity(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lasttreatactivity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) LasttreatactivityFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lasttreatactivity = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetLasttreatactivity() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomLasttreatactivity(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lasttreatactivity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLasttreatactivityNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lasttreatactivity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Lastinspectconditions(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectconditions = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) LastinspectconditionsFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectconditions = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetLastinspectconditions() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomLastinspectconditions(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectconditions = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectconditionsNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Lastinspectconditions = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Waterorigin(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Waterorigin = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) WateroriginFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Waterorigin = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetWaterorigin() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomWaterorigin(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Waterorigin = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomWateroriginNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Waterorigin = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) X(val null.Val[float64]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.X = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) XFunc(f func() null.Val[float64]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.X = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetX() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomX(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomXNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) Y(val null.Val[float64]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Y = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) YFunc(f func() null.Val[float64]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Y = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetY() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomY(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomYNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) Assignedtech(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Assignedtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) AssignedtechFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Assignedtech = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetAssignedtech() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomAssignedtech(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Assignedtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "256") - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fieldseekerPointlocationMods) RandomAssignedtechNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Assignedtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "256") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Creationdate(val null.Val[time.Time]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetCreationdate() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomCreationdate(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Creationdate = 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 fieldseekerPointlocationMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Creationdate = 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 fieldseekerPointlocationMods) Creator(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) CreatorFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetCreator() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomCreator(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Editdate(val null.Val[time.Time]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetEditdate() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomEditdate(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Editdate = 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 fieldseekerPointlocationMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Editdate = 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 fieldseekerPointlocationMods) Editor(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) EditorFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetEditor() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomEditor(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Jurisdiction(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Jurisdiction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) JurisdictionFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Jurisdiction = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetJurisdiction() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomJurisdiction(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Jurisdiction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomJurisdictionNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Jurisdiction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) DeactivateReason(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.DeactivateReason = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) DeactivateReasonFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.DeactivateReason = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetDeactivateReason() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomDeactivateReason(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.DeactivateReason = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "256") - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fieldseekerPointlocationMods) RandomDeactivateReasonNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.DeactivateReason = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "256") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) Scalarpriority(val null.Val[int32]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Scalarpriority = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) ScalarpriorityFunc(f func() null.Val[int32]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Scalarpriority = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetScalarpriority() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomScalarpriority(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Scalarpriority = 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 fieldseekerPointlocationMods) RandomScalarpriorityNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Scalarpriority = 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 fieldseekerPointlocationMods) Sourcestatus(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Sourcestatus = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) SourcestatusFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Sourcestatus = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetSourcestatus() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomSourcestatus(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Sourcestatus = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSourcestatusNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Sourcestatus = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) VersionFunc(f func() int32) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetVersion() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - 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 fieldseekerPointlocationMods) RandomVersion(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPointlocationMods) H3cell(val null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.H3cell = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPointlocationMods) H3cellFunc(f func() null.Val[string]) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.H3cell = f - }) -} - -// Clear any values for the column -func (m fieldseekerPointlocationMods) UnsetH3cell() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.H3cell = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m fieldseekerPointlocationMods) RandomH3cell(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.H3cell = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fieldseekerPointlocationMods) RandomH3cellNotNull(f *faker.Faker) FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(_ context.Context, o *FieldseekerPointlocationTemplate) { - o.H3cell = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -func (m fieldseekerPointlocationMods) WithParentsCascading() FieldseekerPointlocationMod { - return FieldseekerPointlocationModFunc(func(ctx context.Context, o *FieldseekerPointlocationTemplate) { - if isDone, _ := fieldseekerPointlocationWithParentsCascadingCtx.Value(ctx); isDone { - 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 deleted file mode 100644 index 874b05ac..00000000 --- a/db/factory/fieldseeker.polygonlocation.bob.go +++ /dev/null @@ -1,3045 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerPolygonlocationMod interface { - Apply(context.Context, *FieldseekerPolygonlocationTemplate) -} - -type FieldseekerPolygonlocationModFunc func(context.Context, *FieldseekerPolygonlocationTemplate) - -func (f FieldseekerPolygonlocationModFunc) Apply(ctx context.Context, n *FieldseekerPolygonlocationTemplate) { - f(ctx, n) -} - -type FieldseekerPolygonlocationModSlice []FieldseekerPolygonlocationMod - -func (mods FieldseekerPolygonlocationModSlice) Apply(ctx context.Context, n *FieldseekerPolygonlocationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerPolygonlocationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerPolygonlocationTemplate struct { - Objectid func() int64 - Name func() null.Val[string] - Zone func() null.Val[string] - 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[string] - Externalid func() null.Val[string] - Acres func() null.Val[float64] - Nextactiondatescheduled func() null.Val[time.Time] - Larvinspectinterval func() null.Val[int16] - Zone2 func() null.Val[string] - Locationnumber func() null.Val[int32] - Globalid func() uuid.UUID - Lastinspectdate func() null.Val[time.Time] - Lastinspectbreeding func() null.Val[string] - Lastinspectavglarvae func() null.Val[float64] - Lastinspectavgpupae func() null.Val[float64] - Lastinspectlstages func() null.Val[string] - Lastinspectactiontaken func() null.Val[string] - Lastinspectfieldspecies func() null.Val[string] - Lasttreatdate func() null.Val[time.Time] - Lasttreatproduct func() null.Val[string] - Lasttreatqty func() null.Val[float64] - Lasttreatqtyunit func() null.Val[string] - Hectares func() null.Val[float64] - Lastinspectactivity func() null.Val[string] - Lasttreatactivity func() null.Val[string] - Lastinspectconditions func() null.Val[string] - Waterorigin func() null.Val[string] - Filter 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] - 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerPolygonlocationTemplate) BuildSetter() *models.FieldseekerPolygonlocationSetter { - m := &models.FieldseekerPolygonlocationSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Habitat != nil { - val := o.Habitat() - m.Habitat = omitnull.FromNull(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.Active != nil { - val := o.Active() - m.Active = omitnull.FromNull(val) - } - if o.Description != nil { - val := o.Description() - m.Description = omitnull.FromNull(val) - } - if o.Accessdesc != nil { - val := o.Accessdesc() - m.Accessdesc = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Symbology != nil { - val := o.Symbology() - m.Symbology = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Acres != nil { - val := o.Acres() - m.Acres = omitnull.FromNull(val) - } - if o.Nextactiondatescheduled != nil { - val := o.Nextactiondatescheduled() - m.Nextactiondatescheduled = omitnull.FromNull(val) - } - if o.Larvinspectinterval != nil { - val := o.Larvinspectinterval() - m.Larvinspectinterval = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.Locationnumber != nil { - val := o.Locationnumber() - m.Locationnumber = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Lastinspectdate != nil { - val := o.Lastinspectdate() - m.Lastinspectdate = omitnull.FromNull(val) - } - if o.Lastinspectbreeding != nil { - val := o.Lastinspectbreeding() - m.Lastinspectbreeding = 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.Lastinspectlstages != nil { - val := o.Lastinspectlstages() - m.Lastinspectlstages = omitnull.FromNull(val) - } - if o.Lastinspectactiontaken != nil { - val := o.Lastinspectactiontaken() - m.Lastinspectactiontaken = omitnull.FromNull(val) - } - if o.Lastinspectfieldspecies != nil { - val := o.Lastinspectfieldspecies() - m.Lastinspectfieldspecies = 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.Hectares != nil { - val := o.Hectares() - m.Hectares = omitnull.FromNull(val) - } - if o.Lastinspectactivity != nil { - val := o.Lastinspectactivity() - m.Lastinspectactivity = omitnull.FromNull(val) - } - if o.Lasttreatactivity != nil { - val := o.Lasttreatactivity() - m.Lasttreatactivity = omitnull.FromNull(val) - } - if o.Lastinspectconditions != nil { - val := o.Lastinspectconditions() - m.Lastinspectconditions = omitnull.FromNull(val) - } - if o.Waterorigin != nil { - val := o.Waterorigin() - m.Waterorigin = omitnull.FromNull(val) - } - if o.Filter != nil { - val := o.Filter() - m.Filter = 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.Jurisdiction != nil { - val := o.Jurisdiction() - m.Jurisdiction = 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.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 -} - -// BuildManySetter returns an []*models.FieldseekerPolygonlocationSetter -// this does nothing with the relationship templates -func (o FieldseekerPolygonlocationTemplate) BuildManySetter(number int) []*models.FieldseekerPolygonlocationSetter { - m := make([]*models.FieldseekerPolygonlocationSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerPolygonlocation -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerPolygonlocationTemplate.Create -func (o FieldseekerPolygonlocationTemplate) Build() *models.FieldseekerPolygonlocation { - m := &models.FieldseekerPolygonlocation{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Habitat != nil { - m.Habitat = o.Habitat() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Usetype != nil { - m.Usetype = o.Usetype() - } - if o.Active != nil { - m.Active = o.Active() - } - if o.Description != nil { - m.Description = o.Description() - } - if o.Accessdesc != nil { - m.Accessdesc = o.Accessdesc() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Symbology != nil { - m.Symbology = o.Symbology() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Acres != nil { - m.Acres = o.Acres() - } - if o.Nextactiondatescheduled != nil { - m.Nextactiondatescheduled = o.Nextactiondatescheduled() - } - if o.Larvinspectinterval != nil { - m.Larvinspectinterval = o.Larvinspectinterval() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Locationnumber != nil { - m.Locationnumber = o.Locationnumber() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Lastinspectdate != nil { - m.Lastinspectdate = o.Lastinspectdate() - } - if o.Lastinspectbreeding != nil { - m.Lastinspectbreeding = o.Lastinspectbreeding() - } - if o.Lastinspectavglarvae != nil { - m.Lastinspectavglarvae = o.Lastinspectavglarvae() - } - if o.Lastinspectavgpupae != nil { - m.Lastinspectavgpupae = o.Lastinspectavgpupae() - } - if o.Lastinspectlstages != nil { - m.Lastinspectlstages = o.Lastinspectlstages() - } - if o.Lastinspectactiontaken != nil { - m.Lastinspectactiontaken = o.Lastinspectactiontaken() - } - if o.Lastinspectfieldspecies != nil { - m.Lastinspectfieldspecies = o.Lastinspectfieldspecies() - } - 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.Hectares != nil { - m.Hectares = o.Hectares() - } - if o.Lastinspectactivity != nil { - m.Lastinspectactivity = o.Lastinspectactivity() - } - if o.Lasttreatactivity != nil { - m.Lasttreatactivity = o.Lasttreatactivity() - } - if o.Lastinspectconditions != nil { - m.Lastinspectconditions = o.Lastinspectconditions() - } - if o.Waterorigin != nil { - m.Waterorigin = o.Waterorigin() - } - if o.Filter != nil { - m.Filter = o.Filter() - } - 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.Jurisdiction != nil { - m.Jurisdiction = o.Jurisdiction() - } - if o.ShapeArea != nil { - m.ShapeArea = o.ShapeArea() - } - 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) - - return m -} - -// BuildMany returns an models.FieldseekerPolygonlocationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerPolygonlocationTemplate.CreateMany -func (o FieldseekerPolygonlocationTemplate) BuildMany(number int) models.FieldseekerPolygonlocationSlice { - m := make(models.FieldseekerPolygonlocationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerPolygonlocation(m *models.FieldseekerPolygonlocationSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerPolygonlocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerPolygonlocation) error { - var err error - - return err -} - -// Create builds a fieldseekerPolygonlocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerPolygonlocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerPolygonlocation, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerPolygonlocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerPolygonlocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerPolygonlocation { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerPolygonlocation 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 *FieldseekerPolygonlocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerPolygonlocation { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerPolygonlocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerPolygonlocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerPolygonlocationSlice, error) { - var err error - m := make(models.FieldseekerPolygonlocationSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerPolygonlocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerPolygonlocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerPolygonlocationSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerPolygonlocations 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 FieldseekerPolygonlocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerPolygonlocationSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerPolygonlocation has methods that act as mods for the FieldseekerPolygonlocationTemplate -var FieldseekerPolygonlocationMods fieldseekerPolygonlocationMods - -type fieldseekerPolygonlocationMods struct{} - -func (m fieldseekerPolygonlocationMods) RandomizeAllColumns(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModSlice{ - FieldseekerPolygonlocationMods.RandomObjectid(f), - FieldseekerPolygonlocationMods.RandomName(f), - FieldseekerPolygonlocationMods.RandomZone(f), - FieldseekerPolygonlocationMods.RandomHabitat(f), - FieldseekerPolygonlocationMods.RandomPriority(f), - FieldseekerPolygonlocationMods.RandomUsetype(f), - FieldseekerPolygonlocationMods.RandomActive(f), - FieldseekerPolygonlocationMods.RandomDescription(f), - FieldseekerPolygonlocationMods.RandomAccessdesc(f), - FieldseekerPolygonlocationMods.RandomComments(f), - FieldseekerPolygonlocationMods.RandomSymbology(f), - FieldseekerPolygonlocationMods.RandomExternalid(f), - FieldseekerPolygonlocationMods.RandomAcres(f), - FieldseekerPolygonlocationMods.RandomNextactiondatescheduled(f), - FieldseekerPolygonlocationMods.RandomLarvinspectinterval(f), - FieldseekerPolygonlocationMods.RandomZone2(f), - FieldseekerPolygonlocationMods.RandomLocationnumber(f), - FieldseekerPolygonlocationMods.RandomGlobalid(f), - FieldseekerPolygonlocationMods.RandomLastinspectdate(f), - FieldseekerPolygonlocationMods.RandomLastinspectbreeding(f), - FieldseekerPolygonlocationMods.RandomLastinspectavglarvae(f), - FieldseekerPolygonlocationMods.RandomLastinspectavgpupae(f), - FieldseekerPolygonlocationMods.RandomLastinspectlstages(f), - FieldseekerPolygonlocationMods.RandomLastinspectactiontaken(f), - FieldseekerPolygonlocationMods.RandomLastinspectfieldspecies(f), - FieldseekerPolygonlocationMods.RandomLasttreatdate(f), - FieldseekerPolygonlocationMods.RandomLasttreatproduct(f), - FieldseekerPolygonlocationMods.RandomLasttreatqty(f), - FieldseekerPolygonlocationMods.RandomLasttreatqtyunit(f), - FieldseekerPolygonlocationMods.RandomHectares(f), - FieldseekerPolygonlocationMods.RandomLastinspectactivity(f), - FieldseekerPolygonlocationMods.RandomLasttreatactivity(f), - FieldseekerPolygonlocationMods.RandomLastinspectconditions(f), - FieldseekerPolygonlocationMods.RandomWaterorigin(f), - FieldseekerPolygonlocationMods.RandomFilter(f), - FieldseekerPolygonlocationMods.RandomCreationdate(f), - FieldseekerPolygonlocationMods.RandomCreator(f), - FieldseekerPolygonlocationMods.RandomEditdate(f), - FieldseekerPolygonlocationMods.RandomEditor(f), - FieldseekerPolygonlocationMods.RandomJurisdiction(f), - FieldseekerPolygonlocationMods.RandomShapeArea(f), - FieldseekerPolygonlocationMods.RandomShapeLength(f), - FieldseekerPolygonlocationMods.RandomGeometry(f), - FieldseekerPolygonlocationMods.RandomGeospatial(f), - FieldseekerPolygonlocationMods.RandomVersion(f), - FieldseekerPolygonlocationMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Objectid(val int64) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) ObjectidFunc(f func() int64) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetObjectid() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomObjectid(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Name(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) NameFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetName() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomName(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Name = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomNameNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Name = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Zone(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) ZoneFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetZone() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomZone(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZoneNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Habitat(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Habitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) HabitatFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Habitat = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetHabitat() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomHabitat(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Habitat = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomHabitatNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Habitat = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Priority(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) PriorityFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetPriority() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomPriority(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Priority = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomPriorityNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Priority = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Usetype(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Usetype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) UsetypeFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Usetype = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetUsetype() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomUsetype(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Usetype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomUsetypeNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Usetype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Active(val null.Val[int16]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Active = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) ActiveFunc(f func() null.Val[int16]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Active = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetActive() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomActive(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomActiveNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) Description(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Description = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) DescriptionFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Description = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetDescription() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomDescription(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Description = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomDescriptionNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Description = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Accessdesc(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Accessdesc = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) AccessdescFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Accessdesc = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetAccessdesc() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomAccessdesc(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Accessdesc = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomAccessdescNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Accessdesc = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Comments(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) CommentsFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetComments() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomComments(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCommentsNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Symbology(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Symbology = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) SymbologyFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Symbology = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetSymbology() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomSymbology(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Symbology = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "10") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSymbologyNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Symbology = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "10") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Externalid(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) ExternalidFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetExternalid() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomExternalid(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Externalid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomExternalidNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Externalid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Acres(val null.Val[float64]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Acres = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) AcresFunc(f func() null.Val[float64]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Acres = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetAcres() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomAcres(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomAcresNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) Nextactiondatescheduled(val null.Val[time.Time]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) NextactiondatescheduledFunc(f func() null.Val[time.Time]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Nextactiondatescheduled = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetNextactiondatescheduled() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomNextactiondatescheduled(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Nextactiondatescheduled = 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 fieldseekerPolygonlocationMods) RandomNextactiondatescheduledNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Nextactiondatescheduled = 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 fieldseekerPolygonlocationMods) Larvinspectinterval(val null.Val[int16]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Larvinspectinterval = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) LarvinspectintervalFunc(f func() null.Val[int16]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Larvinspectinterval = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetLarvinspectinterval() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomLarvinspectinterval(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomLarvinspectintervalNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) Zone2(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) Zone2Func(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetZone2() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomZone2(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZone2NotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Locationnumber(val null.Val[int32]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Locationnumber = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) LocationnumberFunc(f func() null.Val[int32]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Locationnumber = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetLocationnumber() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomLocationnumber(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Locationnumber = 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 fieldseekerPolygonlocationMods) RandomLocationnumberNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Locationnumber = 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 fieldseekerPolygonlocationMods) Globalid(val uuid.UUID) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) GlobalidFunc(f func() uuid.UUID) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetGlobalid() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomGlobalid(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Lastinspectdate(val null.Val[time.Time]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) LastinspectdateFunc(f func() null.Val[time.Time]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetLastinspectdate() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomLastinspectdate(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectdate = 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 fieldseekerPolygonlocationMods) RandomLastinspectdateNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectdate = 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 fieldseekerPolygonlocationMods) Lastinspectbreeding(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectbreeding = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) LastinspectbreedingFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectbreeding = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetLastinspectbreeding() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomLastinspectbreeding(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectbreeding = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectbreedingNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectbreeding = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Lastinspectavglarvae(val null.Val[float64]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectavglarvae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) LastinspectavglarvaeFunc(f func() null.Val[float64]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectavglarvae = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetLastinspectavglarvae() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomLastinspectavglarvae(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomLastinspectavglarvaeNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) Lastinspectavgpupae(val null.Val[float64]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectavgpupae = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) LastinspectavgpupaeFunc(f func() null.Val[float64]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectavgpupae = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetLastinspectavgpupae() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomLastinspectavgpupae(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomLastinspectavgpupaeNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) Lastinspectlstages(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectlstages = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) LastinspectlstagesFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectlstages = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetLastinspectlstages() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomLastinspectlstages(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectlstages = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectlstagesNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectlstages = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Lastinspectactiontaken(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectactiontaken = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) LastinspectactiontakenFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectactiontaken = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetLastinspectactiontaken() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomLastinspectactiontaken(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectactiontaken = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectactiontakenNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectactiontaken = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Lastinspectfieldspecies(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectfieldspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) LastinspectfieldspeciesFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectfieldspecies = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetLastinspectfieldspecies() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomLastinspectfieldspecies(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectfieldspecies = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectfieldspeciesNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectfieldspecies = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Lasttreatdate(val null.Val[time.Time]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lasttreatdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) LasttreatdateFunc(f func() null.Val[time.Time]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lasttreatdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetLasttreatdate() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomLasttreatdate(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lasttreatdate = 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 fieldseekerPolygonlocationMods) RandomLasttreatdateNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lasttreatdate = 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 fieldseekerPolygonlocationMods) Lasttreatproduct(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lasttreatproduct = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) LasttreatproductFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lasttreatproduct = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetLasttreatproduct() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomLasttreatproduct(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lasttreatproduct = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLasttreatproductNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lasttreatproduct = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Lasttreatqty(val null.Val[float64]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lasttreatqty = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) LasttreatqtyFunc(f func() null.Val[float64]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lasttreatqty = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetLasttreatqty() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomLasttreatqty(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomLasttreatqtyNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) Lasttreatqtyunit(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lasttreatqtyunit = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) LasttreatqtyunitFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lasttreatqtyunit = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetLasttreatqtyunit() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomLasttreatqtyunit(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lasttreatqtyunit = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "10") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLasttreatqtyunitNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lasttreatqtyunit = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "10") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Hectares(val null.Val[float64]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Hectares = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) HectaresFunc(f func() null.Val[float64]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Hectares = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetHectares() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomHectares(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomHectaresNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) Lastinspectactivity(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectactivity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) LastinspectactivityFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectactivity = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetLastinspectactivity() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomLastinspectactivity(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectactivity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectactivityNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectactivity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Lasttreatactivity(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lasttreatactivity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) LasttreatactivityFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lasttreatactivity = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetLasttreatactivity() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomLasttreatactivity(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lasttreatactivity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLasttreatactivityNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lasttreatactivity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Lastinspectconditions(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectconditions = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) LastinspectconditionsFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectconditions = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetLastinspectconditions() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomLastinspectconditions(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectconditions = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectconditionsNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Lastinspectconditions = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Waterorigin(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Waterorigin = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) WateroriginFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Waterorigin = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetWaterorigin() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomWaterorigin(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Waterorigin = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomWateroriginNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Waterorigin = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Filter(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Filter = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) FilterFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Filter = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetFilter() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomFilter(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Filter = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomFilterNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Filter = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Creationdate(val null.Val[time.Time]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetCreationdate() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomCreationdate(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Creationdate = 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 fieldseekerPolygonlocationMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Creationdate = 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 fieldseekerPolygonlocationMods) Creator(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) CreatorFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetCreator() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomCreator(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Editdate(val null.Val[time.Time]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetEditdate() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomEditdate(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Editdate = 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 fieldseekerPolygonlocationMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Editdate = 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 fieldseekerPolygonlocationMods) Editor(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) EditorFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetEditor() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomEditor(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) Jurisdiction(val null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Jurisdiction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) JurisdictionFunc(f func() null.Val[string]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Jurisdiction = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetJurisdiction() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomJurisdiction(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Jurisdiction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomJurisdictionNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Jurisdiction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPolygonlocationMods) ShapeArea(val null.Val[float64]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.ShapeArea = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) ShapeAreaFunc(f func() null.Val[float64]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.ShapeArea = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetShapeArea() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomShapeArea(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomShapeAreaNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) ShapeLength(val null.Val[float64]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.ShapeLength = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) ShapeLengthFunc(f func() null.Val[float64]) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.ShapeLength = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetShapeLength() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomShapeLength(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomShapeLengthNotNull(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPolygonlocationMods) VersionFunc(f func() int32) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerPolygonlocationMods) UnsetVersion() FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - 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 fieldseekerPolygonlocationMods) RandomVersion(f *faker.Faker) FieldseekerPolygonlocationMod { - return FieldseekerPolygonlocationModFunc(func(_ context.Context, o *FieldseekerPolygonlocationTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index 152cfd1a..00000000 --- a/db/factory/fieldseeker.pool.bob.go +++ /dev/null @@ -1,2177 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerPoolMod interface { - Apply(context.Context, *FieldseekerPoolTemplate) -} - -type FieldseekerPoolModFunc func(context.Context, *FieldseekerPoolTemplate) - -func (f FieldseekerPoolModFunc) Apply(ctx context.Context, n *FieldseekerPoolTemplate) { - f(ctx, n) -} - -type FieldseekerPoolModSlice []FieldseekerPoolMod - -func (mods FieldseekerPoolModSlice) Apply(ctx context.Context, n *FieldseekerPoolTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerPoolTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerPoolTemplate struct { - Objectid func() int64 - TrapdataID func() null.Val[uuid.UUID] - Datesent func() null.Val[time.Time] - Survtech func() null.Val[string] - Datetested func() null.Val[time.Time] - Testtech func() null.Val[string] - Comments func() null.Val[string] - Sampleid func() null.Val[string] - Processed func() null.Val[int16] - LabID func() null.Val[uuid.UUID] - Testmethod func() null.Val[string] - Diseasetested func() null.Val[string] - Diseasepos func() null.Val[string] - Globalid func() 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[string] - Poolyear func() null.Val[int16] - Gatewaysync func() null.Val[int16] - Vectorsurvcollectionid func() null.Val[string] - Vectorsurvpoolid func() null.Val[string] - Vectorsurvtrapdataid 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 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FieldseekerPool = append(rel.R.FieldseekerPool, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FieldseekerPoolSetter -// this does nothing with the relationship templates -func (o FieldseekerPoolTemplate) BuildSetter() *models.FieldseekerPoolSetter { - m := &models.FieldseekerPoolSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.TrapdataID != nil { - val := o.TrapdataID() - m.TrapdataID = omitnull.FromNull(val) - } - if o.Datesent != nil { - val := o.Datesent() - m.Datesent = omitnull.FromNull(val) - } - if o.Survtech != nil { - val := o.Survtech() - m.Survtech = omitnull.FromNull(val) - } - if o.Datetested != nil { - val := o.Datetested() - m.Datetested = omitnull.FromNull(val) - } - if o.Testtech != nil { - val := o.Testtech() - m.Testtech = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Sampleid != nil { - val := o.Sampleid() - m.Sampleid = omitnull.FromNull(val) - } - if o.Processed != nil { - val := o.Processed() - m.Processed = omitnull.FromNull(val) - } - if o.LabID != nil { - val := o.LabID() - m.LabID = omitnull.FromNull(val) - } - if o.Testmethod != nil { - val := o.Testmethod() - m.Testmethod = omitnull.FromNull(val) - } - if o.Diseasetested != nil { - val := o.Diseasetested() - m.Diseasetested = omitnull.FromNull(val) - } - if o.Diseasepos != nil { - val := o.Diseasepos() - m.Diseasepos = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.Lab != nil { - val := o.Lab() - m.Lab = omitnull.FromNull(val) - } - if o.Poolyear != nil { - val := o.Poolyear() - m.Poolyear = omitnull.FromNull(val) - } - if o.Gatewaysync != nil { - val := o.Gatewaysync() - m.Gatewaysync = 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.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.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 -} - -// BuildManySetter returns an []*models.FieldseekerPoolSetter -// this does nothing with the relationship templates -func (o FieldseekerPoolTemplate) BuildManySetter(number int) []*models.FieldseekerPoolSetter { - m := make([]*models.FieldseekerPoolSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerPool -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerPoolTemplate.Create -func (o FieldseekerPoolTemplate) Build() *models.FieldseekerPool { - m := &models.FieldseekerPool{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.TrapdataID != nil { - m.TrapdataID = o.TrapdataID() - } - if o.Datesent != nil { - m.Datesent = o.Datesent() - } - if o.Survtech != nil { - m.Survtech = o.Survtech() - } - if o.Datetested != nil { - m.Datetested = o.Datetested() - } - if o.Testtech != nil { - m.Testtech = o.Testtech() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Sampleid != nil { - m.Sampleid = o.Sampleid() - } - if o.Processed != nil { - m.Processed = o.Processed() - } - if o.LabID != nil { - m.LabID = o.LabID() - } - if o.Testmethod != nil { - m.Testmethod = o.Testmethod() - } - if o.Diseasetested != nil { - m.Diseasetested = o.Diseasetested() - } - if o.Diseasepos != nil { - m.Diseasepos = o.Diseasepos() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.Lab != nil { - m.Lab = o.Lab() - } - if o.Poolyear != nil { - m.Poolyear = o.Poolyear() - } - if o.Gatewaysync != nil { - m.Gatewaysync = o.Gatewaysync() - } - 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.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.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) - - return m -} - -// BuildMany returns an models.FieldseekerPoolSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerPoolTemplate.CreateMany -func (o FieldseekerPoolTemplate) BuildMany(number int) models.FieldseekerPoolSlice { - m := make(models.FieldseekerPoolSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerPool(m *models.FieldseekerPoolSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerPoolTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerPool) error { - var err error - - return err -} - -// Create builds a fieldseekerPool and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerPoolTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerPool, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerPool and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerPoolTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerPool { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerPool 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 *FieldseekerPoolTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerPool { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerPools and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerPoolTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerPoolSlice, error) { - var err error - m := make(models.FieldseekerPoolSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerPools and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerPoolTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerPoolSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerPools 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 FieldseekerPoolTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerPoolSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerPool has methods that act as mods for the FieldseekerPoolTemplate -var FieldseekerPoolMods fieldseekerPoolMods - -type fieldseekerPoolMods struct{} - -func (m fieldseekerPoolMods) RandomizeAllColumns(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModSlice{ - FieldseekerPoolMods.RandomObjectid(f), - FieldseekerPoolMods.RandomTrapdataID(f), - FieldseekerPoolMods.RandomDatesent(f), - FieldseekerPoolMods.RandomSurvtech(f), - FieldseekerPoolMods.RandomDatetested(f), - FieldseekerPoolMods.RandomTesttech(f), - FieldseekerPoolMods.RandomComments(f), - FieldseekerPoolMods.RandomSampleid(f), - FieldseekerPoolMods.RandomProcessed(f), - FieldseekerPoolMods.RandomLabID(f), - FieldseekerPoolMods.RandomTestmethod(f), - FieldseekerPoolMods.RandomDiseasetested(f), - FieldseekerPoolMods.RandomDiseasepos(f), - FieldseekerPoolMods.RandomGlobalid(f), - FieldseekerPoolMods.RandomCreatedUser(f), - FieldseekerPoolMods.RandomCreatedDate(f), - FieldseekerPoolMods.RandomLastEditedUser(f), - FieldseekerPoolMods.RandomLastEditedDate(f), - FieldseekerPoolMods.RandomLab(f), - FieldseekerPoolMods.RandomPoolyear(f), - FieldseekerPoolMods.RandomGatewaysync(f), - FieldseekerPoolMods.RandomVectorsurvcollectionid(f), - FieldseekerPoolMods.RandomVectorsurvpoolid(f), - FieldseekerPoolMods.RandomVectorsurvtrapdataid(f), - FieldseekerPoolMods.RandomCreationdate(f), - FieldseekerPoolMods.RandomCreator(f), - FieldseekerPoolMods.RandomEditdate(f), - FieldseekerPoolMods.RandomEditor(f), - FieldseekerPoolMods.RandomGeometry(f), - FieldseekerPoolMods.RandomGeospatial(f), - FieldseekerPoolMods.RandomVersion(f), - FieldseekerPoolMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerPoolMods) Objectid(val int64) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) ObjectidFunc(f func() int64) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetObjectid() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomObjectid(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPoolMods) TrapdataID(val null.Val[uuid.UUID]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.TrapdataID = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) TrapdataIDFunc(f func() null.Val[uuid.UUID]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.TrapdataID = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetTrapdataID() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomTrapdataID(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.TrapdataID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomTrapdataIDNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.TrapdataID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPoolMods) Datesent(val null.Val[time.Time]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Datesent = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) DatesentFunc(f func() null.Val[time.Time]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Datesent = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetDatesent() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomDatesent(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Datesent = 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 fieldseekerPoolMods) RandomDatesentNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Datesent = 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 fieldseekerPoolMods) Survtech(val null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Survtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) SurvtechFunc(f func() null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Survtech = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetSurvtech() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomSurvtech(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Survtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSurvtechNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Survtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPoolMods) Datetested(val null.Val[time.Time]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Datetested = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) DatetestedFunc(f func() null.Val[time.Time]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Datetested = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetDatetested() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomDatetested(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Datetested = 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 fieldseekerPoolMods) RandomDatetestedNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Datetested = 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 fieldseekerPoolMods) Testtech(val null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Testtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) TesttechFunc(f func() null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Testtech = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetTesttech() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomTesttech(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Testtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomTesttechNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Testtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPoolMods) Comments(val null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) CommentsFunc(f func() null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetComments() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomComments(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCommentsNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPoolMods) Sampleid(val null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Sampleid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) SampleidFunc(f func() null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Sampleid = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetSampleid() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomSampleid(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Sampleid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSampleidNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Sampleid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPoolMods) Processed(val null.Val[int16]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Processed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) ProcessedFunc(f func() null.Val[int16]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Processed = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetProcessed() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomProcessed(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomProcessedNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) LabID(val null.Val[uuid.UUID]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.LabID = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) LabIDFunc(f func() null.Val[uuid.UUID]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.LabID = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetLabID() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomLabID(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.LabID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLabIDNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.LabID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPoolMods) Testmethod(val null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Testmethod = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) TestmethodFunc(f func() null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Testmethod = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetTestmethod() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomTestmethod(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Testmethod = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "100") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomTestmethodNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Testmethod = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "100") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPoolMods) Diseasetested(val null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Diseasetested = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) DiseasetestedFunc(f func() null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Diseasetested = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetDiseasetested() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomDiseasetested(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Diseasetested = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "100") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomDiseasetestedNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Diseasetested = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "100") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPoolMods) Diseasepos(val null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Diseasepos = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) DiseaseposFunc(f func() null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Diseasepos = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetDiseasepos() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomDiseasepos(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Diseasepos = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "100") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomDiseaseposNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Diseasepos = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "100") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPoolMods) Globalid(val uuid.UUID) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) GlobalidFunc(f func() uuid.UUID) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetGlobalid() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomGlobalid(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPoolMods) CreatedUser(val null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetCreatedUser() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomCreatedUser(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPoolMods) CreatedDate(val null.Val[time.Time]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetCreatedDate() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomCreatedDate(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.CreatedDate = 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 fieldseekerPoolMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.CreatedDate = 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 fieldseekerPoolMods) LastEditedUser(val null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetLastEditedUser() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomLastEditedUser(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPoolMods) LastEditedDate(val null.Val[time.Time]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetLastEditedDate() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomLastEditedDate(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.LastEditedDate = 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 fieldseekerPoolMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.LastEditedDate = 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 fieldseekerPoolMods) Lab(val null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Lab = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) LabFunc(f func() null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Lab = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetLab() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomLab(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Lab = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLabNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Lab = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPoolMods) Poolyear(val null.Val[int16]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Poolyear = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) PoolyearFunc(f func() null.Val[int16]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Poolyear = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetPoolyear() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomPoolyear(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomPoolyearNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) Gatewaysync(val null.Val[int16]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Gatewaysync = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) GatewaysyncFunc(f func() null.Val[int16]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Gatewaysync = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetGatewaysync() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomGatewaysync(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomGatewaysyncNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) Vectorsurvcollectionid(val null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Vectorsurvcollectionid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) VectorsurvcollectionidFunc(f func() null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Vectorsurvcollectionid = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetVectorsurvcollectionid() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomVectorsurvcollectionid(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Vectorsurvcollectionid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomVectorsurvcollectionidNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Vectorsurvcollectionid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPoolMods) Vectorsurvpoolid(val null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Vectorsurvpoolid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) VectorsurvpoolidFunc(f func() null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Vectorsurvpoolid = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetVectorsurvpoolid() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomVectorsurvpoolid(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Vectorsurvpoolid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomVectorsurvpoolidNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Vectorsurvpoolid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPoolMods) Vectorsurvtrapdataid(val null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Vectorsurvtrapdataid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) VectorsurvtrapdataidFunc(f func() null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Vectorsurvtrapdataid = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetVectorsurvtrapdataid() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomVectorsurvtrapdataid(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Vectorsurvtrapdataid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomVectorsurvtrapdataidNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Vectorsurvtrapdataid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPoolMods) Creationdate(val null.Val[time.Time]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetCreationdate() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomCreationdate(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Creationdate = 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 fieldseekerPoolMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Creationdate = 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 fieldseekerPoolMods) Creator(val null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) CreatorFunc(f func() null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetCreator() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomCreator(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPoolMods) Editdate(val null.Val[time.Time]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetEditdate() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomEditdate(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Editdate = 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 fieldseekerPoolMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Editdate = 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 fieldseekerPoolMods) Editor(val null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) EditorFunc(f func() null.Val[string]) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetEditor() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomEditor(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPoolMods) VersionFunc(f func() int32) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerPoolMods) UnsetVersion() FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - 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 fieldseekerPoolMods) RandomVersion(f *faker.Faker) FieldseekerPoolMod { - return FieldseekerPoolModFunc(func(_ context.Context, o *FieldseekerPoolTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index 624fe189..00000000 --- a/db/factory/fieldseeker.pooldetail.bob.go +++ /dev/null @@ -1,1309 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerPooldetailMod interface { - Apply(context.Context, *FieldseekerPooldetailTemplate) -} - -type FieldseekerPooldetailModFunc func(context.Context, *FieldseekerPooldetailTemplate) - -func (f FieldseekerPooldetailModFunc) Apply(ctx context.Context, n *FieldseekerPooldetailTemplate) { - f(ctx, n) -} - -type FieldseekerPooldetailModSlice []FieldseekerPooldetailMod - -func (mods FieldseekerPooldetailModSlice) Apply(ctx context.Context, n *FieldseekerPooldetailTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerPooldetailTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerPooldetailTemplate struct { - Objectid func() int64 - TrapdataID func() null.Val[uuid.UUID] - PoolID func() null.Val[uuid.UUID] - Species func() null.Val[string] - Females func() null.Val[int16] - Globalid func() uuid.UUID - CreatedUser func() null.Val[string] - CreatedDate func() null.Val[time.Time] - LastEditedUser func() null.Val[string] - LastEditedDate func() null.Val[time.Time] - 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 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerPooldetailTemplate) BuildSetter() *models.FieldseekerPooldetailSetter { - m := &models.FieldseekerPooldetailSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.TrapdataID != nil { - val := o.TrapdataID() - m.TrapdataID = omitnull.FromNull(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.Females != nil { - val := o.Females() - m.Females = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = 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.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 -} - -// BuildManySetter returns an []*models.FieldseekerPooldetailSetter -// this does nothing with the relationship templates -func (o FieldseekerPooldetailTemplate) BuildManySetter(number int) []*models.FieldseekerPooldetailSetter { - m := make([]*models.FieldseekerPooldetailSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerPooldetail -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerPooldetailTemplate.Create -func (o FieldseekerPooldetailTemplate) Build() *models.FieldseekerPooldetail { - m := &models.FieldseekerPooldetail{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.TrapdataID != nil { - m.TrapdataID = o.TrapdataID() - } - if o.PoolID != nil { - m.PoolID = o.PoolID() - } - if o.Species != nil { - m.Species = o.Species() - } - if o.Females != nil { - m.Females = o.Females() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - 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.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) - - return m -} - -// BuildMany returns an models.FieldseekerPooldetailSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerPooldetailTemplate.CreateMany -func (o FieldseekerPooldetailTemplate) BuildMany(number int) models.FieldseekerPooldetailSlice { - m := make(models.FieldseekerPooldetailSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerPooldetail(m *models.FieldseekerPooldetailSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerPooldetailTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerPooldetail) error { - var err error - - return err -} - -// Create builds a fieldseekerPooldetail and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerPooldetailTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerPooldetail, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerPooldetail and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerPooldetailTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerPooldetail { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerPooldetail 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 *FieldseekerPooldetailTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerPooldetail { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerPooldetails and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerPooldetailTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerPooldetailSlice, error) { - var err error - m := make(models.FieldseekerPooldetailSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerPooldetails and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerPooldetailTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerPooldetailSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerPooldetails 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 FieldseekerPooldetailTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerPooldetailSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerPooldetail has methods that act as mods for the FieldseekerPooldetailTemplate -var FieldseekerPooldetailMods fieldseekerPooldetailMods - -type fieldseekerPooldetailMods struct{} - -func (m fieldseekerPooldetailMods) RandomizeAllColumns(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModSlice{ - FieldseekerPooldetailMods.RandomObjectid(f), - FieldseekerPooldetailMods.RandomTrapdataID(f), - FieldseekerPooldetailMods.RandomPoolID(f), - FieldseekerPooldetailMods.RandomSpecies(f), - FieldseekerPooldetailMods.RandomFemales(f), - FieldseekerPooldetailMods.RandomGlobalid(f), - FieldseekerPooldetailMods.RandomCreatedUser(f), - FieldseekerPooldetailMods.RandomCreatedDate(f), - FieldseekerPooldetailMods.RandomLastEditedUser(f), - FieldseekerPooldetailMods.RandomLastEditedDate(f), - FieldseekerPooldetailMods.RandomCreationdate(f), - FieldseekerPooldetailMods.RandomCreator(f), - FieldseekerPooldetailMods.RandomEditdate(f), - FieldseekerPooldetailMods.RandomEditor(f), - FieldseekerPooldetailMods.RandomGeometry(f), - FieldseekerPooldetailMods.RandomGeospatial(f), - FieldseekerPooldetailMods.RandomVersion(f), - FieldseekerPooldetailMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerPooldetailMods) Objectid(val int64) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPooldetailMods) ObjectidFunc(f func() int64) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerPooldetailMods) UnsetObjectid() FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - 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 fieldseekerPooldetailMods) RandomObjectid(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPooldetailMods) TrapdataID(val null.Val[uuid.UUID]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.TrapdataID = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPooldetailMods) TrapdataIDFunc(f func() null.Val[uuid.UUID]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.TrapdataID = f - }) -} - -// Clear any values for the column -func (m fieldseekerPooldetailMods) UnsetTrapdataID() FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - 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 fieldseekerPooldetailMods) RandomTrapdataID(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.TrapdataID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomTrapdataIDNotNull(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.TrapdataID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPooldetailMods) PoolID(val null.Val[uuid.UUID]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.PoolID = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPooldetailMods) PoolIDFunc(f func() null.Val[uuid.UUID]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.PoolID = f - }) -} - -// Clear any values for the column -func (m fieldseekerPooldetailMods) UnsetPoolID() FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - 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 fieldseekerPooldetailMods) RandomPoolID(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.PoolID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomPoolIDNotNull(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.PoolID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPooldetailMods) Species(val null.Val[string]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Species = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPooldetailMods) SpeciesFunc(f func() null.Val[string]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Species = f - }) -} - -// Clear any values for the column -func (m fieldseekerPooldetailMods) UnsetSpecies() FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - 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 fieldseekerPooldetailMods) RandomSpecies(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Species = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSpeciesNotNull(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Species = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPooldetailMods) Females(val null.Val[int16]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Females = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPooldetailMods) FemalesFunc(f func() null.Val[int16]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Females = f - }) -} - -// Clear any values for the column -func (m fieldseekerPooldetailMods) UnsetFemales() FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - 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 fieldseekerPooldetailMods) RandomFemales(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - 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 fieldseekerPooldetailMods) RandomFemalesNotNull(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - 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 fieldseekerPooldetailMods) Globalid(val uuid.UUID) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPooldetailMods) GlobalidFunc(f func() uuid.UUID) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerPooldetailMods) UnsetGlobalid() FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - 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 fieldseekerPooldetailMods) RandomGlobalid(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPooldetailMods) CreatedUser(val null.Val[string]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPooldetailMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerPooldetailMods) UnsetCreatedUser() FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - 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 fieldseekerPooldetailMods) RandomCreatedUser(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPooldetailMods) CreatedDate(val null.Val[time.Time]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPooldetailMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerPooldetailMods) UnsetCreatedDate() FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - 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 fieldseekerPooldetailMods) RandomCreatedDate(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.CreatedDate = 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 fieldseekerPooldetailMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.CreatedDate = 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 fieldseekerPooldetailMods) LastEditedUser(val null.Val[string]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPooldetailMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerPooldetailMods) UnsetLastEditedUser() FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - 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 fieldseekerPooldetailMods) RandomLastEditedUser(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPooldetailMods) LastEditedDate(val null.Val[time.Time]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPooldetailMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerPooldetailMods) UnsetLastEditedDate() FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - 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 fieldseekerPooldetailMods) RandomLastEditedDate(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.LastEditedDate = 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 fieldseekerPooldetailMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.LastEditedDate = 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 fieldseekerPooldetailMods) Creationdate(val null.Val[time.Time]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPooldetailMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerPooldetailMods) UnsetCreationdate() FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - 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 fieldseekerPooldetailMods) RandomCreationdate(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Creationdate = 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 fieldseekerPooldetailMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Creationdate = 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 fieldseekerPooldetailMods) Creator(val null.Val[string]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPooldetailMods) CreatorFunc(f func() null.Val[string]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerPooldetailMods) UnsetCreator() FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - 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 fieldseekerPooldetailMods) RandomCreator(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerPooldetailMods) Editdate(val null.Val[time.Time]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPooldetailMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerPooldetailMods) UnsetEditdate() FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - 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 fieldseekerPooldetailMods) RandomEditdate(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Editdate = 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 fieldseekerPooldetailMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Editdate = 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 fieldseekerPooldetailMods) Editor(val null.Val[string]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPooldetailMods) EditorFunc(f func() null.Val[string]) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerPooldetailMods) UnsetEditor() FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - 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 fieldseekerPooldetailMods) RandomEditor(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerPooldetailMods) VersionFunc(f func() int32) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerPooldetailMods) UnsetVersion() FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - 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 fieldseekerPooldetailMods) RandomVersion(f *faker.Faker) FieldseekerPooldetailMod { - return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index 05ce4a6c..00000000 --- a/db/factory/fieldseeker.proposedtreatmentarea.bob.go +++ /dev/null @@ -1,2487 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerProposedtreatmentareaMod interface { - Apply(context.Context, *FieldseekerProposedtreatmentareaTemplate) -} - -type FieldseekerProposedtreatmentareaModFunc func(context.Context, *FieldseekerProposedtreatmentareaTemplate) - -func (f FieldseekerProposedtreatmentareaModFunc) Apply(ctx context.Context, n *FieldseekerProposedtreatmentareaTemplate) { - f(ctx, n) -} - -type FieldseekerProposedtreatmentareaModSlice []FieldseekerProposedtreatmentareaMod - -func (mods FieldseekerProposedtreatmentareaModSlice) Apply(ctx context.Context, n *FieldseekerProposedtreatmentareaTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerProposedtreatmentareaTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerProposedtreatmentareaTemplate struct { - Objectid func() int64 - Method func() null.Val[string] - Comments func() null.Val[string] - Zone func() null.Val[string] - 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[int16] - Issprayroute func() null.Val[int16] - Name func() null.Val[string] - Acres func() null.Val[float64] - Globalid func() uuid.UUID - Exported func() null.Val[int16] - Targetproduct func() null.Val[string] - Targetapprate func() null.Val[float64] - Hectares func() null.Val[float64] - Lasttreatactivity func() null.Val[string] - Lasttreatdate func() null.Val[time.Time] - Lasttreatproduct func() null.Val[string] - Lasttreatqty func() null.Val[float64] - Lasttreatqtyunit func() null.Val[string] - Priority func() null.Val[string] - Duedate func() null.Val[time.Time] - 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] - 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 { - mod.Apply(ctx, o) - } -} - -// 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 -// this does nothing with the relationship templates -func (o FieldseekerProposedtreatmentareaTemplate) BuildSetter() *models.FieldseekerProposedtreatmentareaSetter { - m := &models.FieldseekerProposedtreatmentareaSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Method != nil { - val := o.Method() - m.Method = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = 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.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.Completeddate != nil { - val := o.Completeddate() - m.Completeddate = omitnull.FromNull(val) - } - if o.Completedby != nil { - val := o.Completedby() - m.Completedby = omitnull.FromNull(val) - } - if o.Completed != nil { - val := o.Completed() - m.Completed = omitnull.FromNull(val) - } - if o.Issprayroute != nil { - val := o.Issprayroute() - m.Issprayroute = omitnull.FromNull(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Acres != nil { - val := o.Acres() - m.Acres = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Exported != nil { - val := o.Exported() - m.Exported = omitnull.FromNull(val) - } - if o.Targetproduct != nil { - val := o.Targetproduct() - m.Targetproduct = omitnull.FromNull(val) - } - if o.Targetapprate != nil { - val := o.Targetapprate() - m.Targetapprate = omitnull.FromNull(val) - } - if o.Hectares != nil { - val := o.Hectares() - m.Hectares = 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.Priority != nil { - val := o.Priority() - m.Priority = omitnull.FromNull(val) - } - if o.Duedate != nil { - val := o.Duedate() - m.Duedate = 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.Targetspecies != nil { - val := o.Targetspecies() - m.Targetspecies = 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.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 -} - -// BuildManySetter returns an []*models.FieldseekerProposedtreatmentareaSetter -// this does nothing with the relationship templates -func (o FieldseekerProposedtreatmentareaTemplate) BuildManySetter(number int) []*models.FieldseekerProposedtreatmentareaSetter { - m := make([]*models.FieldseekerProposedtreatmentareaSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerProposedtreatmentarea -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerProposedtreatmentareaTemplate.Create -func (o FieldseekerProposedtreatmentareaTemplate) Build() *models.FieldseekerProposedtreatmentarea { - m := &models.FieldseekerProposedtreatmentarea{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Method != nil { - m.Method = o.Method() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - 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.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Completeddate != nil { - m.Completeddate = o.Completeddate() - } - if o.Completedby != nil { - m.Completedby = o.Completedby() - } - if o.Completed != nil { - m.Completed = o.Completed() - } - if o.Issprayroute != nil { - m.Issprayroute = o.Issprayroute() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Acres != nil { - m.Acres = o.Acres() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Exported != nil { - m.Exported = o.Exported() - } - if o.Targetproduct != nil { - m.Targetproduct = o.Targetproduct() - } - if o.Targetapprate != nil { - m.Targetapprate = o.Targetapprate() - } - if o.Hectares != nil { - m.Hectares = o.Hectares() - } - 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.Priority != nil { - m.Priority = o.Priority() - } - if o.Duedate != nil { - m.Duedate = o.Duedate() - } - 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.Targetspecies != nil { - m.Targetspecies = o.Targetspecies() - } - if o.ShapeArea != nil { - m.ShapeArea = o.ShapeArea() - } - 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) - - return m -} - -// BuildMany returns an models.FieldseekerProposedtreatmentareaSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerProposedtreatmentareaTemplate.CreateMany -func (o FieldseekerProposedtreatmentareaTemplate) BuildMany(number int) models.FieldseekerProposedtreatmentareaSlice { - m := make(models.FieldseekerProposedtreatmentareaSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerProposedtreatmentarea(m *models.FieldseekerProposedtreatmentareaSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerProposedtreatmentareaTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerProposedtreatmentarea) error { - var err error - - return err -} - -// Create builds a fieldseekerProposedtreatmentarea and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerProposedtreatmentareaTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerProposedtreatmentarea, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerProposedtreatmentarea and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerProposedtreatmentareaTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerProposedtreatmentarea { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerProposedtreatmentarea 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 *FieldseekerProposedtreatmentareaTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerProposedtreatmentarea { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerProposedtreatmentareas and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerProposedtreatmentareaTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerProposedtreatmentareaSlice, error) { - var err error - m := make(models.FieldseekerProposedtreatmentareaSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerProposedtreatmentareas and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerProposedtreatmentareaTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerProposedtreatmentareaSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerProposedtreatmentareas 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 FieldseekerProposedtreatmentareaTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerProposedtreatmentareaSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerProposedtreatmentarea has methods that act as mods for the FieldseekerProposedtreatmentareaTemplate -var FieldseekerProposedtreatmentareaMods fieldseekerProposedtreatmentareaMods - -type fieldseekerProposedtreatmentareaMods struct{} - -func (m fieldseekerProposedtreatmentareaMods) RandomizeAllColumns(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModSlice{ - FieldseekerProposedtreatmentareaMods.RandomObjectid(f), - FieldseekerProposedtreatmentareaMods.RandomMethod(f), - FieldseekerProposedtreatmentareaMods.RandomComments(f), - FieldseekerProposedtreatmentareaMods.RandomZone(f), - FieldseekerProposedtreatmentareaMods.RandomReviewed(f), - FieldseekerProposedtreatmentareaMods.RandomReviewedby(f), - FieldseekerProposedtreatmentareaMods.RandomRevieweddate(f), - FieldseekerProposedtreatmentareaMods.RandomZone2(f), - FieldseekerProposedtreatmentareaMods.RandomCompleteddate(f), - FieldseekerProposedtreatmentareaMods.RandomCompletedby(f), - FieldseekerProposedtreatmentareaMods.RandomCompleted(f), - FieldseekerProposedtreatmentareaMods.RandomIssprayroute(f), - FieldseekerProposedtreatmentareaMods.RandomName(f), - FieldseekerProposedtreatmentareaMods.RandomAcres(f), - FieldseekerProposedtreatmentareaMods.RandomGlobalid(f), - FieldseekerProposedtreatmentareaMods.RandomExported(f), - FieldseekerProposedtreatmentareaMods.RandomTargetproduct(f), - FieldseekerProposedtreatmentareaMods.RandomTargetapprate(f), - FieldseekerProposedtreatmentareaMods.RandomHectares(f), - FieldseekerProposedtreatmentareaMods.RandomLasttreatactivity(f), - FieldseekerProposedtreatmentareaMods.RandomLasttreatdate(f), - FieldseekerProposedtreatmentareaMods.RandomLasttreatproduct(f), - FieldseekerProposedtreatmentareaMods.RandomLasttreatqty(f), - FieldseekerProposedtreatmentareaMods.RandomLasttreatqtyunit(f), - FieldseekerProposedtreatmentareaMods.RandomPriority(f), - FieldseekerProposedtreatmentareaMods.RandomDuedate(f), - FieldseekerProposedtreatmentareaMods.RandomCreationdate(f), - FieldseekerProposedtreatmentareaMods.RandomCreator(f), - FieldseekerProposedtreatmentareaMods.RandomEditdate(f), - FieldseekerProposedtreatmentareaMods.RandomEditor(f), - FieldseekerProposedtreatmentareaMods.RandomTargetspecies(f), - FieldseekerProposedtreatmentareaMods.RandomShapeArea(f), - FieldseekerProposedtreatmentareaMods.RandomShapeLength(f), - FieldseekerProposedtreatmentareaMods.RandomGeometry(f), - FieldseekerProposedtreatmentareaMods.RandomGeospatial(f), - FieldseekerProposedtreatmentareaMods.RandomVersion(f), - FieldseekerProposedtreatmentareaMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Objectid(val int64) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) ObjectidFunc(f func() int64) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetObjectid() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomObjectid(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Method(val null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Method = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) MethodFunc(f func() null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Method = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetMethod() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomMethod(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Method = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomMethodNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Method = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Comments(val null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) CommentsFunc(f func() null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetComments() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomComments(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCommentsNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Zone(val null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) ZoneFunc(f func() null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetZone() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomZone(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZoneNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Reviewed(val null.Val[int16]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Reviewed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) ReviewedFunc(f func() null.Val[int16]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Reviewed = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetReviewed() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomReviewed(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomReviewedNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) Reviewedby(val null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Reviewedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) ReviewedbyFunc(f func() null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Reviewedby = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetReviewedby() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomReviewedby(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Reviewedby = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReviewedbyNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Reviewedby = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Revieweddate(val null.Val[time.Time]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Revieweddate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) RevieweddateFunc(f func() null.Val[time.Time]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Revieweddate = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetRevieweddate() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomRevieweddate(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Revieweddate = 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 fieldseekerProposedtreatmentareaMods) RandomRevieweddateNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Revieweddate = 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 fieldseekerProposedtreatmentareaMods) Zone2(val null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) Zone2Func(f func() null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetZone2() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomZone2(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZone2NotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Completeddate(val null.Val[time.Time]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Completeddate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) CompleteddateFunc(f func() null.Val[time.Time]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Completeddate = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetCompleteddate() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomCompleteddate(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Completeddate = 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 fieldseekerProposedtreatmentareaMods) RandomCompleteddateNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Completeddate = 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 fieldseekerProposedtreatmentareaMods) Completedby(val null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Completedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) CompletedbyFunc(f func() null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Completedby = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetCompletedby() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomCompletedby(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Completedby = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCompletedbyNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Completedby = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Completed(val null.Val[int16]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Completed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) CompletedFunc(f func() null.Val[int16]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Completed = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetCompleted() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomCompleted(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomCompletedNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) Issprayroute(val null.Val[int16]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Issprayroute = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) IssprayrouteFunc(f func() null.Val[int16]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Issprayroute = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetIssprayroute() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomIssprayroute(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomIssprayrouteNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) Name(val null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) NameFunc(f func() null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetName() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomName(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Name = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomNameNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Name = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Acres(val null.Val[float64]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Acres = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) AcresFunc(f func() null.Val[float64]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Acres = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetAcres() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomAcres(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomAcresNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) Globalid(val uuid.UUID) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) GlobalidFunc(f func() uuid.UUID) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetGlobalid() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomGlobalid(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Exported(val null.Val[int16]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Exported = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) ExportedFunc(f func() null.Val[int16]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Exported = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetExported() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomExported(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomExportedNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) Targetproduct(val null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Targetproduct = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) TargetproductFunc(f func() null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Targetproduct = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetTargetproduct() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomTargetproduct(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Targetproduct = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomTargetproductNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Targetproduct = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Targetapprate(val null.Val[float64]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Targetapprate = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) TargetapprateFunc(f func() null.Val[float64]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Targetapprate = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetTargetapprate() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomTargetapprate(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomTargetapprateNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) Hectares(val null.Val[float64]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Hectares = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) HectaresFunc(f func() null.Val[float64]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Hectares = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetHectares() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomHectares(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomHectaresNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) Lasttreatactivity(val null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Lasttreatactivity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) LasttreatactivityFunc(f func() null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Lasttreatactivity = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetLasttreatactivity() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomLasttreatactivity(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Lasttreatactivity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLasttreatactivityNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Lasttreatactivity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Lasttreatdate(val null.Val[time.Time]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Lasttreatdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) LasttreatdateFunc(f func() null.Val[time.Time]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Lasttreatdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetLasttreatdate() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomLasttreatdate(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Lasttreatdate = 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 fieldseekerProposedtreatmentareaMods) RandomLasttreatdateNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Lasttreatdate = 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 fieldseekerProposedtreatmentareaMods) Lasttreatproduct(val null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Lasttreatproduct = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) LasttreatproductFunc(f func() null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Lasttreatproduct = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetLasttreatproduct() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomLasttreatproduct(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Lasttreatproduct = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLasttreatproductNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Lasttreatproduct = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Lasttreatqty(val null.Val[float64]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Lasttreatqty = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) LasttreatqtyFunc(f func() null.Val[float64]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Lasttreatqty = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetLasttreatqty() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomLasttreatqty(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomLasttreatqtyNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) Lasttreatqtyunit(val null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Lasttreatqtyunit = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) LasttreatqtyunitFunc(f func() null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Lasttreatqtyunit = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetLasttreatqtyunit() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomLasttreatqtyunit(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Lasttreatqtyunit = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "10") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLasttreatqtyunitNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Lasttreatqtyunit = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "10") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Priority(val null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) PriorityFunc(f func() null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetPriority() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomPriority(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Priority = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomPriorityNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Priority = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Duedate(val null.Val[time.Time]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Duedate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) DuedateFunc(f func() null.Val[time.Time]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Duedate = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetDuedate() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomDuedate(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Duedate = 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 fieldseekerProposedtreatmentareaMods) RandomDuedateNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Duedate = 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 fieldseekerProposedtreatmentareaMods) Creationdate(val null.Val[time.Time]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetCreationdate() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomCreationdate(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Creationdate = 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 fieldseekerProposedtreatmentareaMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Creationdate = 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 fieldseekerProposedtreatmentareaMods) Creator(val null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) CreatorFunc(f func() null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetCreator() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomCreator(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Editdate(val null.Val[time.Time]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetEditdate() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomEditdate(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Editdate = 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 fieldseekerProposedtreatmentareaMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Editdate = 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 fieldseekerProposedtreatmentareaMods) Editor(val null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) EditorFunc(f func() null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetEditor() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomEditor(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) Targetspecies(val null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Targetspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) TargetspeciesFunc(f func() null.Val[string]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Targetspecies = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetTargetspecies() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomTargetspecies(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Targetspecies = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomTargetspeciesNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Targetspecies = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerProposedtreatmentareaMods) ShapeArea(val null.Val[float64]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.ShapeArea = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) ShapeAreaFunc(f func() null.Val[float64]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.ShapeArea = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetShapeArea() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomShapeArea(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomShapeAreaNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) ShapeLength(val null.Val[float64]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.ShapeLength = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) ShapeLengthFunc(f func() null.Val[float64]) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.ShapeLength = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetShapeLength() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomShapeLength(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomShapeLengthNotNull(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerProposedtreatmentareaMods) VersionFunc(f func() int32) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerProposedtreatmentareaMods) UnsetVersion() FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - 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 fieldseekerProposedtreatmentareaMods) RandomVersion(f *faker.Faker) FieldseekerProposedtreatmentareaMod { - return FieldseekerProposedtreatmentareaModFunc(func(_ context.Context, o *FieldseekerProposedtreatmentareaTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index b99924d0..00000000 --- a/db/factory/fieldseeker.qamosquitoinspection.bob.go +++ /dev/null @@ -1,4285 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerQamosquitoinspectionMod interface { - Apply(context.Context, *FieldseekerQamosquitoinspectionTemplate) -} - -type FieldseekerQamosquitoinspectionModFunc func(context.Context, *FieldseekerQamosquitoinspectionTemplate) - -func (f FieldseekerQamosquitoinspectionModFunc) Apply(ctx context.Context, n *FieldseekerQamosquitoinspectionTemplate) { - f(ctx, n) -} - -type FieldseekerQamosquitoinspectionModSlice []FieldseekerQamosquitoinspectionMod - -func (mods FieldseekerQamosquitoinspectionModSlice) Apply(ctx context.Context, n *FieldseekerQamosquitoinspectionTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerQamosquitoinspectionTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerQamosquitoinspectionTemplate struct { - Objectid func() int64 - Posdips func() null.Val[int16] - 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] - Globalid func() uuid.UUID - Startdatetime func() null.Val[time.Time] - Enddatetime func() null.Val[time.Time] - Winddir 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] - Zone func() null.Val[string] - Recordstatus func() null.Val[int16] - Zone2 func() null.Val[string] - LR func() null.Val[int16] - Negdips func() null.Val[int16] - Totalacres func() null.Val[float64] - Acresbreeding func() null.Val[float64] - 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[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[string] - Watermovement2percent func() null.Val[int16] - 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] - CreatedUser func() null.Val[string] - CreatedDate func() null.Val[time.Time] - LastEditedUser func() null.Val[string] - LastEditedDate func() null.Val[time.Time] - Fieldtech 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 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 { - mod.Apply(ctx, o) - } -} - -// 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 -// this does nothing with the relationship templates -func (o FieldseekerQamosquitoinspectionTemplate) BuildSetter() *models.FieldseekerQamosquitoinspectionSetter { - m := &models.FieldseekerQamosquitoinspectionSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Posdips != nil { - val := o.Posdips() - m.Posdips = omitnull.FromNull(val) - } - if o.Actiontaken != nil { - val := o.Actiontaken() - m.Actiontaken = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Avetemp != nil { - val := o.Avetemp() - m.Avetemp = omitnull.FromNull(val) - } - if o.Windspeed != nil { - val := o.Windspeed() - m.Windspeed = omitnull.FromNull(val) - } - if o.Raingauge != nil { - val := o.Raingauge() - m.Raingauge = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Startdatetime != nil { - val := o.Startdatetime() - m.Startdatetime = omitnull.FromNull(val) - } - if o.Enddatetime != nil { - val := o.Enddatetime() - m.Enddatetime = omitnull.FromNull(val) - } - if o.Winddir != nil { - val := o.Winddir() - m.Winddir = 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.Locationname != nil { - val := o.Locationname() - m.Locationname = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Recordstatus != nil { - val := o.Recordstatus() - m.Recordstatus = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.LR != nil { - val := o.LR() - m.LR = omitnull.FromNull(val) - } - if o.Negdips != nil { - val := o.Negdips() - m.Negdips = omitnull.FromNull(val) - } - if o.Totalacres != nil { - val := o.Totalacres() - m.Totalacres = omitnull.FromNull(val) - } - if o.Acresbreeding != nil { - val := o.Acresbreeding() - m.Acresbreeding = omitnull.FromNull(val) - } - if o.Fish != nil { - val := o.Fish() - m.Fish = omitnull.FromNull(val) - } - if o.Sitetype != nil { - val := o.Sitetype() - m.Sitetype = omitnull.FromNull(val) - } - if o.Breedingpotential != nil { - val := o.Breedingpotential() - m.Breedingpotential = omitnull.FromNull(val) - } - if o.Movingwater != nil { - val := o.Movingwater() - m.Movingwater = omitnull.FromNull(val) - } - if o.Nowaterever != nil { - val := o.Nowaterever() - m.Nowaterever = omitnull.FromNull(val) - } - if o.Mosquitohabitat != nil { - val := o.Mosquitohabitat() - m.Mosquitohabitat = 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.Potential != nil { - val := o.Potential() - m.Potential = omitnull.FromNull(val) - } - if o.Larvaepresent != nil { - val := o.Larvaepresent() - m.Larvaepresent = 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.Larvaereason != nil { - val := o.Larvaereason() - m.Larvaereason = omitnull.FromNull(val) - } - if o.Aquaticorganisms != nil { - val := o.Aquaticorganisms() - m.Aquaticorganisms = omitnull.FromNull(val) - } - if o.Vegetation != nil { - val := o.Vegetation() - m.Vegetation = omitnull.FromNull(val) - } - if o.Sourcereduction != nil { - val := o.Sourcereduction() - m.Sourcereduction = omitnull.FromNull(val) - } - if o.Waterpresent != nil { - val := o.Waterpresent() - m.Waterpresent = 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.Soilconditions != nil { - val := o.Soilconditions() - m.Soilconditions = omitnull.FromNull(val) - } - if o.Waterduration != nil { - val := o.Waterduration() - m.Waterduration = omitnull.FromNull(val) - } - if o.Watersource != nil { - val := o.Watersource() - m.Watersource = omitnull.FromNull(val) - } - if o.Waterconditions != nil { - val := o.Waterconditions() - m.Waterconditions = omitnull.FromNull(val) - } - if o.Adultactivity != nil { - val := o.Adultactivity() - m.Adultactivity = omitnull.FromNull(val) - } - if o.Linelocid != nil { - val := o.Linelocid() - m.Linelocid = 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.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.Fieldtech != nil { - val := o.Fieldtech() - m.Fieldtech = 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.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 -} - -// BuildManySetter returns an []*models.FieldseekerQamosquitoinspectionSetter -// this does nothing with the relationship templates -func (o FieldseekerQamosquitoinspectionTemplate) BuildManySetter(number int) []*models.FieldseekerQamosquitoinspectionSetter { - m := make([]*models.FieldseekerQamosquitoinspectionSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerQamosquitoinspection -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerQamosquitoinspectionTemplate.Create -func (o FieldseekerQamosquitoinspectionTemplate) Build() *models.FieldseekerQamosquitoinspection { - m := &models.FieldseekerQamosquitoinspection{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Posdips != nil { - m.Posdips = o.Posdips() - } - if o.Actiontaken != nil { - m.Actiontaken = o.Actiontaken() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Avetemp != nil { - m.Avetemp = o.Avetemp() - } - if o.Windspeed != nil { - m.Windspeed = o.Windspeed() - } - if o.Raingauge != nil { - m.Raingauge = o.Raingauge() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Startdatetime != nil { - m.Startdatetime = o.Startdatetime() - } - if o.Enddatetime != nil { - m.Enddatetime = o.Enddatetime() - } - if o.Winddir != nil { - m.Winddir = o.Winddir() - } - 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.Locationname != nil { - m.Locationname = o.Locationname() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Recordstatus != nil { - m.Recordstatus = o.Recordstatus() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.LR != nil { - m.LR = o.LR() - } - if o.Negdips != nil { - m.Negdips = o.Negdips() - } - if o.Totalacres != nil { - m.Totalacres = o.Totalacres() - } - if o.Acresbreeding != nil { - m.Acresbreeding = o.Acresbreeding() - } - if o.Fish != nil { - m.Fish = o.Fish() - } - if o.Sitetype != nil { - m.Sitetype = o.Sitetype() - } - if o.Breedingpotential != nil { - m.Breedingpotential = o.Breedingpotential() - } - if o.Movingwater != nil { - m.Movingwater = o.Movingwater() - } - if o.Nowaterever != nil { - m.Nowaterever = o.Nowaterever() - } - if o.Mosquitohabitat != nil { - m.Mosquitohabitat = o.Mosquitohabitat() - } - 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.Potential != nil { - m.Potential = o.Potential() - } - if o.Larvaepresent != nil { - m.Larvaepresent = o.Larvaepresent() - } - if o.Larvaeinsidetreatedarea != nil { - m.Larvaeinsidetreatedarea = o.Larvaeinsidetreatedarea() - } - if o.Larvaeoutsidetreatedarea != nil { - m.Larvaeoutsidetreatedarea = o.Larvaeoutsidetreatedarea() - } - if o.Larvaereason != nil { - m.Larvaereason = o.Larvaereason() - } - if o.Aquaticorganisms != nil { - m.Aquaticorganisms = o.Aquaticorganisms() - } - if o.Vegetation != nil { - m.Vegetation = o.Vegetation() - } - if o.Sourcereduction != nil { - m.Sourcereduction = o.Sourcereduction() - } - if o.Waterpresent != nil { - m.Waterpresent = o.Waterpresent() - } - 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.Soilconditions != nil { - m.Soilconditions = o.Soilconditions() - } - if o.Waterduration != nil { - m.Waterduration = o.Waterduration() - } - if o.Watersource != nil { - m.Watersource = o.Watersource() - } - if o.Waterconditions != nil { - m.Waterconditions = o.Waterconditions() - } - if o.Adultactivity != nil { - m.Adultactivity = o.Adultactivity() - } - if o.Linelocid != nil { - m.Linelocid = o.Linelocid() - } - if o.Pointlocid != nil { - m.Pointlocid = o.Pointlocid() - } - if o.Polygonlocid != nil { - m.Polygonlocid = o.Polygonlocid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.Fieldtech != nil { - m.Fieldtech = o.Fieldtech() - } - 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.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) - - return m -} - -// BuildMany returns an models.FieldseekerQamosquitoinspectionSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerQamosquitoinspectionTemplate.CreateMany -func (o FieldseekerQamosquitoinspectionTemplate) BuildMany(number int) models.FieldseekerQamosquitoinspectionSlice { - m := make(models.FieldseekerQamosquitoinspectionSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerQamosquitoinspection(m *models.FieldseekerQamosquitoinspectionSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerQamosquitoinspectionTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerQamosquitoinspection) error { - var err error - - return err -} - -// Create builds a fieldseekerQamosquitoinspection and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerQamosquitoinspectionTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerQamosquitoinspection, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerQamosquitoinspection and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerQamosquitoinspectionTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerQamosquitoinspection { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerQamosquitoinspection 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 *FieldseekerQamosquitoinspectionTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerQamosquitoinspection { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerQamosquitoinspections and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerQamosquitoinspectionTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerQamosquitoinspectionSlice, error) { - var err error - m := make(models.FieldseekerQamosquitoinspectionSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerQamosquitoinspections and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerQamosquitoinspectionTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerQamosquitoinspectionSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerQamosquitoinspections 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 FieldseekerQamosquitoinspectionTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerQamosquitoinspectionSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerQamosquitoinspection has methods that act as mods for the FieldseekerQamosquitoinspectionTemplate -var FieldseekerQamosquitoinspectionMods fieldseekerQamosquitoinspectionMods - -type fieldseekerQamosquitoinspectionMods struct{} - -func (m fieldseekerQamosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModSlice{ - FieldseekerQamosquitoinspectionMods.RandomObjectid(f), - FieldseekerQamosquitoinspectionMods.RandomPosdips(f), - FieldseekerQamosquitoinspectionMods.RandomActiontaken(f), - FieldseekerQamosquitoinspectionMods.RandomComments(f), - FieldseekerQamosquitoinspectionMods.RandomAvetemp(f), - FieldseekerQamosquitoinspectionMods.RandomWindspeed(f), - FieldseekerQamosquitoinspectionMods.RandomRaingauge(f), - FieldseekerQamosquitoinspectionMods.RandomGlobalid(f), - FieldseekerQamosquitoinspectionMods.RandomStartdatetime(f), - FieldseekerQamosquitoinspectionMods.RandomEnddatetime(f), - FieldseekerQamosquitoinspectionMods.RandomWinddir(f), - FieldseekerQamosquitoinspectionMods.RandomReviewed(f), - FieldseekerQamosquitoinspectionMods.RandomReviewedby(f), - FieldseekerQamosquitoinspectionMods.RandomRevieweddate(f), - FieldseekerQamosquitoinspectionMods.RandomLocationname(f), - FieldseekerQamosquitoinspectionMods.RandomZone(f), - FieldseekerQamosquitoinspectionMods.RandomRecordstatus(f), - FieldseekerQamosquitoinspectionMods.RandomZone2(f), - FieldseekerQamosquitoinspectionMods.RandomLR(f), - FieldseekerQamosquitoinspectionMods.RandomNegdips(f), - FieldseekerQamosquitoinspectionMods.RandomTotalacres(f), - FieldseekerQamosquitoinspectionMods.RandomAcresbreeding(f), - FieldseekerQamosquitoinspectionMods.RandomFish(f), - FieldseekerQamosquitoinspectionMods.RandomSitetype(f), - FieldseekerQamosquitoinspectionMods.RandomBreedingpotential(f), - FieldseekerQamosquitoinspectionMods.RandomMovingwater(f), - FieldseekerQamosquitoinspectionMods.RandomNowaterever(f), - FieldseekerQamosquitoinspectionMods.RandomMosquitohabitat(f), - FieldseekerQamosquitoinspectionMods.RandomHabvalue1(f), - FieldseekerQamosquitoinspectionMods.RandomHabvalue1percent(f), - FieldseekerQamosquitoinspectionMods.RandomHabvalue2(f), - FieldseekerQamosquitoinspectionMods.RandomHabvalue2percent(f), - FieldseekerQamosquitoinspectionMods.RandomPotential(f), - FieldseekerQamosquitoinspectionMods.RandomLarvaepresent(f), - FieldseekerQamosquitoinspectionMods.RandomLarvaeinsidetreatedarea(f), - FieldseekerQamosquitoinspectionMods.RandomLarvaeoutsidetreatedarea(f), - FieldseekerQamosquitoinspectionMods.RandomLarvaereason(f), - FieldseekerQamosquitoinspectionMods.RandomAquaticorganisms(f), - FieldseekerQamosquitoinspectionMods.RandomVegetation(f), - FieldseekerQamosquitoinspectionMods.RandomSourcereduction(f), - FieldseekerQamosquitoinspectionMods.RandomWaterpresent(f), - FieldseekerQamosquitoinspectionMods.RandomWatermovement1(f), - FieldseekerQamosquitoinspectionMods.RandomWatermovement1percent(f), - FieldseekerQamosquitoinspectionMods.RandomWatermovement2(f), - FieldseekerQamosquitoinspectionMods.RandomWatermovement2percent(f), - FieldseekerQamosquitoinspectionMods.RandomSoilconditions(f), - FieldseekerQamosquitoinspectionMods.RandomWaterduration(f), - FieldseekerQamosquitoinspectionMods.RandomWatersource(f), - FieldseekerQamosquitoinspectionMods.RandomWaterconditions(f), - FieldseekerQamosquitoinspectionMods.RandomAdultactivity(f), - FieldseekerQamosquitoinspectionMods.RandomLinelocid(f), - FieldseekerQamosquitoinspectionMods.RandomPointlocid(f), - FieldseekerQamosquitoinspectionMods.RandomPolygonlocid(f), - FieldseekerQamosquitoinspectionMods.RandomCreatedUser(f), - FieldseekerQamosquitoinspectionMods.RandomCreatedDate(f), - FieldseekerQamosquitoinspectionMods.RandomLastEditedUser(f), - FieldseekerQamosquitoinspectionMods.RandomLastEditedDate(f), - FieldseekerQamosquitoinspectionMods.RandomFieldtech(f), - FieldseekerQamosquitoinspectionMods.RandomCreationdate(f), - FieldseekerQamosquitoinspectionMods.RandomCreator(f), - FieldseekerQamosquitoinspectionMods.RandomEditdate(f), - FieldseekerQamosquitoinspectionMods.RandomEditor(f), - FieldseekerQamosquitoinspectionMods.RandomGeometry(f), - FieldseekerQamosquitoinspectionMods.RandomGeospatial(f), - FieldseekerQamosquitoinspectionMods.RandomVersion(f), - FieldseekerQamosquitoinspectionMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Objectid(val int64) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) ObjectidFunc(f func() int64) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetObjectid() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomObjectid(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Posdips(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Posdips = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) PosdipsFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Posdips = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetPosdips() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomPosdips(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomPosdipsNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Actiontaken(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Actiontaken = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) ActiontakenFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Actiontaken = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetActiontaken() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomActiontaken(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Actiontaken = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomActiontakenNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Actiontaken = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Comments(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) CommentsFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetComments() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomComments(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCommentsNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Avetemp(val null.Val[float64]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Avetemp = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) AvetempFunc(f func() null.Val[float64]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Avetemp = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetAvetemp() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomAvetemp(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomAvetempNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Windspeed(val null.Val[float64]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Windspeed = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) WindspeedFunc(f func() null.Val[float64]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Windspeed = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetWindspeed() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomWindspeed(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomWindspeedNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Raingauge(val null.Val[float64]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Raingauge = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) RaingaugeFunc(f func() null.Val[float64]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Raingauge = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetRaingauge() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomRaingauge(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomRaingaugeNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Globalid(val uuid.UUID) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) GlobalidFunc(f func() uuid.UUID) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetGlobalid() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomGlobalid(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Startdatetime(val null.Val[time.Time]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Startdatetime = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) StartdatetimeFunc(f func() null.Val[time.Time]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Startdatetime = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetStartdatetime() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomStartdatetime(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Startdatetime = 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 fieldseekerQamosquitoinspectionMods) RandomStartdatetimeNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Startdatetime = 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 fieldseekerQamosquitoinspectionMods) Enddatetime(val null.Val[time.Time]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Enddatetime = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) EnddatetimeFunc(f func() null.Val[time.Time]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Enddatetime = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetEnddatetime() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomEnddatetime(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Enddatetime = 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 fieldseekerQamosquitoinspectionMods) RandomEnddatetimeNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Enddatetime = 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 fieldseekerQamosquitoinspectionMods) Winddir(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Winddir = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) WinddirFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Winddir = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetWinddir() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomWinddir(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Winddir = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "3") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomWinddirNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Winddir = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "3") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Reviewed(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Reviewed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) ReviewedFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Reviewed = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetReviewed() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomReviewed(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomReviewedNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Reviewedby(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Reviewedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) ReviewedbyFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Reviewedby = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetReviewedby() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomReviewedby(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Reviewedby = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReviewedbyNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Reviewedby = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Revieweddate(val null.Val[time.Time]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Revieweddate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) RevieweddateFunc(f func() null.Val[time.Time]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Revieweddate = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetRevieweddate() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomRevieweddate(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Revieweddate = 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 fieldseekerQamosquitoinspectionMods) RandomRevieweddateNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Revieweddate = 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 fieldseekerQamosquitoinspectionMods) Locationname(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Locationname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) LocationnameFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Locationname = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetLocationname() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomLocationname(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Locationname = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLocationnameNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Locationname = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Zone(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) ZoneFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetZone() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomZone(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZoneNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Recordstatus(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Recordstatus = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) RecordstatusFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Recordstatus = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetRecordstatus() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomRecordstatus(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomRecordstatusNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Zone2(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) Zone2Func(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetZone2() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomZone2(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZone2NotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) LR(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.LR = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) LRFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.LR = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetLR() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomLR(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomLRNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Negdips(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Negdips = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) NegdipsFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Negdips = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetNegdips() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomNegdips(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomNegdipsNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Totalacres(val null.Val[float64]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Totalacres = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) TotalacresFunc(f func() null.Val[float64]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Totalacres = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetTotalacres() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomTotalacres(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomTotalacresNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Acresbreeding(val null.Val[float64]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Acresbreeding = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) AcresbreedingFunc(f func() null.Val[float64]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Acresbreeding = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetAcresbreeding() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomAcresbreeding(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomAcresbreedingNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Fish(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Fish = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) FishFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Fish = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetFish() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomFish(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomFishNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Sitetype(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Sitetype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) SitetypeFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Sitetype = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetSitetype() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomSitetype(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Sitetype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSitetypeNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Sitetype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Breedingpotential(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Breedingpotential = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) BreedingpotentialFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Breedingpotential = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetBreedingpotential() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomBreedingpotential(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Breedingpotential = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomBreedingpotentialNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Breedingpotential = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Movingwater(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Movingwater = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) MovingwaterFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Movingwater = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetMovingwater() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomMovingwater(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomMovingwaterNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Nowaterever(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Nowaterever = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) NowatereverFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Nowaterever = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetNowaterever() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomNowaterever(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomNowatereverNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Mosquitohabitat(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Mosquitohabitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) MosquitohabitatFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Mosquitohabitat = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetMosquitohabitat() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomMosquitohabitat(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Mosquitohabitat = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomMosquitohabitatNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Mosquitohabitat = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Habvalue1(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Habvalue1 = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) Habvalue1Func(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Habvalue1 = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetHabvalue1() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomHabvalue1(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomHabvalue1NotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Habvalue1percent(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Habvalue1percent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) Habvalue1percentFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Habvalue1percent = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetHabvalue1percent() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomHabvalue1percent(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomHabvalue1percentNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Habvalue2(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Habvalue2 = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) Habvalue2Func(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Habvalue2 = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetHabvalue2() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomHabvalue2(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomHabvalue2NotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Habvalue2percent(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Habvalue2percent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) Habvalue2percentFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Habvalue2percent = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetHabvalue2percent() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomHabvalue2percent(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomHabvalue2percentNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Potential(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Potential = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) PotentialFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Potential = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetPotential() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomPotential(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomPotentialNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Larvaepresent(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaepresent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) LarvaepresentFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaepresent = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetLarvaepresent() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomLarvaepresent(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomLarvaepresentNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Larvaeinsidetreatedarea(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaeinsidetreatedarea = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) LarvaeinsidetreatedareaFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaeinsidetreatedarea = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetLarvaeinsidetreatedarea() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomLarvaeinsidetreatedarea(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomLarvaeinsidetreatedareaNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Larvaeoutsidetreatedarea(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaeoutsidetreatedarea = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) LarvaeoutsidetreatedareaFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaeoutsidetreatedarea = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetLarvaeoutsidetreatedarea() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomLarvaeoutsidetreatedarea(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomLarvaeoutsidetreatedareaNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Larvaereason(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaereason = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) LarvaereasonFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaereason = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetLarvaereason() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomLarvaereason(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaereason = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLarvaereasonNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Larvaereason = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Aquaticorganisms(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Aquaticorganisms = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) AquaticorganismsFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Aquaticorganisms = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetAquaticorganisms() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomAquaticorganisms(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Aquaticorganisms = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "500") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomAquaticorganismsNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Aquaticorganisms = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "500") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Vegetation(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Vegetation = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) VegetationFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Vegetation = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetVegetation() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomVegetation(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Vegetation = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "500") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomVegetationNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Vegetation = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "500") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Sourcereduction(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Sourcereduction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) SourcereductionFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Sourcereduction = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetSourcereduction() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomSourcereduction(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Sourcereduction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSourcereductionNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Sourcereduction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Waterpresent(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Waterpresent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) WaterpresentFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Waterpresent = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetWaterpresent() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomWaterpresent(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomWaterpresentNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Watermovement1(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watermovement1 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) Watermovement1Func(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watermovement1 = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetWatermovement1() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomWatermovement1(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watermovement1 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomWatermovement1NotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watermovement1 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Watermovement1percent(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watermovement1percent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) Watermovement1percentFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watermovement1percent = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetWatermovement1percent() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomWatermovement1percent(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomWatermovement1percentNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Watermovement2(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watermovement2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) Watermovement2Func(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watermovement2 = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetWatermovement2() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomWatermovement2(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watermovement2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomWatermovement2NotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watermovement2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Watermovement2percent(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watermovement2percent = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) Watermovement2percentFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watermovement2percent = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetWatermovement2percent() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomWatermovement2percent(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomWatermovement2percentNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Soilconditions(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Soilconditions = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) SoilconditionsFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Soilconditions = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetSoilconditions() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomSoilconditions(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Soilconditions = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSoilconditionsNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Soilconditions = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Waterduration(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Waterduration = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) WaterdurationFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Waterduration = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetWaterduration() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomWaterduration(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Waterduration = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomWaterdurationNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Waterduration = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Watersource(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watersource = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) WatersourceFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watersource = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetWatersource() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomWatersource(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watersource = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomWatersourceNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Watersource = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Waterconditions(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Waterconditions = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) WaterconditionsFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Waterconditions = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetWaterconditions() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomWaterconditions(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Waterconditions = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomWaterconditionsNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Waterconditions = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Adultactivity(val null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Adultactivity = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) AdultactivityFunc(f func() null.Val[int16]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Adultactivity = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetAdultactivity() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomAdultactivity(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomAdultactivityNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) Linelocid(val null.Val[uuid.UUID]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Linelocid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) LinelocidFunc(f func() null.Val[uuid.UUID]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Linelocid = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetLinelocid() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomLinelocid(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Linelocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLinelocidNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Linelocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Pointlocid(val null.Val[uuid.UUID]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Pointlocid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) PointlocidFunc(f func() null.Val[uuid.UUID]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Pointlocid = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetPointlocid() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomPointlocid(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Pointlocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomPointlocidNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Pointlocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Polygonlocid(val null.Val[uuid.UUID]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Polygonlocid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) PolygonlocidFunc(f func() null.Val[uuid.UUID]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Polygonlocid = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetPolygonlocid() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomPolygonlocid(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Polygonlocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomPolygonlocidNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Polygonlocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) CreatedUser(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetCreatedUser() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomCreatedUser(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) CreatedDate(val null.Val[time.Time]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetCreatedDate() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomCreatedDate(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.CreatedDate = 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 fieldseekerQamosquitoinspectionMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.CreatedDate = 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 fieldseekerQamosquitoinspectionMods) LastEditedUser(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetLastEditedUser() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomLastEditedUser(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) LastEditedDate(val null.Val[time.Time]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetLastEditedDate() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomLastEditedDate(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.LastEditedDate = 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 fieldseekerQamosquitoinspectionMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.LastEditedDate = 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 fieldseekerQamosquitoinspectionMods) Fieldtech(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Fieldtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) FieldtechFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Fieldtech = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetFieldtech() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomFieldtech(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Fieldtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomFieldtechNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Fieldtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Creationdate(val null.Val[time.Time]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetCreationdate() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomCreationdate(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Creationdate = 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 fieldseekerQamosquitoinspectionMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Creationdate = 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 fieldseekerQamosquitoinspectionMods) Creator(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) CreatorFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetCreator() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomCreator(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerQamosquitoinspectionMods) Editdate(val null.Val[time.Time]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetEditdate() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomEditdate(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Editdate = 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 fieldseekerQamosquitoinspectionMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Editdate = 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 fieldseekerQamosquitoinspectionMods) Editor(val null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) EditorFunc(f func() null.Val[string]) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetEditor() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomEditor(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerQamosquitoinspectionMods) VersionFunc(f func() int32) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerQamosquitoinspectionMods) UnsetVersion() FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - 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 fieldseekerQamosquitoinspectionMods) RandomVersion(f *faker.Faker) FieldseekerQamosquitoinspectionMod { - return FieldseekerQamosquitoinspectionModFunc(func(_ context.Context, o *FieldseekerQamosquitoinspectionTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index b348a13e..00000000 --- a/db/factory/fieldseeker.rodentlocation.bob.go +++ /dev/null @@ -1,2301 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerRodentlocationMod interface { - Apply(context.Context, *FieldseekerRodentlocationTemplate) -} - -type FieldseekerRodentlocationModFunc func(context.Context, *FieldseekerRodentlocationTemplate) - -func (f FieldseekerRodentlocationModFunc) Apply(ctx context.Context, n *FieldseekerRodentlocationTemplate) { - f(ctx, n) -} - -type FieldseekerRodentlocationModSlice []FieldseekerRodentlocationMod - -func (mods FieldseekerRodentlocationModSlice) Apply(ctx context.Context, n *FieldseekerRodentlocationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerRodentlocationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerRodentlocationTemplate struct { - Objectid func() int64 - Locationname func() null.Val[string] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - 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[string] - Externalid func() null.Val[string] - Nextactiondatescheduled func() null.Val[time.Time] - Locationnumber func() null.Val[int32] - Lastinspectdate func() null.Val[time.Time] - Lastinspectspecies func() null.Val[string] - Lastinspectaction func() null.Val[string] - Lastinspectconditions func() null.Val[string] - Lastinspectrodentevidence func() null.Val[string] - Globalid func() uuid.UUID - CreatedUser func() null.Val[string] - CreatedDate func() null.Val[time.Time] - LastEditedUser func() null.Val[string] - LastEditedDate func() null.Val[time.Time] - 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] - 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerRodentlocationTemplate) BuildSetter() *models.FieldseekerRodentlocationSetter { - m := &models.FieldseekerRodentlocationSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Locationname != nil { - val := o.Locationname() - m.Locationname = 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.Habitat != nil { - val := o.Habitat() - m.Habitat = omitnull.FromNull(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.Active != nil { - val := o.Active() - m.Active = omitnull.FromNull(val) - } - if o.Description != nil { - val := o.Description() - m.Description = omitnull.FromNull(val) - } - if o.Accessdesc != nil { - val := o.Accessdesc() - m.Accessdesc = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Symbology != nil { - val := o.Symbology() - m.Symbology = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Nextactiondatescheduled != nil { - val := o.Nextactiondatescheduled() - m.Nextactiondatescheduled = omitnull.FromNull(val) - } - if o.Locationnumber != nil { - val := o.Locationnumber() - m.Locationnumber = omitnull.FromNull(val) - } - if o.Lastinspectdate != nil { - val := o.Lastinspectdate() - m.Lastinspectdate = omitnull.FromNull(val) - } - if o.Lastinspectspecies != nil { - val := o.Lastinspectspecies() - m.Lastinspectspecies = 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.Lastinspectrodentevidence != nil { - val := o.Lastinspectrodentevidence() - m.Lastinspectrodentevidence = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = 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.Jurisdiction != nil { - 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 -} - -// BuildManySetter returns an []*models.FieldseekerRodentlocationSetter -// this does nothing with the relationship templates -func (o FieldseekerRodentlocationTemplate) BuildManySetter(number int) []*models.FieldseekerRodentlocationSetter { - m := make([]*models.FieldseekerRodentlocationSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerRodentlocation -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerRodentlocationTemplate.Create -func (o FieldseekerRodentlocationTemplate) Build() *models.FieldseekerRodentlocation { - m := &models.FieldseekerRodentlocation{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Locationname != nil { - m.Locationname = o.Locationname() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Habitat != nil { - m.Habitat = o.Habitat() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Usetype != nil { - m.Usetype = o.Usetype() - } - if o.Active != nil { - m.Active = o.Active() - } - if o.Description != nil { - m.Description = o.Description() - } - if o.Accessdesc != nil { - m.Accessdesc = o.Accessdesc() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Symbology != nil { - m.Symbology = o.Symbology() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Nextactiondatescheduled != nil { - m.Nextactiondatescheduled = o.Nextactiondatescheduled() - } - if o.Locationnumber != nil { - m.Locationnumber = o.Locationnumber() - } - if o.Lastinspectdate != nil { - m.Lastinspectdate = o.Lastinspectdate() - } - if o.Lastinspectspecies != nil { - m.Lastinspectspecies = o.Lastinspectspecies() - } - if o.Lastinspectaction != nil { - m.Lastinspectaction = o.Lastinspectaction() - } - if o.Lastinspectconditions != nil { - m.Lastinspectconditions = o.Lastinspectconditions() - } - if o.Lastinspectrodentevidence != nil { - m.Lastinspectrodentevidence = o.Lastinspectrodentevidence() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - 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.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) - - return m -} - -// BuildMany returns an models.FieldseekerRodentlocationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerRodentlocationTemplate.CreateMany -func (o FieldseekerRodentlocationTemplate) BuildMany(number int) models.FieldseekerRodentlocationSlice { - m := make(models.FieldseekerRodentlocationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerRodentlocation(m *models.FieldseekerRodentlocationSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerRodentlocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerRodentlocation) error { - var err error - - return err -} - -// Create builds a fieldseekerRodentlocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerRodentlocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerRodentlocation, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerRodentlocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerRodentlocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerRodentlocation { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerRodentlocation 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 *FieldseekerRodentlocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerRodentlocation { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerRodentlocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerRodentlocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerRodentlocationSlice, error) { - var err error - m := make(models.FieldseekerRodentlocationSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerRodentlocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerRodentlocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerRodentlocationSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerRodentlocations 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 FieldseekerRodentlocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerRodentlocationSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerRodentlocation has methods that act as mods for the FieldseekerRodentlocationTemplate -var FieldseekerRodentlocationMods fieldseekerRodentlocationMods - -type fieldseekerRodentlocationMods struct{} - -func (m fieldseekerRodentlocationMods) RandomizeAllColumns(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModSlice{ - FieldseekerRodentlocationMods.RandomObjectid(f), - FieldseekerRodentlocationMods.RandomLocationname(f), - FieldseekerRodentlocationMods.RandomZone(f), - FieldseekerRodentlocationMods.RandomZone2(f), - FieldseekerRodentlocationMods.RandomHabitat(f), - FieldseekerRodentlocationMods.RandomPriority(f), - FieldseekerRodentlocationMods.RandomUsetype(f), - FieldseekerRodentlocationMods.RandomActive(f), - FieldseekerRodentlocationMods.RandomDescription(f), - FieldseekerRodentlocationMods.RandomAccessdesc(f), - FieldseekerRodentlocationMods.RandomComments(f), - FieldseekerRodentlocationMods.RandomSymbology(f), - FieldseekerRodentlocationMods.RandomExternalid(f), - FieldseekerRodentlocationMods.RandomNextactiondatescheduled(f), - FieldseekerRodentlocationMods.RandomLocationnumber(f), - FieldseekerRodentlocationMods.RandomLastinspectdate(f), - FieldseekerRodentlocationMods.RandomLastinspectspecies(f), - FieldseekerRodentlocationMods.RandomLastinspectaction(f), - FieldseekerRodentlocationMods.RandomLastinspectconditions(f), - FieldseekerRodentlocationMods.RandomLastinspectrodentevidence(f), - FieldseekerRodentlocationMods.RandomGlobalid(f), - FieldseekerRodentlocationMods.RandomCreatedUser(f), - FieldseekerRodentlocationMods.RandomCreatedDate(f), - FieldseekerRodentlocationMods.RandomLastEditedUser(f), - FieldseekerRodentlocationMods.RandomLastEditedDate(f), - FieldseekerRodentlocationMods.RandomCreationdate(f), - FieldseekerRodentlocationMods.RandomCreator(f), - FieldseekerRodentlocationMods.RandomEditdate(f), - FieldseekerRodentlocationMods.RandomEditor(f), - FieldseekerRodentlocationMods.RandomJurisdiction(f), - FieldseekerRodentlocationMods.RandomGeometry(f), - FieldseekerRodentlocationMods.RandomGeospatial(f), - FieldseekerRodentlocationMods.RandomVersion(f), - FieldseekerRodentlocationMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) Objectid(val int64) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) ObjectidFunc(f func() int64) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetObjectid() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomObjectid(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) Locationname(val null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Locationname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) LocationnameFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Locationname = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetLocationname() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomLocationname(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Locationname = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLocationnameNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Locationname = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) Zone(val null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) ZoneFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetZone() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomZone(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZoneNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) Zone2(val null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) Zone2Func(f func() null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetZone2() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomZone2(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZone2NotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) Habitat(val null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Habitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) HabitatFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Habitat = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetHabitat() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomHabitat(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Habitat = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomHabitatNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Habitat = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) Priority(val null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) PriorityFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetPriority() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomPriority(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Priority = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomPriorityNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Priority = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) Usetype(val null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Usetype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) UsetypeFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Usetype = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetUsetype() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomUsetype(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Usetype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomUsetypeNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Usetype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) Active(val null.Val[int16]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Active = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) ActiveFunc(f func() null.Val[int16]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Active = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetActive() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomActive(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomActiveNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) Description(val null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Description = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) DescriptionFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Description = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetDescription() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomDescription(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Description = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomDescriptionNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Description = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) Accessdesc(val null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Accessdesc = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) AccessdescFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Accessdesc = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetAccessdesc() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomAccessdesc(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Accessdesc = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomAccessdescNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Accessdesc = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) Comments(val null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) CommentsFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetComments() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomComments(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCommentsNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) Symbology(val null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Symbology = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) SymbologyFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Symbology = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetSymbology() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomSymbology(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Symbology = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "10") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSymbologyNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Symbology = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "10") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) Externalid(val null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) ExternalidFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetExternalid() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomExternalid(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Externalid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomExternalidNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Externalid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) Nextactiondatescheduled(val null.Val[time.Time]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) NextactiondatescheduledFunc(f func() null.Val[time.Time]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Nextactiondatescheduled = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetNextactiondatescheduled() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomNextactiondatescheduled(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Nextactiondatescheduled = 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 fieldseekerRodentlocationMods) RandomNextactiondatescheduledNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Nextactiondatescheduled = 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 fieldseekerRodentlocationMods) Locationnumber(val null.Val[int32]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Locationnumber = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) LocationnumberFunc(f func() null.Val[int32]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Locationnumber = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetLocationnumber() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomLocationnumber(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Locationnumber = 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 fieldseekerRodentlocationMods) RandomLocationnumberNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Locationnumber = 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 fieldseekerRodentlocationMods) Lastinspectdate(val null.Val[time.Time]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Lastinspectdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) LastinspectdateFunc(f func() null.Val[time.Time]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Lastinspectdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetLastinspectdate() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomLastinspectdate(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Lastinspectdate = 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 fieldseekerRodentlocationMods) RandomLastinspectdateNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Lastinspectdate = 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 fieldseekerRodentlocationMods) Lastinspectspecies(val null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Lastinspectspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) LastinspectspeciesFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Lastinspectspecies = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetLastinspectspecies() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomLastinspectspecies(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Lastinspectspecies = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectspeciesNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Lastinspectspecies = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) Lastinspectaction(val null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Lastinspectaction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) LastinspectactionFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Lastinspectaction = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetLastinspectaction() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomLastinspectaction(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Lastinspectaction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectactionNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Lastinspectaction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) Lastinspectconditions(val null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Lastinspectconditions = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) LastinspectconditionsFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Lastinspectconditions = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetLastinspectconditions() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomLastinspectconditions(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Lastinspectconditions = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectconditionsNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Lastinspectconditions = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) Lastinspectrodentevidence(val null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Lastinspectrodentevidence = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) LastinspectrodentevidenceFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Lastinspectrodentevidence = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetLastinspectrodentevidence() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomLastinspectrodentevidence(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Lastinspectrodentevidence = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastinspectrodentevidenceNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Lastinspectrodentevidence = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) Globalid(val uuid.UUID) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) GlobalidFunc(f func() uuid.UUID) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetGlobalid() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomGlobalid(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) CreatedUser(val null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetCreatedUser() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomCreatedUser(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) CreatedDate(val null.Val[time.Time]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetCreatedDate() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomCreatedDate(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.CreatedDate = 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 fieldseekerRodentlocationMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.CreatedDate = 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 fieldseekerRodentlocationMods) LastEditedUser(val null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetLastEditedUser() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomLastEditedUser(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) LastEditedDate(val null.Val[time.Time]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetLastEditedDate() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomLastEditedDate(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.LastEditedDate = 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 fieldseekerRodentlocationMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.LastEditedDate = 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 fieldseekerRodentlocationMods) Creationdate(val null.Val[time.Time]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetCreationdate() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomCreationdate(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Creationdate = 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 fieldseekerRodentlocationMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Creationdate = 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 fieldseekerRodentlocationMods) Creator(val null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) CreatorFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetCreator() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomCreator(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) Editdate(val null.Val[time.Time]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetEditdate() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomEditdate(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Editdate = 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 fieldseekerRodentlocationMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Editdate = 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 fieldseekerRodentlocationMods) Editor(val null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) EditorFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetEditor() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomEditor(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerRodentlocationMods) Jurisdiction(val null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Jurisdiction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) JurisdictionFunc(f func() null.Val[string]) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Jurisdiction = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetJurisdiction() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomJurisdiction(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Jurisdiction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomJurisdictionNotNull(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Jurisdiction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerRodentlocationMods) VersionFunc(f func() int32) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerRodentlocationMods) UnsetVersion() FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - 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 fieldseekerRodentlocationMods) RandomVersion(f *faker.Faker) FieldseekerRodentlocationMod { - return FieldseekerRodentlocationModFunc(func(_ context.Context, o *FieldseekerRodentlocationTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index 41890846..00000000 --- a/db/factory/fieldseeker.samplecollection.bob.go +++ /dev/null @@ -1,3293 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerSamplecollectionMod interface { - Apply(context.Context, *FieldseekerSamplecollectionTemplate) -} - -type FieldseekerSamplecollectionModFunc func(context.Context, *FieldseekerSamplecollectionTemplate) - -func (f FieldseekerSamplecollectionModFunc) Apply(ctx context.Context, n *FieldseekerSamplecollectionTemplate) { - f(ctx, n) -} - -type FieldseekerSamplecollectionModSlice []FieldseekerSamplecollectionMod - -func (mods FieldseekerSamplecollectionModSlice) Apply(ctx context.Context, n *FieldseekerSamplecollectionTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerSamplecollectionTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerSamplecollectionTemplate struct { - Objectid func() int64 - LocID func() null.Val[uuid.UUID] - Startdatetime func() null.Val[time.Time] - Enddatetime func() null.Val[time.Time] - 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[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[string] - Raingauge func() null.Val[float64] - 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] - Zone func() null.Val[string] - Recordstatus func() null.Val[int16] - Zone2 func() null.Val[string] - Globalid func() 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[string] - Fieldtech func() null.Val[string] - Flockid func() null.Val[uuid.UUID] - Samplecount func() null.Val[int16] - Chickenid func() null.Val[uuid.UUID] - Gatewaysync 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] - 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerSamplecollectionTemplate) BuildSetter() *models.FieldseekerSamplecollectionSetter { - m := &models.FieldseekerSamplecollectionSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.LocID != nil { - val := o.LocID() - m.LocID = omitnull.FromNull(val) - } - if o.Startdatetime != nil { - val := o.Startdatetime() - m.Startdatetime = omitnull.FromNull(val) - } - if o.Enddatetime != nil { - val := o.Enddatetime() - m.Enddatetime = omitnull.FromNull(val) - } - if o.Sitecond != nil { - val := o.Sitecond() - m.Sitecond = 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.Datesent != nil { - val := o.Datesent() - m.Datesent = omitnull.FromNull(val) - } - if o.Datetested != nil { - val := o.Datetested() - m.Datetested = omitnull.FromNull(val) - } - if o.Testtech != nil { - val := o.Testtech() - m.Testtech = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Processed != nil { - val := o.Processed() - m.Processed = omitnull.FromNull(val) - } - if o.Sampletype != nil { - val := o.Sampletype() - m.Sampletype = omitnull.FromNull(val) - } - if o.Samplecond != nil { - val := o.Samplecond() - m.Samplecond = omitnull.FromNull(val) - } - if o.Species != nil { - val := o.Species() - m.Species = omitnull.FromNull(val) - } - if o.Sex != nil { - val := o.Sex() - m.Sex = omitnull.FromNull(val) - } - if o.Avetemp != nil { - val := o.Avetemp() - m.Avetemp = omitnull.FromNull(val) - } - if o.Windspeed != nil { - val := o.Windspeed() - m.Windspeed = omitnull.FromNull(val) - } - if o.Winddir != nil { - val := o.Winddir() - m.Winddir = omitnull.FromNull(val) - } - if o.Raingauge != nil { - val := o.Raingauge() - m.Raingauge = omitnull.FromNull(val) - } - if o.Activity != nil { - val := o.Activity() - m.Activity = omitnull.FromNull(val) - } - if o.Testmethod != nil { - val := o.Testmethod() - m.Testmethod = omitnull.FromNull(val) - } - if o.Diseasetested != nil { - val := o.Diseasetested() - m.Diseasetested = omitnull.FromNull(val) - } - if o.Diseasepos != nil { - val := o.Diseasepos() - m.Diseasepos = 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.Locationname != nil { - val := o.Locationname() - m.Locationname = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Recordstatus != nil { - val := o.Recordstatus() - m.Recordstatus = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.Lab != nil { - val := o.Lab() - m.Lab = 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.Samplecount != nil { - val := o.Samplecount() - m.Samplecount = omitnull.FromNull(val) - } - if o.Chickenid != nil { - val := o.Chickenid() - m.Chickenid = omitnull.FromNull(val) - } - if o.Gatewaysync != nil { - val := o.Gatewaysync() - m.Gatewaysync = 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.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 -} - -// BuildManySetter returns an []*models.FieldseekerSamplecollectionSetter -// this does nothing with the relationship templates -func (o FieldseekerSamplecollectionTemplate) BuildManySetter(number int) []*models.FieldseekerSamplecollectionSetter { - m := make([]*models.FieldseekerSamplecollectionSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerSamplecollection -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerSamplecollectionTemplate.Create -func (o FieldseekerSamplecollectionTemplate) Build() *models.FieldseekerSamplecollection { - m := &models.FieldseekerSamplecollection{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.LocID != nil { - m.LocID = o.LocID() - } - if o.Startdatetime != nil { - m.Startdatetime = o.Startdatetime() - } - if o.Enddatetime != nil { - m.Enddatetime = o.Enddatetime() - } - if o.Sitecond != nil { - m.Sitecond = o.Sitecond() - } - if o.Sampleid != nil { - m.Sampleid = o.Sampleid() - } - if o.Survtech != nil { - m.Survtech = o.Survtech() - } - if o.Datesent != nil { - m.Datesent = o.Datesent() - } - if o.Datetested != nil { - m.Datetested = o.Datetested() - } - if o.Testtech != nil { - m.Testtech = o.Testtech() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Processed != nil { - m.Processed = o.Processed() - } - if o.Sampletype != nil { - m.Sampletype = o.Sampletype() - } - if o.Samplecond != nil { - m.Samplecond = o.Samplecond() - } - if o.Species != nil { - m.Species = o.Species() - } - if o.Sex != nil { - m.Sex = o.Sex() - } - if o.Avetemp != nil { - m.Avetemp = o.Avetemp() - } - if o.Windspeed != nil { - m.Windspeed = o.Windspeed() - } - if o.Winddir != nil { - m.Winddir = o.Winddir() - } - if o.Raingauge != nil { - m.Raingauge = o.Raingauge() - } - if o.Activity != nil { - m.Activity = o.Activity() - } - if o.Testmethod != nil { - m.Testmethod = o.Testmethod() - } - if o.Diseasetested != nil { - m.Diseasetested = o.Diseasetested() - } - if o.Diseasepos != nil { - m.Diseasepos = o.Diseasepos() - } - 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.Locationname != nil { - m.Locationname = o.Locationname() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Recordstatus != nil { - m.Recordstatus = o.Recordstatus() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.Lab != nil { - m.Lab = o.Lab() - } - if o.Fieldtech != nil { - m.Fieldtech = o.Fieldtech() - } - if o.Flockid != nil { - m.Flockid = o.Flockid() - } - if o.Samplecount != nil { - m.Samplecount = o.Samplecount() - } - if o.Chickenid != nil { - m.Chickenid = o.Chickenid() - } - if o.Gatewaysync != nil { - m.Gatewaysync = o.Gatewaysync() - } - 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.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) - - return m -} - -// BuildMany returns an models.FieldseekerSamplecollectionSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerSamplecollectionTemplate.CreateMany -func (o FieldseekerSamplecollectionTemplate) BuildMany(number int) models.FieldseekerSamplecollectionSlice { - m := make(models.FieldseekerSamplecollectionSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerSamplecollection(m *models.FieldseekerSamplecollectionSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerSamplecollectionTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerSamplecollection) error { - var err error - - return err -} - -// Create builds a fieldseekerSamplecollection and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerSamplecollectionTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerSamplecollection, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerSamplecollection and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerSamplecollectionTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerSamplecollection { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerSamplecollection 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 *FieldseekerSamplecollectionTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerSamplecollection { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerSamplecollections and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerSamplecollectionTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerSamplecollectionSlice, error) { - var err error - m := make(models.FieldseekerSamplecollectionSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerSamplecollections and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerSamplecollectionTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerSamplecollectionSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerSamplecollections 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 FieldseekerSamplecollectionTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerSamplecollectionSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerSamplecollection has methods that act as mods for the FieldseekerSamplecollectionTemplate -var FieldseekerSamplecollectionMods fieldseekerSamplecollectionMods - -type fieldseekerSamplecollectionMods struct{} - -func (m fieldseekerSamplecollectionMods) RandomizeAllColumns(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModSlice{ - FieldseekerSamplecollectionMods.RandomObjectid(f), - FieldseekerSamplecollectionMods.RandomLocID(f), - FieldseekerSamplecollectionMods.RandomStartdatetime(f), - FieldseekerSamplecollectionMods.RandomEnddatetime(f), - FieldseekerSamplecollectionMods.RandomSitecond(f), - FieldseekerSamplecollectionMods.RandomSampleid(f), - FieldseekerSamplecollectionMods.RandomSurvtech(f), - FieldseekerSamplecollectionMods.RandomDatesent(f), - FieldseekerSamplecollectionMods.RandomDatetested(f), - FieldseekerSamplecollectionMods.RandomTesttech(f), - FieldseekerSamplecollectionMods.RandomComments(f), - FieldseekerSamplecollectionMods.RandomProcessed(f), - FieldseekerSamplecollectionMods.RandomSampletype(f), - FieldseekerSamplecollectionMods.RandomSamplecond(f), - FieldseekerSamplecollectionMods.RandomSpecies(f), - FieldseekerSamplecollectionMods.RandomSex(f), - FieldseekerSamplecollectionMods.RandomAvetemp(f), - FieldseekerSamplecollectionMods.RandomWindspeed(f), - FieldseekerSamplecollectionMods.RandomWinddir(f), - FieldseekerSamplecollectionMods.RandomRaingauge(f), - FieldseekerSamplecollectionMods.RandomActivity(f), - FieldseekerSamplecollectionMods.RandomTestmethod(f), - FieldseekerSamplecollectionMods.RandomDiseasetested(f), - FieldseekerSamplecollectionMods.RandomDiseasepos(f), - FieldseekerSamplecollectionMods.RandomReviewed(f), - FieldseekerSamplecollectionMods.RandomReviewedby(f), - FieldseekerSamplecollectionMods.RandomRevieweddate(f), - FieldseekerSamplecollectionMods.RandomLocationname(f), - FieldseekerSamplecollectionMods.RandomZone(f), - FieldseekerSamplecollectionMods.RandomRecordstatus(f), - FieldseekerSamplecollectionMods.RandomZone2(f), - FieldseekerSamplecollectionMods.RandomGlobalid(f), - FieldseekerSamplecollectionMods.RandomCreatedUser(f), - FieldseekerSamplecollectionMods.RandomCreatedDate(f), - FieldseekerSamplecollectionMods.RandomLastEditedUser(f), - FieldseekerSamplecollectionMods.RandomLastEditedDate(f), - FieldseekerSamplecollectionMods.RandomLab(f), - FieldseekerSamplecollectionMods.RandomFieldtech(f), - FieldseekerSamplecollectionMods.RandomFlockid(f), - FieldseekerSamplecollectionMods.RandomSamplecount(f), - FieldseekerSamplecollectionMods.RandomChickenid(f), - FieldseekerSamplecollectionMods.RandomGatewaysync(f), - FieldseekerSamplecollectionMods.RandomCreationdate(f), - FieldseekerSamplecollectionMods.RandomCreator(f), - FieldseekerSamplecollectionMods.RandomEditdate(f), - FieldseekerSamplecollectionMods.RandomEditor(f), - FieldseekerSamplecollectionMods.RandomGeometry(f), - FieldseekerSamplecollectionMods.RandomGeospatial(f), - FieldseekerSamplecollectionMods.RandomVersion(f), - FieldseekerSamplecollectionMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Objectid(val int64) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) ObjectidFunc(f func() int64) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetObjectid() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomObjectid(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) LocID(val null.Val[uuid.UUID]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.LocID = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) LocIDFunc(f func() null.Val[uuid.UUID]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.LocID = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetLocID() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomLocID(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.LocID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLocIDNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.LocID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Startdatetime(val null.Val[time.Time]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Startdatetime = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) StartdatetimeFunc(f func() null.Val[time.Time]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Startdatetime = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetStartdatetime() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomStartdatetime(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Startdatetime = 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 fieldseekerSamplecollectionMods) RandomStartdatetimeNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Startdatetime = 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 fieldseekerSamplecollectionMods) Enddatetime(val null.Val[time.Time]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Enddatetime = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) EnddatetimeFunc(f func() null.Val[time.Time]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Enddatetime = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetEnddatetime() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomEnddatetime(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Enddatetime = 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 fieldseekerSamplecollectionMods) RandomEnddatetimeNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Enddatetime = 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 fieldseekerSamplecollectionMods) Sitecond(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sitecond = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) SitecondFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sitecond = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetSitecond() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomSitecond(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sitecond = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSitecondNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sitecond = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Sampleid(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sampleid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) SampleidFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sampleid = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetSampleid() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomSampleid(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sampleid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSampleidNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sampleid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Survtech(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Survtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) SurvtechFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Survtech = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetSurvtech() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomSurvtech(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Survtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSurvtechNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Survtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Datesent(val null.Val[time.Time]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Datesent = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) DatesentFunc(f func() null.Val[time.Time]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Datesent = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetDatesent() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomDatesent(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Datesent = 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 fieldseekerSamplecollectionMods) RandomDatesentNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Datesent = 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 fieldseekerSamplecollectionMods) Datetested(val null.Val[time.Time]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Datetested = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) DatetestedFunc(f func() null.Val[time.Time]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Datetested = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetDatetested() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomDatetested(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Datetested = 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 fieldseekerSamplecollectionMods) RandomDatetestedNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Datetested = 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 fieldseekerSamplecollectionMods) Testtech(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Testtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) TesttechFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Testtech = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetTesttech() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomTesttech(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Testtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomTesttechNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Testtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Comments(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) CommentsFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetComments() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomComments(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCommentsNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Processed(val null.Val[int16]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Processed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) ProcessedFunc(f func() null.Val[int16]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Processed = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetProcessed() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomProcessed(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomProcessedNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) Sampletype(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sampletype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) SampletypeFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sampletype = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetSampletype() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomSampletype(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sampletype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSampletypeNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sampletype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Samplecond(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Samplecond = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) SamplecondFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Samplecond = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetSamplecond() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomSamplecond(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Samplecond = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSamplecondNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Samplecond = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Species(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Species = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) SpeciesFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Species = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetSpecies() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomSpecies(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Species = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSpeciesNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Species = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Sex(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sex = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) SexFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sex = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetSex() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomSex(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sex = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "1") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSexNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Sex = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "1") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Avetemp(val null.Val[float64]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Avetemp = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) AvetempFunc(f func() null.Val[float64]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Avetemp = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetAvetemp() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomAvetemp(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomAvetempNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) Windspeed(val null.Val[float64]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Windspeed = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) WindspeedFunc(f func() null.Val[float64]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Windspeed = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetWindspeed() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomWindspeed(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomWindspeedNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) Winddir(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Winddir = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) WinddirFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Winddir = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetWinddir() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomWinddir(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Winddir = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "3") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomWinddirNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Winddir = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "3") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Raingauge(val null.Val[float64]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Raingauge = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) RaingaugeFunc(f func() null.Val[float64]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Raingauge = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetRaingauge() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomRaingauge(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomRaingaugeNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) Activity(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Activity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) ActivityFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Activity = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetActivity() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomActivity(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Activity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomActivityNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Activity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Testmethod(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Testmethod = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) TestmethodFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Testmethod = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetTestmethod() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomTestmethod(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Testmethod = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "100") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomTestmethodNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Testmethod = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "100") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Diseasetested(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Diseasetested = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) DiseasetestedFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Diseasetested = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetDiseasetested() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomDiseasetested(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Diseasetested = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "100") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomDiseasetestedNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Diseasetested = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "100") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Diseasepos(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Diseasepos = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) DiseaseposFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Diseasepos = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetDiseasepos() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomDiseasepos(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Diseasepos = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "100") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomDiseaseposNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Diseasepos = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "100") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Reviewed(val null.Val[int16]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Reviewed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) ReviewedFunc(f func() null.Val[int16]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Reviewed = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetReviewed() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomReviewed(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomReviewedNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) Reviewedby(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Reviewedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) ReviewedbyFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Reviewedby = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetReviewedby() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomReviewedby(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Reviewedby = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReviewedbyNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Reviewedby = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Revieweddate(val null.Val[time.Time]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Revieweddate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) RevieweddateFunc(f func() null.Val[time.Time]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Revieweddate = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetRevieweddate() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomRevieweddate(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Revieweddate = 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 fieldseekerSamplecollectionMods) RandomRevieweddateNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Revieweddate = 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 fieldseekerSamplecollectionMods) Locationname(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Locationname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) LocationnameFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Locationname = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetLocationname() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomLocationname(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Locationname = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLocationnameNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Locationname = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Zone(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) ZoneFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetZone() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomZone(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZoneNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Recordstatus(val null.Val[int16]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Recordstatus = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) RecordstatusFunc(f func() null.Val[int16]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Recordstatus = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetRecordstatus() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomRecordstatus(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomRecordstatusNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) Zone2(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) Zone2Func(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetZone2() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomZone2(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZone2NotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Globalid(val uuid.UUID) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) GlobalidFunc(f func() uuid.UUID) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetGlobalid() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomGlobalid(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) CreatedUser(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetCreatedUser() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomCreatedUser(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) CreatedDate(val null.Val[time.Time]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetCreatedDate() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomCreatedDate(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.CreatedDate = 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 fieldseekerSamplecollectionMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.CreatedDate = 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 fieldseekerSamplecollectionMods) LastEditedUser(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetLastEditedUser() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomLastEditedUser(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) LastEditedDate(val null.Val[time.Time]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetLastEditedDate() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomLastEditedDate(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.LastEditedDate = 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 fieldseekerSamplecollectionMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.LastEditedDate = 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 fieldseekerSamplecollectionMods) Lab(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Lab = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) LabFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Lab = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetLab() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomLab(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Lab = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLabNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Lab = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Fieldtech(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Fieldtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) FieldtechFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Fieldtech = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetFieldtech() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomFieldtech(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Fieldtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomFieldtechNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Fieldtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Flockid(val null.Val[uuid.UUID]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Flockid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) FlockidFunc(f func() null.Val[uuid.UUID]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Flockid = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetFlockid() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomFlockid(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Flockid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomFlockidNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Flockid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Samplecount(val null.Val[int16]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Samplecount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) SamplecountFunc(f func() null.Val[int16]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Samplecount = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetSamplecount() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomSamplecount(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomSamplecountNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) Chickenid(val null.Val[uuid.UUID]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Chickenid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) ChickenidFunc(f func() null.Val[uuid.UUID]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Chickenid = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetChickenid() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomChickenid(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Chickenid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomChickenidNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Chickenid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Gatewaysync(val null.Val[int16]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Gatewaysync = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) GatewaysyncFunc(f func() null.Val[int16]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Gatewaysync = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetGatewaysync() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomGatewaysync(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomGatewaysyncNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) Creationdate(val null.Val[time.Time]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetCreationdate() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomCreationdate(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Creationdate = 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 fieldseekerSamplecollectionMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Creationdate = 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 fieldseekerSamplecollectionMods) Creator(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) CreatorFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetCreator() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomCreator(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplecollectionMods) Editdate(val null.Val[time.Time]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetEditdate() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomEditdate(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Editdate = 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 fieldseekerSamplecollectionMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Editdate = 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 fieldseekerSamplecollectionMods) Editor(val null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) EditorFunc(f func() null.Val[string]) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetEditor() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomEditor(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplecollectionMods) VersionFunc(f func() int32) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplecollectionMods) UnsetVersion() FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - 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 fieldseekerSamplecollectionMods) RandomVersion(f *faker.Faker) FieldseekerSamplecollectionMod { - return FieldseekerSamplecollectionModFunc(func(_ context.Context, o *FieldseekerSamplecollectionTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index 69a1a719..00000000 --- a/db/factory/fieldseeker.samplelocation.bob.go +++ /dev/null @@ -1,1929 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerSamplelocationMod interface { - Apply(context.Context, *FieldseekerSamplelocationTemplate) -} - -type FieldseekerSamplelocationModFunc func(context.Context, *FieldseekerSamplelocationTemplate) - -func (f FieldseekerSamplelocationModFunc) Apply(ctx context.Context, n *FieldseekerSamplelocationTemplate) { - f(ctx, n) -} - -type FieldseekerSamplelocationModSlice []FieldseekerSamplelocationMod - -func (mods FieldseekerSamplelocationModSlice) Apply(ctx context.Context, n *FieldseekerSamplelocationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerSamplelocationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerSamplelocationTemplate struct { - Objectid func() int64 - Name func() null.Val[string] - Zone func() null.Val[string] - 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] - Externalid func() null.Val[string] - Nextactiondatescheduled func() null.Val[time.Time] - Zone2 func() null.Val[string] - Locationnumber func() null.Val[int32] - Globalid func() uuid.UUID - CreatedUser func() null.Val[string] - CreatedDate func() null.Val[time.Time] - LastEditedUser func() null.Val[string] - LastEditedDate func() null.Val[time.Time] - Gatewaysync 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] - 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerSamplelocationTemplate) BuildSetter() *models.FieldseekerSamplelocationSetter { - m := &models.FieldseekerSamplelocationSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Habitat != nil { - val := o.Habitat() - m.Habitat = omitnull.FromNull(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.Active != nil { - val := o.Active() - m.Active = omitnull.FromNull(val) - } - if o.Description != nil { - val := o.Description() - m.Description = omitnull.FromNull(val) - } - if o.Accessdesc != nil { - val := o.Accessdesc() - m.Accessdesc = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Nextactiondatescheduled != nil { - val := o.Nextactiondatescheduled() - m.Nextactiondatescheduled = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.Locationnumber != nil { - val := o.Locationnumber() - m.Locationnumber = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.Gatewaysync != nil { - val := o.Gatewaysync() - m.Gatewaysync = 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.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 -} - -// BuildManySetter returns an []*models.FieldseekerSamplelocationSetter -// this does nothing with the relationship templates -func (o FieldseekerSamplelocationTemplate) BuildManySetter(number int) []*models.FieldseekerSamplelocationSetter { - m := make([]*models.FieldseekerSamplelocationSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerSamplelocation -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerSamplelocationTemplate.Create -func (o FieldseekerSamplelocationTemplate) Build() *models.FieldseekerSamplelocation { - m := &models.FieldseekerSamplelocation{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Habitat != nil { - m.Habitat = o.Habitat() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Usetype != nil { - m.Usetype = o.Usetype() - } - if o.Active != nil { - m.Active = o.Active() - } - if o.Description != nil { - m.Description = o.Description() - } - if o.Accessdesc != nil { - m.Accessdesc = o.Accessdesc() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Nextactiondatescheduled != nil { - m.Nextactiondatescheduled = o.Nextactiondatescheduled() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Locationnumber != nil { - m.Locationnumber = o.Locationnumber() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.Gatewaysync != nil { - m.Gatewaysync = o.Gatewaysync() - } - 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.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) - - return m -} - -// BuildMany returns an models.FieldseekerSamplelocationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerSamplelocationTemplate.CreateMany -func (o FieldseekerSamplelocationTemplate) BuildMany(number int) models.FieldseekerSamplelocationSlice { - m := make(models.FieldseekerSamplelocationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerSamplelocation(m *models.FieldseekerSamplelocationSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerSamplelocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerSamplelocation) error { - var err error - - return err -} - -// Create builds a fieldseekerSamplelocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerSamplelocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerSamplelocation, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerSamplelocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerSamplelocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerSamplelocation { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerSamplelocation 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 *FieldseekerSamplelocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerSamplelocation { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerSamplelocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerSamplelocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerSamplelocationSlice, error) { - var err error - m := make(models.FieldseekerSamplelocationSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerSamplelocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerSamplelocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerSamplelocationSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerSamplelocations 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 FieldseekerSamplelocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerSamplelocationSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerSamplelocation has methods that act as mods for the FieldseekerSamplelocationTemplate -var FieldseekerSamplelocationMods fieldseekerSamplelocationMods - -type fieldseekerSamplelocationMods struct{} - -func (m fieldseekerSamplelocationMods) RandomizeAllColumns(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModSlice{ - FieldseekerSamplelocationMods.RandomObjectid(f), - FieldseekerSamplelocationMods.RandomName(f), - FieldseekerSamplelocationMods.RandomZone(f), - FieldseekerSamplelocationMods.RandomHabitat(f), - FieldseekerSamplelocationMods.RandomPriority(f), - FieldseekerSamplelocationMods.RandomUsetype(f), - FieldseekerSamplelocationMods.RandomActive(f), - FieldseekerSamplelocationMods.RandomDescription(f), - FieldseekerSamplelocationMods.RandomAccessdesc(f), - FieldseekerSamplelocationMods.RandomComments(f), - FieldseekerSamplelocationMods.RandomExternalid(f), - FieldseekerSamplelocationMods.RandomNextactiondatescheduled(f), - FieldseekerSamplelocationMods.RandomZone2(f), - FieldseekerSamplelocationMods.RandomLocationnumber(f), - FieldseekerSamplelocationMods.RandomGlobalid(f), - FieldseekerSamplelocationMods.RandomCreatedUser(f), - FieldseekerSamplelocationMods.RandomCreatedDate(f), - FieldseekerSamplelocationMods.RandomLastEditedUser(f), - FieldseekerSamplelocationMods.RandomLastEditedDate(f), - FieldseekerSamplelocationMods.RandomGatewaysync(f), - FieldseekerSamplelocationMods.RandomCreationdate(f), - FieldseekerSamplelocationMods.RandomCreator(f), - FieldseekerSamplelocationMods.RandomEditdate(f), - FieldseekerSamplelocationMods.RandomEditor(f), - FieldseekerSamplelocationMods.RandomGeometry(f), - FieldseekerSamplelocationMods.RandomGeospatial(f), - FieldseekerSamplelocationMods.RandomVersion(f), - FieldseekerSamplelocationMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerSamplelocationMods) Objectid(val int64) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) ObjectidFunc(f func() int64) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetObjectid() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomObjectid(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplelocationMods) Name(val null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) NameFunc(f func() null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetName() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomName(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Name = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomNameNotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Name = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplelocationMods) Zone(val null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) ZoneFunc(f func() null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetZone() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomZone(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZoneNotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplelocationMods) Habitat(val null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Habitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) HabitatFunc(f func() null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Habitat = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetHabitat() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomHabitat(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Habitat = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomHabitatNotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Habitat = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplelocationMods) Priority(val null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) PriorityFunc(f func() null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetPriority() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomPriority(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Priority = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomPriorityNotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Priority = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplelocationMods) Usetype(val null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Usetype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) UsetypeFunc(f func() null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Usetype = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetUsetype() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomUsetype(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Usetype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomUsetypeNotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Usetype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplelocationMods) Active(val null.Val[int16]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Active = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) ActiveFunc(f func() null.Val[int16]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Active = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetActive() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomActive(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomActiveNotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) Description(val null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Description = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) DescriptionFunc(f func() null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Description = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetDescription() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomDescription(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Description = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomDescriptionNotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Description = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplelocationMods) Accessdesc(val null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Accessdesc = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) AccessdescFunc(f func() null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Accessdesc = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetAccessdesc() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomAccessdesc(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Accessdesc = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomAccessdescNotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Accessdesc = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplelocationMods) Comments(val null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) CommentsFunc(f func() null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetComments() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomComments(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCommentsNotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplelocationMods) Externalid(val null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) ExternalidFunc(f func() null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetExternalid() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomExternalid(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Externalid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomExternalidNotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Externalid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplelocationMods) Nextactiondatescheduled(val null.Val[time.Time]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) NextactiondatescheduledFunc(f func() null.Val[time.Time]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Nextactiondatescheduled = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetNextactiondatescheduled() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomNextactiondatescheduled(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Nextactiondatescheduled = 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 fieldseekerSamplelocationMods) RandomNextactiondatescheduledNotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Nextactiondatescheduled = 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 fieldseekerSamplelocationMods) Zone2(val null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) Zone2Func(f func() null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetZone2() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomZone2(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZone2NotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplelocationMods) Locationnumber(val null.Val[int32]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Locationnumber = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) LocationnumberFunc(f func() null.Val[int32]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Locationnumber = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetLocationnumber() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomLocationnumber(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Locationnumber = 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 fieldseekerSamplelocationMods) RandomLocationnumberNotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Locationnumber = 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 fieldseekerSamplelocationMods) Globalid(val uuid.UUID) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) GlobalidFunc(f func() uuid.UUID) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetGlobalid() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomGlobalid(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplelocationMods) CreatedUser(val null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetCreatedUser() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomCreatedUser(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplelocationMods) CreatedDate(val null.Val[time.Time]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetCreatedDate() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomCreatedDate(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.CreatedDate = 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 fieldseekerSamplelocationMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.CreatedDate = 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 fieldseekerSamplelocationMods) LastEditedUser(val null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetLastEditedUser() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomLastEditedUser(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplelocationMods) LastEditedDate(val null.Val[time.Time]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetLastEditedDate() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomLastEditedDate(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.LastEditedDate = 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 fieldseekerSamplelocationMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.LastEditedDate = 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 fieldseekerSamplelocationMods) Gatewaysync(val null.Val[int16]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Gatewaysync = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) GatewaysyncFunc(f func() null.Val[int16]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Gatewaysync = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetGatewaysync() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomGatewaysync(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomGatewaysyncNotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) Creationdate(val null.Val[time.Time]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetCreationdate() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomCreationdate(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Creationdate = 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 fieldseekerSamplelocationMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Creationdate = 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 fieldseekerSamplelocationMods) Creator(val null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) CreatorFunc(f func() null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetCreator() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomCreator(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSamplelocationMods) Editdate(val null.Val[time.Time]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetEditdate() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomEditdate(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Editdate = 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 fieldseekerSamplelocationMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Editdate = 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 fieldseekerSamplelocationMods) Editor(val null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) EditorFunc(f func() null.Val[string]) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetEditor() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomEditor(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSamplelocationMods) VersionFunc(f func() int32) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerSamplelocationMods) UnsetVersion() FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - 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 fieldseekerSamplelocationMods) RandomVersion(f *faker.Faker) FieldseekerSamplelocationMod { - return FieldseekerSamplelocationModFunc(func(_ context.Context, o *FieldseekerSamplelocationTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index 2375df74..00000000 --- a/db/factory/fieldseeker.servicerequest.bob.go +++ /dev/null @@ -1,5831 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerServicerequestMod interface { - Apply(context.Context, *FieldseekerServicerequestTemplate) -} - -type FieldseekerServicerequestModFunc func(context.Context, *FieldseekerServicerequestTemplate) - -func (f FieldseekerServicerequestModFunc) Apply(ctx context.Context, n *FieldseekerServicerequestTemplate) { - f(ctx, n) -} - -type FieldseekerServicerequestModSlice []FieldseekerServicerequestMod - -func (mods FieldseekerServicerequestModSlice) Apply(ctx context.Context, n *FieldseekerServicerequestTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerServicerequestTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerServicerequestTemplate struct { - Objectid func() int64 - Recdatetime func() null.Val[time.Time] - Source func() null.Val[string] - Entrytech func() null.Val[string] - 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] - Clremail func() null.Val[string] - Clrcompany func() null.Val[string] - Clraddr1 func() null.Val[string] - Clraddr2 func() null.Val[string] - Clrcity func() null.Val[string] - Clrstate func() null.Val[string] - Clrzip func() null.Val[string] - Clrother func() null.Val[string] - 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[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[int16] - Reqtarget func() null.Val[string] - Reqdescr func() null.Val[string] - Reqnotesfortech func() null.Val[string] - Reqnotesforcust func() null.Val[string] - Reqfldnotes func() null.Val[string] - Reqprogramactions func() null.Val[string] - Datetimeclosed func() null.Val[time.Time] - Techclosed func() null.Val[string] - SRNumber func() null.Val[int32] - Reviewed func() null.Val[int16] - Reviewedby func() null.Val[string] - Revieweddate func() null.Val[time.Time] - 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[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[string] - Recordstatus func() null.Val[int16] - Globalid func() uuid.UUID - CreatedUser func() null.Val[string] - CreatedDate func() null.Val[time.Time] - LastEditedUser func() null.Val[string] - LastEditedDate func() null.Val[time.Time] - Firstresponsedate func() null.Val[time.Time] - Responsedaycount func() null.Val[int16] - Allowed func() null.Val[string] - Xvalue func() null.Val[string] - Yvalue func() null.Val[string] - Validx func() null.Val[string] - Validy func() null.Val[string] - Externalid func() null.Val[string] - Externalerror func() null.Val[string] - Pointlocid func() null.Val[uuid.UUID] - Notified func() null.Val[int16] - Notifieddate func() null.Val[time.Time] - Scheduled func() null.Val[int16] - Scheduleddate func() null.Val[time.Time] - Dog func() null.Val[int32] - SchedulePeriod func() null.Val[string] - ScheduleNotes func() null.Val[string] - 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[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 - H3cell func() null.Val[string] - - 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerServicerequestTemplate) BuildSetter() *models.FieldseekerServicerequestSetter { - m := &models.FieldseekerServicerequestSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Recdatetime != nil { - val := o.Recdatetime() - m.Recdatetime = omitnull.FromNull(val) - } - if o.Source != nil { - val := o.Source() - m.Source = omitnull.FromNull(val) - } - if o.Entrytech != nil { - val := o.Entrytech() - m.Entrytech = omitnull.FromNull(val) - } - if o.Priority != nil { - val := o.Priority() - m.Priority = omitnull.FromNull(val) - } - if o.Supervisor != nil { - val := o.Supervisor() - m.Supervisor = omitnull.FromNull(val) - } - if o.Assignedtech != nil { - val := o.Assignedtech() - m.Assignedtech = omitnull.FromNull(val) - } - if o.Status != nil { - val := o.Status() - m.Status = omitnull.FromNull(val) - } - if o.Clranon != nil { - val := o.Clranon() - m.Clranon = omitnull.FromNull(val) - } - if o.Clrfname != nil { - val := o.Clrfname() - m.Clrfname = 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.Clremail != nil { - val := o.Clremail() - m.Clremail = omitnull.FromNull(val) - } - if o.Clrcompany != nil { - val := o.Clrcompany() - m.Clrcompany = 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.Clrcity != nil { - val := o.Clrcity() - m.Clrcity = 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.Clrother != nil { - val := o.Clrother() - m.Clrother = omitnull.FromNull(val) - } - if o.Clrcontpref != nil { - val := o.Clrcontpref() - m.Clrcontpref = omitnull.FromNull(val) - } - if o.Reqcompany != nil { - val := o.Reqcompany() - m.Reqcompany = 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.Reqstate != nil { - val := o.Reqstate() - m.Reqstate = omitnull.FromNull(val) - } - if o.Reqzip != nil { - val := o.Reqzip() - m.Reqzip = omitnull.FromNull(val) - } - if o.Reqcrossst != nil { - val := o.Reqcrossst() - m.Reqcrossst = omitnull.FromNull(val) - } - if o.Reqsubdiv != nil { - val := o.Reqsubdiv() - m.Reqsubdiv = omitnull.FromNull(val) - } - if o.Reqmapgrid != nil { - val := o.Reqmapgrid() - m.Reqmapgrid = omitnull.FromNull(val) - } - if o.Reqpermission != nil { - val := o.Reqpermission() - m.Reqpermission = omitnull.FromNull(val) - } - if o.Reqtarget != nil { - val := o.Reqtarget() - m.Reqtarget = omitnull.FromNull(val) - } - if o.Reqdescr != nil { - val := o.Reqdescr() - m.Reqdescr = omitnull.FromNull(val) - } - if o.Reqnotesfortech != nil { - val := o.Reqnotesfortech() - m.Reqnotesfortech = omitnull.FromNull(val) - } - if o.Reqnotesforcust != nil { - val := o.Reqnotesforcust() - m.Reqnotesforcust = omitnull.FromNull(val) - } - if o.Reqfldnotes != nil { - val := o.Reqfldnotes() - m.Reqfldnotes = omitnull.FromNull(val) - } - if o.Reqprogramactions != nil { - val := o.Reqprogramactions() - m.Reqprogramactions = omitnull.FromNull(val) - } - if o.Datetimeclosed != nil { - val := o.Datetimeclosed() - m.Datetimeclosed = omitnull.FromNull(val) - } - if o.Techclosed != nil { - val := o.Techclosed() - m.Techclosed = omitnull.FromNull(val) - } - if o.SRNumber != nil { - val := o.SRNumber() - m.SRNumber = 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.Accepted != nil { - val := o.Accepted() - m.Accepted = omitnull.FromNull(val) - } - if o.Accepteddate != nil { - val := o.Accepteddate() - m.Accepteddate = 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.Duedate != nil { - val := o.Duedate() - m.Duedate = omitnull.FromNull(val) - } - if o.Acceptedby != nil { - val := o.Acceptedby() - m.Acceptedby = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Estcompletedate != nil { - val := o.Estcompletedate() - m.Estcompletedate = omitnull.FromNull(val) - } - if o.Nextaction != nil { - val := o.Nextaction() - m.Nextaction = omitnull.FromNull(val) - } - if o.Recordstatus != nil { - val := o.Recordstatus() - m.Recordstatus = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.Firstresponsedate != nil { - val := o.Firstresponsedate() - m.Firstresponsedate = omitnull.FromNull(val) - } - if o.Responsedaycount != nil { - val := o.Responsedaycount() - m.Responsedaycount = omitnull.FromNull(val) - } - if o.Allowed != nil { - val := o.Allowed() - m.Allowed = 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.Validx != nil { - val := o.Validx() - m.Validx = omitnull.FromNull(val) - } - if o.Validy != nil { - val := o.Validy() - m.Validy = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Externalerror != nil { - val := o.Externalerror() - m.Externalerror = omitnull.FromNull(val) - } - if o.Pointlocid != nil { - val := o.Pointlocid() - m.Pointlocid = 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.Scheduled != nil { - val := o.Scheduled() - m.Scheduled = omitnull.FromNull(val) - } - if o.Scheduleddate != nil { - val := o.Scheduleddate() - m.Scheduleddate = omitnull.FromNull(val) - } - if o.Dog != nil { - val := o.Dog() - m.Dog = omitnull.FromNull(val) - } - if o.SchedulePeriod != nil { - val := o.SchedulePeriod() - m.SchedulePeriod = omitnull.FromNull(val) - } - if o.ScheduleNotes != nil { - val := o.ScheduleNotes() - m.ScheduleNotes = omitnull.FromNull(val) - } - if o.Spanish != nil { - val := o.Spanish() - m.Spanish = 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.Issuesreported != nil { - val := o.Issuesreported() - m.Issuesreported = omitnull.FromNull(val) - } - if o.Jurisdiction != nil { - val := o.Jurisdiction() - m.Jurisdiction = omitnull.FromNull(val) - } - if o.Notificationtimestamp != nil { - val := o.Notificationtimestamp() - m.Notificationtimestamp = 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.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 -} - -// BuildManySetter returns an []*models.FieldseekerServicerequestSetter -// this does nothing with the relationship templates -func (o FieldseekerServicerequestTemplate) BuildManySetter(number int) []*models.FieldseekerServicerequestSetter { - m := make([]*models.FieldseekerServicerequestSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerServicerequest -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerServicerequestTemplate.Create -func (o FieldseekerServicerequestTemplate) Build() *models.FieldseekerServicerequest { - m := &models.FieldseekerServicerequest{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Recdatetime != nil { - m.Recdatetime = o.Recdatetime() - } - if o.Source != nil { - m.Source = o.Source() - } - if o.Entrytech != nil { - m.Entrytech = o.Entrytech() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Supervisor != nil { - m.Supervisor = o.Supervisor() - } - if o.Assignedtech != nil { - m.Assignedtech = o.Assignedtech() - } - if o.Status != nil { - m.Status = o.Status() - } - if o.Clranon != nil { - m.Clranon = o.Clranon() - } - if o.Clrfname != nil { - m.Clrfname = o.Clrfname() - } - if o.Clrphone1 != nil { - m.Clrphone1 = o.Clrphone1() - } - if o.Clrphone2 != nil { - m.Clrphone2 = o.Clrphone2() - } - if o.Clremail != nil { - m.Clremail = o.Clremail() - } - if o.Clrcompany != nil { - m.Clrcompany = o.Clrcompany() - } - if o.Clraddr1 != nil { - m.Clraddr1 = o.Clraddr1() - } - if o.Clraddr2 != nil { - m.Clraddr2 = o.Clraddr2() - } - if o.Clrcity != nil { - m.Clrcity = o.Clrcity() - } - if o.Clrstate != nil { - m.Clrstate = o.Clrstate() - } - if o.Clrzip != nil { - m.Clrzip = o.Clrzip() - } - if o.Clrother != nil { - m.Clrother = o.Clrother() - } - if o.Clrcontpref != nil { - m.Clrcontpref = o.Clrcontpref() - } - if o.Reqcompany != nil { - m.Reqcompany = o.Reqcompany() - } - 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.Reqstate != nil { - m.Reqstate = o.Reqstate() - } - if o.Reqzip != nil { - m.Reqzip = o.Reqzip() - } - if o.Reqcrossst != nil { - m.Reqcrossst = o.Reqcrossst() - } - if o.Reqsubdiv != nil { - m.Reqsubdiv = o.Reqsubdiv() - } - if o.Reqmapgrid != nil { - m.Reqmapgrid = o.Reqmapgrid() - } - if o.Reqpermission != nil { - m.Reqpermission = o.Reqpermission() - } - if o.Reqtarget != nil { - m.Reqtarget = o.Reqtarget() - } - if o.Reqdescr != nil { - m.Reqdescr = o.Reqdescr() - } - if o.Reqnotesfortech != nil { - m.Reqnotesfortech = o.Reqnotesfortech() - } - if o.Reqnotesforcust != nil { - m.Reqnotesforcust = o.Reqnotesforcust() - } - if o.Reqfldnotes != nil { - m.Reqfldnotes = o.Reqfldnotes() - } - if o.Reqprogramactions != nil { - m.Reqprogramactions = o.Reqprogramactions() - } - if o.Datetimeclosed != nil { - m.Datetimeclosed = o.Datetimeclosed() - } - if o.Techclosed != nil { - m.Techclosed = o.Techclosed() - } - if o.SRNumber != nil { - m.SRNumber = o.SRNumber() - } - 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.Accepted != nil { - m.Accepted = o.Accepted() - } - if o.Accepteddate != nil { - m.Accepteddate = o.Accepteddate() - } - 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.Duedate != nil { - m.Duedate = o.Duedate() - } - if o.Acceptedby != nil { - m.Acceptedby = o.Acceptedby() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Estcompletedate != nil { - m.Estcompletedate = o.Estcompletedate() - } - if o.Nextaction != nil { - m.Nextaction = o.Nextaction() - } - if o.Recordstatus != nil { - m.Recordstatus = o.Recordstatus() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.Firstresponsedate != nil { - m.Firstresponsedate = o.Firstresponsedate() - } - if o.Responsedaycount != nil { - m.Responsedaycount = o.Responsedaycount() - } - if o.Allowed != nil { - m.Allowed = o.Allowed() - } - if o.Xvalue != nil { - m.Xvalue = o.Xvalue() - } - if o.Yvalue != nil { - m.Yvalue = o.Yvalue() - } - if o.Validx != nil { - m.Validx = o.Validx() - } - if o.Validy != nil { - m.Validy = o.Validy() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Externalerror != nil { - m.Externalerror = o.Externalerror() - } - if o.Pointlocid != nil { - m.Pointlocid = o.Pointlocid() - } - if o.Notified != nil { - m.Notified = o.Notified() - } - if o.Notifieddate != nil { - m.Notifieddate = o.Notifieddate() - } - if o.Scheduled != nil { - m.Scheduled = o.Scheduled() - } - if o.Scheduleddate != nil { - m.Scheduleddate = o.Scheduleddate() - } - if o.Dog != nil { - m.Dog = o.Dog() - } - if o.SchedulePeriod != nil { - m.SchedulePeriod = o.SchedulePeriod() - } - if o.ScheduleNotes != nil { - m.ScheduleNotes = o.ScheduleNotes() - } - if o.Spanish != nil { - m.Spanish = o.Spanish() - } - 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.Issuesreported != nil { - m.Issuesreported = o.Issuesreported() - } - if o.Jurisdiction != nil { - m.Jurisdiction = o.Jurisdiction() - } - if o.Notificationtimestamp != nil { - m.Notificationtimestamp = o.Notificationtimestamp() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - 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() - } - if o.H3cell != nil { - m.H3cell = o.H3cell() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FieldseekerServicerequestSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerServicerequestTemplate.CreateMany -func (o FieldseekerServicerequestTemplate) BuildMany(number int) models.FieldseekerServicerequestSlice { - m := make(models.FieldseekerServicerequestSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerServicerequest(m *models.FieldseekerServicerequestSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerServicerequestTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerServicerequest) error { - var err error - - return err -} - -// Create builds a fieldseekerServicerequest and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerServicerequestTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerServicerequest, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerServicerequest and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerServicerequestTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerServicerequest { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerServicerequest 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 *FieldseekerServicerequestTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerServicerequest { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerServicerequests and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerServicerequestTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerServicerequestSlice, error) { - var err error - m := make(models.FieldseekerServicerequestSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerServicerequests and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerServicerequestTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerServicerequestSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerServicerequests 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 FieldseekerServicerequestTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerServicerequestSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerServicerequest has methods that act as mods for the FieldseekerServicerequestTemplate -var FieldseekerServicerequestMods fieldseekerServicerequestMods - -type fieldseekerServicerequestMods struct{} - -func (m fieldseekerServicerequestMods) RandomizeAllColumns(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModSlice{ - FieldseekerServicerequestMods.RandomObjectid(f), - FieldseekerServicerequestMods.RandomRecdatetime(f), - FieldseekerServicerequestMods.RandomSource(f), - FieldseekerServicerequestMods.RandomEntrytech(f), - FieldseekerServicerequestMods.RandomPriority(f), - FieldseekerServicerequestMods.RandomSupervisor(f), - FieldseekerServicerequestMods.RandomAssignedtech(f), - FieldseekerServicerequestMods.RandomStatus(f), - FieldseekerServicerequestMods.RandomClranon(f), - FieldseekerServicerequestMods.RandomClrfname(f), - FieldseekerServicerequestMods.RandomClrphone1(f), - FieldseekerServicerequestMods.RandomClrphone2(f), - FieldseekerServicerequestMods.RandomClremail(f), - FieldseekerServicerequestMods.RandomClrcompany(f), - FieldseekerServicerequestMods.RandomClraddr1(f), - FieldseekerServicerequestMods.RandomClraddr2(f), - FieldseekerServicerequestMods.RandomClrcity(f), - FieldseekerServicerequestMods.RandomClrstate(f), - FieldseekerServicerequestMods.RandomClrzip(f), - FieldseekerServicerequestMods.RandomClrother(f), - FieldseekerServicerequestMods.RandomClrcontpref(f), - FieldseekerServicerequestMods.RandomReqcompany(f), - FieldseekerServicerequestMods.RandomReqaddr1(f), - FieldseekerServicerequestMods.RandomReqaddr2(f), - FieldseekerServicerequestMods.RandomReqcity(f), - FieldseekerServicerequestMods.RandomReqstate(f), - FieldseekerServicerequestMods.RandomReqzip(f), - FieldseekerServicerequestMods.RandomReqcrossst(f), - FieldseekerServicerequestMods.RandomReqsubdiv(f), - FieldseekerServicerequestMods.RandomReqmapgrid(f), - FieldseekerServicerequestMods.RandomReqpermission(f), - FieldseekerServicerequestMods.RandomReqtarget(f), - FieldseekerServicerequestMods.RandomReqdescr(f), - FieldseekerServicerequestMods.RandomReqnotesfortech(f), - FieldseekerServicerequestMods.RandomReqnotesforcust(f), - FieldseekerServicerequestMods.RandomReqfldnotes(f), - FieldseekerServicerequestMods.RandomReqprogramactions(f), - FieldseekerServicerequestMods.RandomDatetimeclosed(f), - FieldseekerServicerequestMods.RandomTechclosed(f), - FieldseekerServicerequestMods.RandomSRNumber(f), - FieldseekerServicerequestMods.RandomReviewed(f), - FieldseekerServicerequestMods.RandomReviewedby(f), - FieldseekerServicerequestMods.RandomRevieweddate(f), - FieldseekerServicerequestMods.RandomAccepted(f), - FieldseekerServicerequestMods.RandomAccepteddate(f), - FieldseekerServicerequestMods.RandomRejectedby(f), - FieldseekerServicerequestMods.RandomRejecteddate(f), - FieldseekerServicerequestMods.RandomRejectedreason(f), - FieldseekerServicerequestMods.RandomDuedate(f), - FieldseekerServicerequestMods.RandomAcceptedby(f), - FieldseekerServicerequestMods.RandomComments(f), - FieldseekerServicerequestMods.RandomEstcompletedate(f), - FieldseekerServicerequestMods.RandomNextaction(f), - FieldseekerServicerequestMods.RandomRecordstatus(f), - FieldseekerServicerequestMods.RandomGlobalid(f), - FieldseekerServicerequestMods.RandomCreatedUser(f), - FieldseekerServicerequestMods.RandomCreatedDate(f), - FieldseekerServicerequestMods.RandomLastEditedUser(f), - FieldseekerServicerequestMods.RandomLastEditedDate(f), - FieldseekerServicerequestMods.RandomFirstresponsedate(f), - FieldseekerServicerequestMods.RandomResponsedaycount(f), - FieldseekerServicerequestMods.RandomAllowed(f), - FieldseekerServicerequestMods.RandomXvalue(f), - FieldseekerServicerequestMods.RandomYvalue(f), - FieldseekerServicerequestMods.RandomValidx(f), - FieldseekerServicerequestMods.RandomValidy(f), - FieldseekerServicerequestMods.RandomExternalid(f), - FieldseekerServicerequestMods.RandomExternalerror(f), - FieldseekerServicerequestMods.RandomPointlocid(f), - FieldseekerServicerequestMods.RandomNotified(f), - FieldseekerServicerequestMods.RandomNotifieddate(f), - FieldseekerServicerequestMods.RandomScheduled(f), - FieldseekerServicerequestMods.RandomScheduleddate(f), - FieldseekerServicerequestMods.RandomDog(f), - FieldseekerServicerequestMods.RandomSchedulePeriod(f), - FieldseekerServicerequestMods.RandomScheduleNotes(f), - FieldseekerServicerequestMods.RandomSpanish(f), - FieldseekerServicerequestMods.RandomCreationdate(f), - FieldseekerServicerequestMods.RandomCreator(f), - FieldseekerServicerequestMods.RandomEditdate(f), - FieldseekerServicerequestMods.RandomEditor(f), - FieldseekerServicerequestMods.RandomIssuesreported(f), - FieldseekerServicerequestMods.RandomJurisdiction(f), - FieldseekerServicerequestMods.RandomNotificationtimestamp(f), - FieldseekerServicerequestMods.RandomZone(f), - FieldseekerServicerequestMods.RandomZone2(f), - FieldseekerServicerequestMods.RandomGeometry(f), - FieldseekerServicerequestMods.RandomGeospatial(f), - FieldseekerServicerequestMods.RandomVersion(f), - FieldseekerServicerequestMods.RandomOrganizationID(f), - FieldseekerServicerequestMods.RandomH3cell(f), - } -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Objectid(val int64) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ObjectidFunc(f func() int64) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetObjectid() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomObjectid(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Recdatetime(val null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Recdatetime = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) RecdatetimeFunc(f func() null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Recdatetime = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetRecdatetime() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomRecdatetime(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Recdatetime = 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 fieldseekerServicerequestMods) RandomRecdatetimeNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Recdatetime = 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 fieldseekerServicerequestMods) Source(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Source = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) SourceFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Source = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetSource() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomSource(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Source = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSourceNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Source = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Entrytech(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Entrytech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) EntrytechFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Entrytech = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetEntrytech() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomEntrytech(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Entrytech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEntrytechNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Entrytech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Priority(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) PriorityFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetPriority() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomPriority(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Priority = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomPriorityNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Priority = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Supervisor(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Supervisor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) SupervisorFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Supervisor = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetSupervisor() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomSupervisor(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Supervisor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSupervisorNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Supervisor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Assignedtech(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Assignedtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) AssignedtechFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Assignedtech = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetAssignedtech() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomAssignedtech(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Assignedtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomAssignedtechNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Assignedtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Status(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Status = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) StatusFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Status = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetStatus() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomStatus(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Status = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomStatusNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Status = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Clranon(val null.Val[int16]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clranon = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ClranonFunc(f func() null.Val[int16]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clranon = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetClranon() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomClranon(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomClranonNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) Clrfname(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrfname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ClrfnameFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrfname = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetClrfname() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomClrfname(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrfname = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomClrfnameNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrfname = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Clrphone1(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrphone1 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) Clrphone1Func(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrphone1 = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetClrphone1() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomClrphone1(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrphone1 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomClrphone1NotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrphone1 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Clrphone2(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrphone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) Clrphone2Func(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrphone2 = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetClrphone2() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomClrphone2(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrphone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomClrphone2NotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrphone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Clremail(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clremail = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ClremailFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clremail = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetClremail() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomClremail(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clremail = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomClremailNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clremail = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Clrcompany(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrcompany = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ClrcompanyFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrcompany = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetClrcompany() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomClrcompany(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrcompany = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomClrcompanyNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrcompany = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Clraddr1(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clraddr1 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) Clraddr1Func(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clraddr1 = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetClraddr1() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomClraddr1(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clraddr1 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomClraddr1NotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clraddr1 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Clraddr2(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clraddr2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) Clraddr2Func(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clraddr2 = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetClraddr2() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomClraddr2(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clraddr2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomClraddr2NotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clraddr2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Clrcity(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrcity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ClrcityFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrcity = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetClrcity() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomClrcity(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrcity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomClrcityNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrcity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Clrstate(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrstate = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ClrstateFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrstate = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetClrstate() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomClrstate(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrstate = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomClrstateNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrstate = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Clrzip(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrzip = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ClrzipFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrzip = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetClrzip() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomClrzip(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrzip = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomClrzipNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrzip = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Clrother(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrother = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ClrotherFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrother = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetClrother() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomClrother(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrother = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomClrotherNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrother = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Clrcontpref(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrcontpref = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ClrcontprefFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrcontpref = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetClrcontpref() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomClrcontpref(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrcontpref = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomClrcontprefNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Clrcontpref = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Reqcompany(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqcompany = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ReqcompanyFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqcompany = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetReqcompany() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomReqcompany(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqcompany = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReqcompanyNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqcompany = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Reqaddr1(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqaddr1 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) Reqaddr1Func(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqaddr1 = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetReqaddr1() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomReqaddr1(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqaddr1 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReqaddr1NotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqaddr1 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Reqaddr2(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqaddr2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) Reqaddr2Func(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqaddr2 = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetReqaddr2() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomReqaddr2(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqaddr2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReqaddr2NotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqaddr2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Reqcity(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqcity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ReqcityFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqcity = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetReqcity() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomReqcity(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqcity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReqcityNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqcity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Reqstate(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqstate = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ReqstateFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqstate = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetReqstate() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomReqstate(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqstate = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReqstateNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqstate = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Reqzip(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqzip = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ReqzipFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqzip = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetReqzip() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomReqzip(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqzip = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReqzipNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqzip = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Reqcrossst(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqcrossst = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ReqcrossstFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqcrossst = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetReqcrossst() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomReqcrossst(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqcrossst = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReqcrossstNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqcrossst = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Reqsubdiv(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqsubdiv = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ReqsubdivFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqsubdiv = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetReqsubdiv() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomReqsubdiv(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqsubdiv = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReqsubdivNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqsubdiv = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Reqmapgrid(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqmapgrid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ReqmapgridFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqmapgrid = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetReqmapgrid() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomReqmapgrid(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqmapgrid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReqmapgridNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqmapgrid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Reqpermission(val null.Val[int16]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqpermission = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ReqpermissionFunc(f func() null.Val[int16]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqpermission = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetReqpermission() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomReqpermission(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomReqpermissionNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) Reqtarget(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqtarget = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ReqtargetFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqtarget = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetReqtarget() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomReqtarget(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqtarget = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReqtargetNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqtarget = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Reqdescr(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqdescr = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ReqdescrFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqdescr = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetReqdescr() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomReqdescr(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqdescr = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "1000") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReqdescrNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqdescr = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "1000") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Reqnotesfortech(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqnotesfortech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ReqnotesfortechFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqnotesfortech = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetReqnotesfortech() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomReqnotesfortech(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqnotesfortech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReqnotesfortechNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqnotesfortech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Reqnotesforcust(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqnotesforcust = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ReqnotesforcustFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqnotesforcust = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetReqnotesforcust() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomReqnotesforcust(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqnotesforcust = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReqnotesforcustNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqnotesforcust = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Reqfldnotes(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqfldnotes = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ReqfldnotesFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqfldnotes = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetReqfldnotes() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomReqfldnotes(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqfldnotes = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReqfldnotesNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqfldnotes = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Reqprogramactions(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqprogramactions = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ReqprogramactionsFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqprogramactions = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetReqprogramactions() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomReqprogramactions(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqprogramactions = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReqprogramactionsNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reqprogramactions = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Datetimeclosed(val null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Datetimeclosed = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) DatetimeclosedFunc(f func() null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Datetimeclosed = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetDatetimeclosed() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomDatetimeclosed(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Datetimeclosed = 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 fieldseekerServicerequestMods) RandomDatetimeclosedNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Datetimeclosed = 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 fieldseekerServicerequestMods) Techclosed(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Techclosed = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) TechclosedFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Techclosed = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetTechclosed() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomTechclosed(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Techclosed = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomTechclosedNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Techclosed = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) SRNumber(val null.Val[int32]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.SRNumber = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) SRNumberFunc(f func() null.Val[int32]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.SRNumber = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetSRNumber() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomSRNumber(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.SRNumber = 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 fieldseekerServicerequestMods) RandomSRNumberNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.SRNumber = 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 fieldseekerServicerequestMods) Reviewed(val null.Val[int16]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reviewed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ReviewedFunc(f func() null.Val[int16]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reviewed = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetReviewed() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomReviewed(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomReviewedNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) Reviewedby(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reviewedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ReviewedbyFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reviewedby = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetReviewedby() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomReviewedby(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reviewedby = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReviewedbyNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Reviewedby = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Revieweddate(val null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Revieweddate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) RevieweddateFunc(f func() null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Revieweddate = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetRevieweddate() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomRevieweddate(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Revieweddate = 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 fieldseekerServicerequestMods) RandomRevieweddateNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Revieweddate = 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 fieldseekerServicerequestMods) Accepted(val null.Val[int16]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Accepted = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) AcceptedFunc(f func() null.Val[int16]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Accepted = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetAccepted() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomAccepted(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomAcceptedNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) Accepteddate(val null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Accepteddate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) AccepteddateFunc(f func() null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Accepteddate = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetAccepteddate() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomAccepteddate(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Accepteddate = 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 fieldseekerServicerequestMods) RandomAccepteddateNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Accepteddate = 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 fieldseekerServicerequestMods) Rejectedby(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Rejectedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) RejectedbyFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Rejectedby = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetRejectedby() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomRejectedby(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Rejectedby = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomRejectedbyNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Rejectedby = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Rejecteddate(val null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Rejecteddate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) RejecteddateFunc(f func() null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Rejecteddate = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetRejecteddate() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomRejecteddate(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Rejecteddate = 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 fieldseekerServicerequestMods) RandomRejecteddateNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Rejecteddate = 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 fieldseekerServicerequestMods) Rejectedreason(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Rejectedreason = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) RejectedreasonFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Rejectedreason = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetRejectedreason() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomRejectedreason(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Rejectedreason = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomRejectedreasonNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Rejectedreason = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Duedate(val null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Duedate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) DuedateFunc(f func() null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Duedate = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetDuedate() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomDuedate(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Duedate = 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 fieldseekerServicerequestMods) RandomDuedateNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Duedate = 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 fieldseekerServicerequestMods) Acceptedby(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Acceptedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) AcceptedbyFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Acceptedby = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetAcceptedby() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomAcceptedby(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Acceptedby = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomAcceptedbyNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Acceptedby = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Comments(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) CommentsFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetComments() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomComments(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "2500") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCommentsNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "2500") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Estcompletedate(val null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Estcompletedate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) EstcompletedateFunc(f func() null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Estcompletedate = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetEstcompletedate() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomEstcompletedate(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Estcompletedate = 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 fieldseekerServicerequestMods) RandomEstcompletedateNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Estcompletedate = 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 fieldseekerServicerequestMods) Nextaction(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Nextaction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) NextactionFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Nextaction = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetNextaction() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomNextaction(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Nextaction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomNextactionNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Nextaction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Recordstatus(val null.Val[int16]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Recordstatus = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) RecordstatusFunc(f func() null.Val[int16]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Recordstatus = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetRecordstatus() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomRecordstatus(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomRecordstatusNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) Globalid(val uuid.UUID) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) GlobalidFunc(f func() uuid.UUID) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetGlobalid() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomGlobalid(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) CreatedUser(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetCreatedUser() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomCreatedUser(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) CreatedDate(val null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetCreatedDate() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomCreatedDate(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.CreatedDate = 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 fieldseekerServicerequestMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.CreatedDate = 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 fieldseekerServicerequestMods) LastEditedUser(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetLastEditedUser() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomLastEditedUser(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) LastEditedDate(val null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetLastEditedDate() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomLastEditedDate(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.LastEditedDate = 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 fieldseekerServicerequestMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.LastEditedDate = 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 fieldseekerServicerequestMods) Firstresponsedate(val null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Firstresponsedate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) FirstresponsedateFunc(f func() null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Firstresponsedate = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetFirstresponsedate() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomFirstresponsedate(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Firstresponsedate = 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 fieldseekerServicerequestMods) RandomFirstresponsedateNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Firstresponsedate = 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 fieldseekerServicerequestMods) Responsedaycount(val null.Val[int16]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Responsedaycount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ResponsedaycountFunc(f func() null.Val[int16]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Responsedaycount = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetResponsedaycount() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomResponsedaycount(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomResponsedaycountNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) Allowed(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Allowed = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) AllowedFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Allowed = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetAllowed() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomAllowed(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Allowed = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomAllowedNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Allowed = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Xvalue(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Xvalue = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) XvalueFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Xvalue = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetXvalue() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomXvalue(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Xvalue = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomXvalueNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Xvalue = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Yvalue(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Yvalue = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) YvalueFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Yvalue = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetYvalue() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomYvalue(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Yvalue = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomYvalueNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Yvalue = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Validx(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Validx = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ValidxFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Validx = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetValidx() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomValidx(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Validx = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomValidxNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Validx = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Validy(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Validy = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ValidyFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Validy = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetValidy() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomValidy(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Validy = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomValidyNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Validy = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Externalid(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ExternalidFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetExternalid() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomExternalid(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Externalid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomExternalidNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Externalid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Externalerror(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Externalerror = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ExternalerrorFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Externalerror = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetExternalerror() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomExternalerror(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Externalerror = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "500") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomExternalerrorNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Externalerror = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "500") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Pointlocid(val null.Val[uuid.UUID]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Pointlocid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) PointlocidFunc(f func() null.Val[uuid.UUID]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Pointlocid = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetPointlocid() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomPointlocid(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Pointlocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomPointlocidNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Pointlocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Notified(val null.Val[int16]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Notified = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) NotifiedFunc(f func() null.Val[int16]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Notified = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetNotified() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomNotified(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomNotifiedNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) Notifieddate(val null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Notifieddate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) NotifieddateFunc(f func() null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Notifieddate = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetNotifieddate() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomNotifieddate(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Notifieddate = 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 fieldseekerServicerequestMods) RandomNotifieddateNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Notifieddate = 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 fieldseekerServicerequestMods) Scheduled(val null.Val[int16]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Scheduled = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ScheduledFunc(f func() null.Val[int16]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Scheduled = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetScheduled() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomScheduled(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomScheduledNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) Scheduleddate(val null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Scheduleddate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ScheduleddateFunc(f func() null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Scheduleddate = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetScheduleddate() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomScheduleddate(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Scheduleddate = 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 fieldseekerServicerequestMods) RandomScheduleddateNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Scheduleddate = 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 fieldseekerServicerequestMods) Dog(val null.Val[int32]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Dog = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) DogFunc(f func() null.Val[int32]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Dog = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetDog() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomDog(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Dog = 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 fieldseekerServicerequestMods) RandomDogNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Dog = 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 fieldseekerServicerequestMods) SchedulePeriod(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.SchedulePeriod = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) SchedulePeriodFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.SchedulePeriod = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetSchedulePeriod() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomSchedulePeriod(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.SchedulePeriod = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "20") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSchedulePeriodNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.SchedulePeriod = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "20") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) ScheduleNotes(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.ScheduleNotes = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ScheduleNotesFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.ScheduleNotes = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetScheduleNotes() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomScheduleNotes(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.ScheduleNotes = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "256") - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fieldseekerServicerequestMods) RandomScheduleNotesNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.ScheduleNotes = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "256") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Spanish(val null.Val[int32]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Spanish = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) SpanishFunc(f func() null.Val[int32]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Spanish = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetSpanish() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomSpanish(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Spanish = 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 fieldseekerServicerequestMods) RandomSpanishNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Spanish = 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 fieldseekerServicerequestMods) Creationdate(val null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetCreationdate() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomCreationdate(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Creationdate = 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 fieldseekerServicerequestMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Creationdate = 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 fieldseekerServicerequestMods) Creator(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) CreatorFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetCreator() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomCreator(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Editdate(val null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetEditdate() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomEditdate(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Editdate = 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 fieldseekerServicerequestMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Editdate = 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 fieldseekerServicerequestMods) Editor(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) EditorFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetEditor() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomEditor(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Issuesreported(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Issuesreported = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) IssuesreportedFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Issuesreported = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetIssuesreported() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomIssuesreported(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Issuesreported = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomIssuesreportedNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Issuesreported = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Jurisdiction(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Jurisdiction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) JurisdictionFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Jurisdiction = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetJurisdiction() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomJurisdiction(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Jurisdiction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomJurisdictionNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Jurisdiction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Notificationtimestamp(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Notificationtimestamp = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) NotificationtimestampFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Notificationtimestamp = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetNotificationtimestamp() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomNotificationtimestamp(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Notificationtimestamp = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomNotificationtimestampNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Notificationtimestamp = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Zone(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) ZoneFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetZone() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomZone(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZoneNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) Zone2(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) Zone2Func(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetZone2() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomZone2(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZone2NotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) VersionFunc(f func() int32) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetVersion() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - 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 fieldseekerServicerequestMods) RandomVersion(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerServicerequestMods) H3cell(val null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.H3cell = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerServicerequestMods) H3cellFunc(f func() null.Val[string]) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.H3cell = f - }) -} - -// Clear any values for the column -func (m fieldseekerServicerequestMods) UnsetH3cell() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.H3cell = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m fieldseekerServicerequestMods) RandomH3cell(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.H3cell = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fieldseekerServicerequestMods) RandomH3cellNotNull(f *faker.Faker) FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(_ context.Context, o *FieldseekerServicerequestTemplate) { - o.H3cell = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -func (m fieldseekerServicerequestMods) WithParentsCascading() FieldseekerServicerequestMod { - return FieldseekerServicerequestModFunc(func(ctx context.Context, o *FieldseekerServicerequestTemplate) { - if isDone, _ := fieldseekerServicerequestWithParentsCascadingCtx.Value(ctx); isDone { - 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 deleted file mode 100644 index 958d702d..00000000 --- a/db/factory/fieldseeker.speciesabundance.bob.go +++ /dev/null @@ -1,2239 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerSpeciesabundanceMod interface { - Apply(context.Context, *FieldseekerSpeciesabundanceTemplate) -} - -type FieldseekerSpeciesabundanceModFunc func(context.Context, *FieldseekerSpeciesabundanceTemplate) - -func (f FieldseekerSpeciesabundanceModFunc) Apply(ctx context.Context, n *FieldseekerSpeciesabundanceTemplate) { - f(ctx, n) -} - -type FieldseekerSpeciesabundanceModSlice []FieldseekerSpeciesabundanceMod - -func (mods FieldseekerSpeciesabundanceModSlice) Apply(ctx context.Context, n *FieldseekerSpeciesabundanceTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerSpeciesabundanceTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerSpeciesabundanceTemplate struct { - Objectid func() int64 - TrapdataID func() null.Val[uuid.UUID] - Species func() null.Val[string] - Males func() null.Val[int16] - Unknown func() null.Val[int16] - Bloodedfem func() null.Val[int16] - Gravidfem func() null.Val[int16] - Larvae func() null.Val[int16] - Poolstogen func() null.Val[int16] - Processed func() null.Val[int16] - Globalid func() uuid.UUID - CreatedUser func() null.Val[string] - CreatedDate func() null.Val[time.Time] - LastEditedUser func() null.Val[string] - LastEditedDate func() null.Val[time.Time] - Pupae func() null.Val[int16] - Eggs func() null.Val[int16] - Females func() null.Val[int32] - Total 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] - Yearweek func() null.Val[int32] - Globalzscore func() null.Val[float64] - R7score func() null.Val[float64] - 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerSpeciesabundanceTemplate) BuildSetter() *models.FieldseekerSpeciesabundanceSetter { - m := &models.FieldseekerSpeciesabundanceSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.TrapdataID != nil { - val := o.TrapdataID() - m.TrapdataID = omitnull.FromNull(val) - } - if o.Species != nil { - val := o.Species() - m.Species = omitnull.FromNull(val) - } - if o.Males != nil { - val := o.Males() - m.Males = omitnull.FromNull(val) - } - if o.Unknown != nil { - val := o.Unknown() - m.Unknown = omitnull.FromNull(val) - } - if o.Bloodedfem != nil { - val := o.Bloodedfem() - m.Bloodedfem = omitnull.FromNull(val) - } - if o.Gravidfem != nil { - val := o.Gravidfem() - m.Gravidfem = omitnull.FromNull(val) - } - if o.Larvae != nil { - val := o.Larvae() - m.Larvae = omitnull.FromNull(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.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.Pupae != nil { - val := o.Pupae() - m.Pupae = omitnull.FromNull(val) - } - if o.Eggs != nil { - val := o.Eggs() - m.Eggs = omitnull.FromNull(val) - } - if o.Females != nil { - val := o.Females() - m.Females = omitnull.FromNull(val) - } - if o.Total != nil { - val := o.Total() - m.Total = 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.Yearweek != nil { - val := o.Yearweek() - m.Yearweek = omitnull.FromNull(val) - } - if o.Globalzscore != nil { - val := o.Globalzscore() - m.Globalzscore = 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.H3R7 != nil { - val := o.H3R7() - m.H3R7 = omitnull.FromNull(val) - } - if o.H3R8 != nil { - 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 -} - -// BuildManySetter returns an []*models.FieldseekerSpeciesabundanceSetter -// this does nothing with the relationship templates -func (o FieldseekerSpeciesabundanceTemplate) BuildManySetter(number int) []*models.FieldseekerSpeciesabundanceSetter { - m := make([]*models.FieldseekerSpeciesabundanceSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerSpeciesabundance -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerSpeciesabundanceTemplate.Create -func (o FieldseekerSpeciesabundanceTemplate) Build() *models.FieldseekerSpeciesabundance { - m := &models.FieldseekerSpeciesabundance{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.TrapdataID != nil { - m.TrapdataID = o.TrapdataID() - } - if o.Species != nil { - m.Species = o.Species() - } - if o.Males != nil { - m.Males = o.Males() - } - if o.Unknown != nil { - m.Unknown = o.Unknown() - } - if o.Bloodedfem != nil { - m.Bloodedfem = o.Bloodedfem() - } - if o.Gravidfem != nil { - m.Gravidfem = o.Gravidfem() - } - if o.Larvae != nil { - m.Larvae = o.Larvae() - } - if o.Poolstogen != nil { - m.Poolstogen = o.Poolstogen() - } - if o.Processed != nil { - m.Processed = o.Processed() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.Pupae != nil { - m.Pupae = o.Pupae() - } - if o.Eggs != nil { - m.Eggs = o.Eggs() - } - if o.Females != nil { - m.Females = o.Females() - } - if o.Total != nil { - m.Total = o.Total() - } - 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.Yearweek != nil { - m.Yearweek = o.Yearweek() - } - if o.Globalzscore != nil { - m.Globalzscore = o.Globalzscore() - } - if o.R7score != nil { - m.R7score = o.R7score() - } - if o.R8score != nil { - m.R8score = o.R8score() - } - if o.H3R7 != nil { - m.H3R7 = o.H3R7() - } - 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) - - return m -} - -// BuildMany returns an models.FieldseekerSpeciesabundanceSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerSpeciesabundanceTemplate.CreateMany -func (o FieldseekerSpeciesabundanceTemplate) BuildMany(number int) models.FieldseekerSpeciesabundanceSlice { - m := make(models.FieldseekerSpeciesabundanceSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerSpeciesabundance(m *models.FieldseekerSpeciesabundanceSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerSpeciesabundanceTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerSpeciesabundance) error { - var err error - - return err -} - -// Create builds a fieldseekerSpeciesabundance and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerSpeciesabundanceTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerSpeciesabundance, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerSpeciesabundance and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerSpeciesabundanceTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerSpeciesabundance { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerSpeciesabundance 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 *FieldseekerSpeciesabundanceTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerSpeciesabundance { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerSpeciesabundances and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerSpeciesabundanceTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerSpeciesabundanceSlice, error) { - var err error - m := make(models.FieldseekerSpeciesabundanceSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerSpeciesabundances and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerSpeciesabundanceTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerSpeciesabundanceSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerSpeciesabundances 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 FieldseekerSpeciesabundanceTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerSpeciesabundanceSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerSpeciesabundance has methods that act as mods for the FieldseekerSpeciesabundanceTemplate -var FieldseekerSpeciesabundanceMods fieldseekerSpeciesabundanceMods - -type fieldseekerSpeciesabundanceMods struct{} - -func (m fieldseekerSpeciesabundanceMods) RandomizeAllColumns(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModSlice{ - FieldseekerSpeciesabundanceMods.RandomObjectid(f), - FieldseekerSpeciesabundanceMods.RandomTrapdataID(f), - FieldseekerSpeciesabundanceMods.RandomSpecies(f), - FieldseekerSpeciesabundanceMods.RandomMales(f), - FieldseekerSpeciesabundanceMods.RandomUnknown(f), - FieldseekerSpeciesabundanceMods.RandomBloodedfem(f), - FieldseekerSpeciesabundanceMods.RandomGravidfem(f), - FieldseekerSpeciesabundanceMods.RandomLarvae(f), - FieldseekerSpeciesabundanceMods.RandomPoolstogen(f), - FieldseekerSpeciesabundanceMods.RandomProcessed(f), - FieldseekerSpeciesabundanceMods.RandomGlobalid(f), - FieldseekerSpeciesabundanceMods.RandomCreatedUser(f), - FieldseekerSpeciesabundanceMods.RandomCreatedDate(f), - FieldseekerSpeciesabundanceMods.RandomLastEditedUser(f), - FieldseekerSpeciesabundanceMods.RandomLastEditedDate(f), - FieldseekerSpeciesabundanceMods.RandomPupae(f), - FieldseekerSpeciesabundanceMods.RandomEggs(f), - FieldseekerSpeciesabundanceMods.RandomFemales(f), - FieldseekerSpeciesabundanceMods.RandomTotal(f), - FieldseekerSpeciesabundanceMods.RandomCreationdate(f), - FieldseekerSpeciesabundanceMods.RandomCreator(f), - FieldseekerSpeciesabundanceMods.RandomEditdate(f), - FieldseekerSpeciesabundanceMods.RandomEditor(f), - FieldseekerSpeciesabundanceMods.RandomYearweek(f), - FieldseekerSpeciesabundanceMods.RandomGlobalzscore(f), - FieldseekerSpeciesabundanceMods.RandomR7score(f), - FieldseekerSpeciesabundanceMods.RandomR8score(f), - FieldseekerSpeciesabundanceMods.RandomH3R7(f), - FieldseekerSpeciesabundanceMods.RandomH3R8(f), - FieldseekerSpeciesabundanceMods.RandomGeometry(f), - FieldseekerSpeciesabundanceMods.RandomGeospatial(f), - FieldseekerSpeciesabundanceMods.RandomVersion(f), - FieldseekerSpeciesabundanceMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerSpeciesabundanceMods) Objectid(val int64) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) ObjectidFunc(f func() int64) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetObjectid() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomObjectid(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSpeciesabundanceMods) TrapdataID(val null.Val[uuid.UUID]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.TrapdataID = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) TrapdataIDFunc(f func() null.Val[uuid.UUID]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.TrapdataID = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetTrapdataID() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomTrapdataID(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.TrapdataID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomTrapdataIDNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.TrapdataID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSpeciesabundanceMods) Species(val null.Val[string]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Species = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) SpeciesFunc(f func() null.Val[string]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Species = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetSpecies() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomSpecies(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Species = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSpeciesNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Species = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSpeciesabundanceMods) Males(val null.Val[int16]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Males = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) MalesFunc(f func() null.Val[int16]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Males = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetMales() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomMales(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomMalesNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) Unknown(val null.Val[int16]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Unknown = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) UnknownFunc(f func() null.Val[int16]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Unknown = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetUnknown() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomUnknown(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomUnknownNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) Bloodedfem(val null.Val[int16]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Bloodedfem = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) BloodedfemFunc(f func() null.Val[int16]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Bloodedfem = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetBloodedfem() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomBloodedfem(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomBloodedfemNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) Gravidfem(val null.Val[int16]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Gravidfem = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) GravidfemFunc(f func() null.Val[int16]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Gravidfem = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetGravidfem() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomGravidfem(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomGravidfemNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) Larvae(val null.Val[int16]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Larvae = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) LarvaeFunc(f func() null.Val[int16]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Larvae = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetLarvae() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomLarvae(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomLarvaeNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) Poolstogen(val null.Val[int16]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Poolstogen = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) PoolstogenFunc(f func() null.Val[int16]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Poolstogen = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetPoolstogen() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomPoolstogen(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomPoolstogenNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) Processed(val null.Val[int16]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Processed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) ProcessedFunc(f func() null.Val[int16]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Processed = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetProcessed() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomProcessed(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomProcessedNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) Globalid(val uuid.UUID) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) GlobalidFunc(f func() uuid.UUID) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetGlobalid() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomGlobalid(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSpeciesabundanceMods) CreatedUser(val null.Val[string]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetCreatedUser() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomCreatedUser(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSpeciesabundanceMods) CreatedDate(val null.Val[time.Time]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetCreatedDate() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomCreatedDate(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.CreatedDate = 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 fieldseekerSpeciesabundanceMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.CreatedDate = 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 fieldseekerSpeciesabundanceMods) LastEditedUser(val null.Val[string]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetLastEditedUser() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomLastEditedUser(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSpeciesabundanceMods) LastEditedDate(val null.Val[time.Time]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetLastEditedDate() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomLastEditedDate(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.LastEditedDate = 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 fieldseekerSpeciesabundanceMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.LastEditedDate = 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 fieldseekerSpeciesabundanceMods) Pupae(val null.Val[int16]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Pupae = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) PupaeFunc(f func() null.Val[int16]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Pupae = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetPupae() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomPupae(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomPupaeNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) Eggs(val null.Val[int16]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Eggs = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) EggsFunc(f func() null.Val[int16]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Eggs = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetEggs() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomEggs(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomEggsNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) Females(val null.Val[int32]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Females = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) FemalesFunc(f func() null.Val[int32]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Females = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetFemales() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomFemales(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Females = 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 fieldseekerSpeciesabundanceMods) RandomFemalesNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Females = 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 fieldseekerSpeciesabundanceMods) Total(val null.Val[int32]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Total = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) TotalFunc(f func() null.Val[int32]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Total = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetTotal() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomTotal(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Total = 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 fieldseekerSpeciesabundanceMods) RandomTotalNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Total = 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 fieldseekerSpeciesabundanceMods) Creationdate(val null.Val[time.Time]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetCreationdate() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomCreationdate(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Creationdate = 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 fieldseekerSpeciesabundanceMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Creationdate = 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 fieldseekerSpeciesabundanceMods) Creator(val null.Val[string]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) CreatorFunc(f func() null.Val[string]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetCreator() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomCreator(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSpeciesabundanceMods) Editdate(val null.Val[time.Time]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetEditdate() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomEditdate(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Editdate = 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 fieldseekerSpeciesabundanceMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Editdate = 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 fieldseekerSpeciesabundanceMods) Editor(val null.Val[string]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) EditorFunc(f func() null.Val[string]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetEditor() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomEditor(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSpeciesabundanceMods) Yearweek(val null.Val[int32]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Yearweek = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) YearweekFunc(f func() null.Val[int32]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Yearweek = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetYearweek() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomYearweek(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Yearweek = 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 fieldseekerSpeciesabundanceMods) RandomYearweekNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Yearweek = 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 fieldseekerSpeciesabundanceMods) Globalzscore(val null.Val[float64]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Globalzscore = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) GlobalzscoreFunc(f func() null.Val[float64]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Globalzscore = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetGlobalzscore() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomGlobalzscore(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomGlobalzscoreNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) R7score(val null.Val[float64]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.R7score = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) R7scoreFunc(f func() null.Val[float64]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.R7score = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetR7score() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomR7score(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomR7scoreNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) R8score(val null.Val[float64]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.R8score = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) R8scoreFunc(f func() null.Val[float64]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.R8score = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetR8score() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomR8score(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomR8scoreNotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) H3R7(val null.Val[string]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.H3R7 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) H3R7Func(f func() null.Val[string]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.H3R7 = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetH3R7() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomH3R7(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.H3R7 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "256") - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fieldseekerSpeciesabundanceMods) RandomH3R7NotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.H3R7 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "256") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSpeciesabundanceMods) H3R8(val null.Val[string]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.H3R8 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) H3R8Func(f func() null.Val[string]) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.H3R8 = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetH3R8() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomH3R8(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.H3R8 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "256") - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fieldseekerSpeciesabundanceMods) RandomH3R8NotNull(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.H3R8 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "256") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSpeciesabundanceMods) VersionFunc(f func() int32) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerSpeciesabundanceMods) UnsetVersion() FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - 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 fieldseekerSpeciesabundanceMods) RandomVersion(f *faker.Faker) FieldseekerSpeciesabundanceMod { - return FieldseekerSpeciesabundanceModFunc(func(_ context.Context, o *FieldseekerSpeciesabundanceTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index c3d5ac53..00000000 --- a/db/factory/fieldseeker.stormdrain.bob.go +++ /dev/null @@ -1,1619 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerStormdrainMod interface { - Apply(context.Context, *FieldseekerStormdrainTemplate) -} - -type FieldseekerStormdrainModFunc func(context.Context, *FieldseekerStormdrainTemplate) - -func (f FieldseekerStormdrainModFunc) Apply(ctx context.Context, n *FieldseekerStormdrainTemplate) { - f(ctx, n) -} - -type FieldseekerStormdrainModSlice []FieldseekerStormdrainMod - -func (mods FieldseekerStormdrainModSlice) Apply(ctx context.Context, n *FieldseekerStormdrainTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerStormdrainTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerStormdrainTemplate struct { - Objectid func() int64 - Nexttreatmentdate func() null.Val[time.Time] - Lasttreatdate func() null.Val[time.Time] - Lastaction func() null.Val[string] - Symbology func() null.Val[string] - Globalid func() uuid.UUID - CreatedUser func() null.Val[string] - CreatedDate func() null.Val[time.Time] - LastEditedUser func() null.Val[string] - LastEditedDate func() null.Val[time.Time] - Laststatus func() null.Val[string] - Zone func() null.Val[string] - Zone2 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] - 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerStormdrainTemplate) BuildSetter() *models.FieldseekerStormdrainSetter { - m := &models.FieldseekerStormdrainSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Nexttreatmentdate != nil { - val := o.Nexttreatmentdate() - m.Nexttreatmentdate = omitnull.FromNull(val) - } - if o.Lasttreatdate != nil { - val := o.Lasttreatdate() - m.Lasttreatdate = omitnull.FromNull(val) - } - if o.Lastaction != nil { - val := o.Lastaction() - m.Lastaction = omitnull.FromNull(val) - } - if o.Symbology != nil { - val := o.Symbology() - m.Symbology = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.Laststatus != nil { - val := o.Laststatus() - m.Laststatus = 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.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.Type != nil { - val := o.Type() - m.Type = omitnull.FromNull(val) - } - if o.Jurisdiction != nil { - 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 -} - -// BuildManySetter returns an []*models.FieldseekerStormdrainSetter -// this does nothing with the relationship templates -func (o FieldseekerStormdrainTemplate) BuildManySetter(number int) []*models.FieldseekerStormdrainSetter { - m := make([]*models.FieldseekerStormdrainSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerStormdrain -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerStormdrainTemplate.Create -func (o FieldseekerStormdrainTemplate) Build() *models.FieldseekerStormdrain { - m := &models.FieldseekerStormdrain{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Nexttreatmentdate != nil { - m.Nexttreatmentdate = o.Nexttreatmentdate() - } - if o.Lasttreatdate != nil { - m.Lasttreatdate = o.Lasttreatdate() - } - if o.Lastaction != nil { - m.Lastaction = o.Lastaction() - } - if o.Symbology != nil { - m.Symbology = o.Symbology() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.Laststatus != nil { - m.Laststatus = o.Laststatus() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - 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.Type != nil { - m.Type = o.Type() - } - 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) - - return m -} - -// BuildMany returns an models.FieldseekerStormdrainSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerStormdrainTemplate.CreateMany -func (o FieldseekerStormdrainTemplate) BuildMany(number int) models.FieldseekerStormdrainSlice { - m := make(models.FieldseekerStormdrainSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerStormdrain(m *models.FieldseekerStormdrainSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerStormdrainTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerStormdrain) error { - var err error - - return err -} - -// Create builds a fieldseekerStormdrain and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerStormdrainTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerStormdrain, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerStormdrain and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerStormdrainTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerStormdrain { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerStormdrain 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 *FieldseekerStormdrainTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerStormdrain { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerStormdrains and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerStormdrainTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerStormdrainSlice, error) { - var err error - m := make(models.FieldseekerStormdrainSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerStormdrains and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerStormdrainTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerStormdrainSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerStormdrains 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 FieldseekerStormdrainTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerStormdrainSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerStormdrain has methods that act as mods for the FieldseekerStormdrainTemplate -var FieldseekerStormdrainMods fieldseekerStormdrainMods - -type fieldseekerStormdrainMods struct{} - -func (m fieldseekerStormdrainMods) RandomizeAllColumns(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModSlice{ - FieldseekerStormdrainMods.RandomObjectid(f), - FieldseekerStormdrainMods.RandomNexttreatmentdate(f), - FieldseekerStormdrainMods.RandomLasttreatdate(f), - FieldseekerStormdrainMods.RandomLastaction(f), - FieldseekerStormdrainMods.RandomSymbology(f), - FieldseekerStormdrainMods.RandomGlobalid(f), - FieldseekerStormdrainMods.RandomCreatedUser(f), - FieldseekerStormdrainMods.RandomCreatedDate(f), - FieldseekerStormdrainMods.RandomLastEditedUser(f), - FieldseekerStormdrainMods.RandomLastEditedDate(f), - FieldseekerStormdrainMods.RandomLaststatus(f), - FieldseekerStormdrainMods.RandomZone(f), - FieldseekerStormdrainMods.RandomZone2(f), - FieldseekerStormdrainMods.RandomCreationdate(f), - FieldseekerStormdrainMods.RandomCreator(f), - FieldseekerStormdrainMods.RandomEditdate(f), - FieldseekerStormdrainMods.RandomEditor(f), - FieldseekerStormdrainMods.RandomType(f), - FieldseekerStormdrainMods.RandomJurisdiction(f), - FieldseekerStormdrainMods.RandomGeometry(f), - FieldseekerStormdrainMods.RandomGeospatial(f), - FieldseekerStormdrainMods.RandomVersion(f), - FieldseekerStormdrainMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerStormdrainMods) Objectid(val int64) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerStormdrainMods) ObjectidFunc(f func() int64) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerStormdrainMods) UnsetObjectid() FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - 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 fieldseekerStormdrainMods) RandomObjectid(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerStormdrainMods) Nexttreatmentdate(val null.Val[time.Time]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Nexttreatmentdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerStormdrainMods) NexttreatmentdateFunc(f func() null.Val[time.Time]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Nexttreatmentdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerStormdrainMods) UnsetNexttreatmentdate() FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - 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 fieldseekerStormdrainMods) RandomNexttreatmentdate(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Nexttreatmentdate = 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 fieldseekerStormdrainMods) RandomNexttreatmentdateNotNull(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Nexttreatmentdate = 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 fieldseekerStormdrainMods) Lasttreatdate(val null.Val[time.Time]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Lasttreatdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerStormdrainMods) LasttreatdateFunc(f func() null.Val[time.Time]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Lasttreatdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerStormdrainMods) UnsetLasttreatdate() FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - 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 fieldseekerStormdrainMods) RandomLasttreatdate(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Lasttreatdate = 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 fieldseekerStormdrainMods) RandomLasttreatdateNotNull(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Lasttreatdate = 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 fieldseekerStormdrainMods) Lastaction(val null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Lastaction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerStormdrainMods) LastactionFunc(f func() null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Lastaction = f - }) -} - -// Clear any values for the column -func (m fieldseekerStormdrainMods) UnsetLastaction() FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - 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 fieldseekerStormdrainMods) RandomLastaction(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Lastaction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastactionNotNull(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Lastaction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerStormdrainMods) Symbology(val null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Symbology = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerStormdrainMods) SymbologyFunc(f func() null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Symbology = f - }) -} - -// Clear any values for the column -func (m fieldseekerStormdrainMods) UnsetSymbology() FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - 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 fieldseekerStormdrainMods) RandomSymbology(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Symbology = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSymbologyNotNull(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Symbology = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerStormdrainMods) Globalid(val uuid.UUID) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerStormdrainMods) GlobalidFunc(f func() uuid.UUID) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerStormdrainMods) UnsetGlobalid() FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - 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 fieldseekerStormdrainMods) RandomGlobalid(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerStormdrainMods) CreatedUser(val null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerStormdrainMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerStormdrainMods) UnsetCreatedUser() FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - 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 fieldseekerStormdrainMods) RandomCreatedUser(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerStormdrainMods) CreatedDate(val null.Val[time.Time]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerStormdrainMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerStormdrainMods) UnsetCreatedDate() FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - 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 fieldseekerStormdrainMods) RandomCreatedDate(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.CreatedDate = 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 fieldseekerStormdrainMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.CreatedDate = 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 fieldseekerStormdrainMods) LastEditedUser(val null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerStormdrainMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerStormdrainMods) UnsetLastEditedUser() FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - 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 fieldseekerStormdrainMods) RandomLastEditedUser(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerStormdrainMods) LastEditedDate(val null.Val[time.Time]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerStormdrainMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerStormdrainMods) UnsetLastEditedDate() FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - 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 fieldseekerStormdrainMods) RandomLastEditedDate(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.LastEditedDate = 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 fieldseekerStormdrainMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.LastEditedDate = 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 fieldseekerStormdrainMods) Laststatus(val null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Laststatus = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerStormdrainMods) LaststatusFunc(f func() null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Laststatus = f - }) -} - -// Clear any values for the column -func (m fieldseekerStormdrainMods) UnsetLaststatus() FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - 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 fieldseekerStormdrainMods) RandomLaststatus(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Laststatus = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLaststatusNotNull(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Laststatus = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerStormdrainMods) Zone(val null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerStormdrainMods) ZoneFunc(f func() null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fieldseekerStormdrainMods) UnsetZone() FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - 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 fieldseekerStormdrainMods) RandomZone(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZoneNotNull(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerStormdrainMods) Zone2(val null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerStormdrainMods) Zone2Func(f func() null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fieldseekerStormdrainMods) UnsetZone2() FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - 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 fieldseekerStormdrainMods) RandomZone2(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZone2NotNull(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerStormdrainMods) Creationdate(val null.Val[time.Time]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerStormdrainMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerStormdrainMods) UnsetCreationdate() FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - 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 fieldseekerStormdrainMods) RandomCreationdate(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Creationdate = 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 fieldseekerStormdrainMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Creationdate = 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 fieldseekerStormdrainMods) Creator(val null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerStormdrainMods) CreatorFunc(f func() null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerStormdrainMods) UnsetCreator() FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - 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 fieldseekerStormdrainMods) RandomCreator(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerStormdrainMods) Editdate(val null.Val[time.Time]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerStormdrainMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerStormdrainMods) UnsetEditdate() FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - 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 fieldseekerStormdrainMods) RandomEditdate(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Editdate = 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 fieldseekerStormdrainMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Editdate = 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 fieldseekerStormdrainMods) Editor(val null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerStormdrainMods) EditorFunc(f func() null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerStormdrainMods) UnsetEditor() FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - 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 fieldseekerStormdrainMods) RandomEditor(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerStormdrainMods) Type(val null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Type = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerStormdrainMods) TypeFunc(f func() null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Type = f - }) -} - -// Clear any values for the column -func (m fieldseekerStormdrainMods) UnsetType() FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - 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 fieldseekerStormdrainMods) RandomType(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Type = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomTypeNotNull(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Type = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerStormdrainMods) Jurisdiction(val null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Jurisdiction = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerStormdrainMods) JurisdictionFunc(f func() null.Val[string]) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Jurisdiction = f - }) -} - -// Clear any values for the column -func (m fieldseekerStormdrainMods) UnsetJurisdiction() FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - 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 fieldseekerStormdrainMods) RandomJurisdiction(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Jurisdiction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomJurisdictionNotNull(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Jurisdiction = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerStormdrainMods) VersionFunc(f func() int32) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerStormdrainMods) UnsetVersion() FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - 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 fieldseekerStormdrainMods) RandomVersion(f *faker.Faker) FieldseekerStormdrainMod { - return FieldseekerStormdrainModFunc(func(_ context.Context, o *FieldseekerStormdrainTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index f962dc43..00000000 --- a/db/factory/fieldseeker.timecard.bob.go +++ /dev/null @@ -1,2177 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerTimecardMod interface { - Apply(context.Context, *FieldseekerTimecardTemplate) -} - -type FieldseekerTimecardModFunc func(context.Context, *FieldseekerTimecardTemplate) - -func (f FieldseekerTimecardModFunc) Apply(ctx context.Context, n *FieldseekerTimecardTemplate) { - f(ctx, n) -} - -type FieldseekerTimecardModSlice []FieldseekerTimecardMod - -func (mods FieldseekerTimecardModSlice) Apply(ctx context.Context, n *FieldseekerTimecardTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerTimecardTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerTimecardTemplate struct { - Objectid func() int64 - 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[string] - Locationname func() null.Val[string] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - Globalid func() uuid.UUID - CreatedUser func() null.Val[string] - CreatedDate func() null.Val[time.Time] - LastEditedUser func() null.Val[string] - LastEditedDate func() null.Val[time.Time] - Linelocid func() null.Val[uuid.UUID] - Pointlocid func() null.Val[uuid.UUID] - Polygonlocid func() null.Val[uuid.UUID] - Lclocid func() null.Val[uuid.UUID] - Samplelocid func() null.Val[uuid.UUID] - Srid func() null.Val[uuid.UUID] - Traplocid func() null.Val[uuid.UUID] - Fieldtech 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] - 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerTimecardTemplate) BuildSetter() *models.FieldseekerTimecardSetter { - m := &models.FieldseekerTimecardSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Activity != nil { - val := o.Activity() - m.Activity = omitnull.FromNull(val) - } - if o.Startdatetime != nil { - val := o.Startdatetime() - m.Startdatetime = omitnull.FromNull(val) - } - if o.Enddatetime != nil { - val := o.Enddatetime() - m.Enddatetime = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Equiptype != nil { - val := o.Equiptype() - m.Equiptype = omitnull.FromNull(val) - } - if o.Locationname != nil { - val := o.Locationname() - m.Locationname = 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.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.Linelocid != nil { - val := o.Linelocid() - m.Linelocid = 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.Lclocid != nil { - val := o.Lclocid() - m.Lclocid = 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.Traplocid != nil { - val := o.Traplocid() - m.Traplocid = omitnull.FromNull(val) - } - if o.Fieldtech != nil { - val := o.Fieldtech() - m.Fieldtech = 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.Rodentlocid != nil { - 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 -} - -// BuildManySetter returns an []*models.FieldseekerTimecardSetter -// this does nothing with the relationship templates -func (o FieldseekerTimecardTemplate) BuildManySetter(number int) []*models.FieldseekerTimecardSetter { - m := make([]*models.FieldseekerTimecardSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerTimecard -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerTimecardTemplate.Create -func (o FieldseekerTimecardTemplate) Build() *models.FieldseekerTimecard { - m := &models.FieldseekerTimecard{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Activity != nil { - m.Activity = o.Activity() - } - if o.Startdatetime != nil { - m.Startdatetime = o.Startdatetime() - } - if o.Enddatetime != nil { - m.Enddatetime = o.Enddatetime() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Equiptype != nil { - m.Equiptype = o.Equiptype() - } - if o.Locationname != nil { - m.Locationname = o.Locationname() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.Linelocid != nil { - m.Linelocid = o.Linelocid() - } - if o.Pointlocid != nil { - m.Pointlocid = o.Pointlocid() - } - if o.Polygonlocid != nil { - m.Polygonlocid = o.Polygonlocid() - } - if o.Lclocid != nil { - m.Lclocid = o.Lclocid() - } - if o.Samplelocid != nil { - m.Samplelocid = o.Samplelocid() - } - if o.Srid != nil { - m.Srid = o.Srid() - } - if o.Traplocid != nil { - m.Traplocid = o.Traplocid() - } - if o.Fieldtech != nil { - m.Fieldtech = o.Fieldtech() - } - 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.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) - - return m -} - -// BuildMany returns an models.FieldseekerTimecardSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerTimecardTemplate.CreateMany -func (o FieldseekerTimecardTemplate) BuildMany(number int) models.FieldseekerTimecardSlice { - m := make(models.FieldseekerTimecardSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerTimecard(m *models.FieldseekerTimecardSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerTimecardTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerTimecard) error { - var err error - - return err -} - -// Create builds a fieldseekerTimecard and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerTimecardTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerTimecard, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerTimecard and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerTimecardTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerTimecard { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerTimecard 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 *FieldseekerTimecardTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerTimecard { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerTimecards and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerTimecardTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerTimecardSlice, error) { - var err error - m := make(models.FieldseekerTimecardSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerTimecards and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerTimecardTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerTimecardSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerTimecards 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 FieldseekerTimecardTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerTimecardSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerTimecard has methods that act as mods for the FieldseekerTimecardTemplate -var FieldseekerTimecardMods fieldseekerTimecardMods - -type fieldseekerTimecardMods struct{} - -func (m fieldseekerTimecardMods) RandomizeAllColumns(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModSlice{ - FieldseekerTimecardMods.RandomObjectid(f), - FieldseekerTimecardMods.RandomActivity(f), - FieldseekerTimecardMods.RandomStartdatetime(f), - FieldseekerTimecardMods.RandomEnddatetime(f), - FieldseekerTimecardMods.RandomComments(f), - FieldseekerTimecardMods.RandomExternalid(f), - FieldseekerTimecardMods.RandomEquiptype(f), - FieldseekerTimecardMods.RandomLocationname(f), - FieldseekerTimecardMods.RandomZone(f), - FieldseekerTimecardMods.RandomZone2(f), - FieldseekerTimecardMods.RandomGlobalid(f), - FieldseekerTimecardMods.RandomCreatedUser(f), - FieldseekerTimecardMods.RandomCreatedDate(f), - FieldseekerTimecardMods.RandomLastEditedUser(f), - FieldseekerTimecardMods.RandomLastEditedDate(f), - FieldseekerTimecardMods.RandomLinelocid(f), - FieldseekerTimecardMods.RandomPointlocid(f), - FieldseekerTimecardMods.RandomPolygonlocid(f), - FieldseekerTimecardMods.RandomLclocid(f), - FieldseekerTimecardMods.RandomSamplelocid(f), - FieldseekerTimecardMods.RandomSrid(f), - FieldseekerTimecardMods.RandomTraplocid(f), - FieldseekerTimecardMods.RandomFieldtech(f), - FieldseekerTimecardMods.RandomCreationdate(f), - FieldseekerTimecardMods.RandomCreator(f), - FieldseekerTimecardMods.RandomEditdate(f), - FieldseekerTimecardMods.RandomEditor(f), - FieldseekerTimecardMods.RandomRodentlocid(f), - FieldseekerTimecardMods.RandomGeometry(f), - FieldseekerTimecardMods.RandomGeospatial(f), - FieldseekerTimecardMods.RandomVersion(f), - FieldseekerTimecardMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) Objectid(val int64) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) ObjectidFunc(f func() int64) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetObjectid() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomObjectid(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) Activity(val null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Activity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) ActivityFunc(f func() null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Activity = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetActivity() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomActivity(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Activity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomActivityNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Activity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) Startdatetime(val null.Val[time.Time]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Startdatetime = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) StartdatetimeFunc(f func() null.Val[time.Time]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Startdatetime = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetStartdatetime() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomStartdatetime(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Startdatetime = 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 fieldseekerTimecardMods) RandomStartdatetimeNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Startdatetime = 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 fieldseekerTimecardMods) Enddatetime(val null.Val[time.Time]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Enddatetime = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) EnddatetimeFunc(f func() null.Val[time.Time]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Enddatetime = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetEnddatetime() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomEnddatetime(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Enddatetime = 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 fieldseekerTimecardMods) RandomEnddatetimeNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Enddatetime = 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 fieldseekerTimecardMods) Comments(val null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) CommentsFunc(f func() null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetComments() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomComments(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCommentsNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) Externalid(val null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) ExternalidFunc(f func() null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetExternalid() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomExternalid(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Externalid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomExternalidNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Externalid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) Equiptype(val null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Equiptype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) EquiptypeFunc(f func() null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Equiptype = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetEquiptype() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomEquiptype(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Equiptype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEquiptypeNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Equiptype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) Locationname(val null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Locationname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) LocationnameFunc(f func() null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Locationname = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetLocationname() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomLocationname(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Locationname = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLocationnameNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Locationname = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) Zone(val null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) ZoneFunc(f func() null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetZone() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomZone(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZoneNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) Zone2(val null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) Zone2Func(f func() null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetZone2() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomZone2(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZone2NotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) Globalid(val uuid.UUID) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) GlobalidFunc(f func() uuid.UUID) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetGlobalid() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomGlobalid(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) CreatedUser(val null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetCreatedUser() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomCreatedUser(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) CreatedDate(val null.Val[time.Time]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetCreatedDate() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomCreatedDate(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.CreatedDate = 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 fieldseekerTimecardMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.CreatedDate = 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 fieldseekerTimecardMods) LastEditedUser(val null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetLastEditedUser() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomLastEditedUser(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) LastEditedDate(val null.Val[time.Time]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetLastEditedDate() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomLastEditedDate(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.LastEditedDate = 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 fieldseekerTimecardMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.LastEditedDate = 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 fieldseekerTimecardMods) Linelocid(val null.Val[uuid.UUID]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Linelocid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) LinelocidFunc(f func() null.Val[uuid.UUID]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Linelocid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetLinelocid() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomLinelocid(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Linelocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLinelocidNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Linelocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) Pointlocid(val null.Val[uuid.UUID]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Pointlocid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) PointlocidFunc(f func() null.Val[uuid.UUID]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Pointlocid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetPointlocid() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomPointlocid(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Pointlocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomPointlocidNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Pointlocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) Polygonlocid(val null.Val[uuid.UUID]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Polygonlocid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) PolygonlocidFunc(f func() null.Val[uuid.UUID]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Polygonlocid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetPolygonlocid() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomPolygonlocid(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Polygonlocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomPolygonlocidNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Polygonlocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) Lclocid(val null.Val[uuid.UUID]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Lclocid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) LclocidFunc(f func() null.Val[uuid.UUID]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Lclocid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetLclocid() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomLclocid(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Lclocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLclocidNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Lclocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) Samplelocid(val null.Val[uuid.UUID]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Samplelocid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) SamplelocidFunc(f func() null.Val[uuid.UUID]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Samplelocid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetSamplelocid() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomSamplelocid(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Samplelocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSamplelocidNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Samplelocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) Srid(val null.Val[uuid.UUID]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Srid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) SridFunc(f func() null.Val[uuid.UUID]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Srid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetSrid() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomSrid(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Srid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSridNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Srid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) Traplocid(val null.Val[uuid.UUID]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Traplocid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) TraplocidFunc(f func() null.Val[uuid.UUID]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Traplocid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetTraplocid() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomTraplocid(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Traplocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomTraplocidNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Traplocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) Fieldtech(val null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Fieldtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) FieldtechFunc(f func() null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Fieldtech = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetFieldtech() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomFieldtech(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Fieldtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomFieldtechNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Fieldtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) Creationdate(val null.Val[time.Time]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetCreationdate() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomCreationdate(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Creationdate = 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 fieldseekerTimecardMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Creationdate = 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 fieldseekerTimecardMods) Creator(val null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) CreatorFunc(f func() null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetCreator() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomCreator(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) Editdate(val null.Val[time.Time]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetEditdate() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomEditdate(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Editdate = 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 fieldseekerTimecardMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Editdate = 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 fieldseekerTimecardMods) Editor(val null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) EditorFunc(f func() null.Val[string]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetEditor() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomEditor(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTimecardMods) Rodentlocid(val null.Val[uuid.UUID]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Rodentlocid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) RodentlocidFunc(f func() null.Val[uuid.UUID]) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Rodentlocid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetRodentlocid() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomRodentlocid(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Rodentlocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomRodentlocidNotNull(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Rodentlocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTimecardMods) VersionFunc(f func() int32) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerTimecardMods) UnsetVersion() FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - 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 fieldseekerTimecardMods) RandomVersion(f *faker.Faker) FieldseekerTimecardMod { - return FieldseekerTimecardModFunc(func(_ context.Context, o *FieldseekerTimecardTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index 12669f0c..00000000 --- a/db/factory/fieldseeker.trapdata.bob.go +++ /dev/null @@ -1,3103 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerTrapdatumMod interface { - Apply(context.Context, *FieldseekerTrapdatumTemplate) -} - -type FieldseekerTrapdatumModFunc func(context.Context, *FieldseekerTrapdatumTemplate) - -func (f FieldseekerTrapdatumModFunc) Apply(ctx context.Context, n *FieldseekerTrapdatumTemplate) { - f(ctx, n) -} - -type FieldseekerTrapdatumModSlice []FieldseekerTrapdatumMod - -func (mods FieldseekerTrapdatumModSlice) Apply(ctx context.Context, n *FieldseekerTrapdatumTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerTrapdatumTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerTrapdatumTemplate struct { - Objectid func() int64 - 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[int16] - Sitecond func() null.Val[string] - Locationname func() null.Val[string] - Recordstatus func() null.Val[int16] - Reviewed func() null.Val[int16] - Reviewedby func() null.Val[string] - Revieweddate func() null.Val[time.Time] - Trapcondition func() null.Val[string] - Trapnights func() null.Val[int16] - Zone func() null.Val[string] - Zone2 func() null.Val[string] - Globalid func() uuid.UUID - CreatedUser func() null.Val[string] - CreatedDate func() null.Val[time.Time] - LastEditedUser func() null.Val[string] - LastEditedDate func() null.Val[time.Time] - Srid func() null.Val[uuid.UUID] - Fieldtech func() null.Val[string] - Gatewaysync func() null.Val[int16] - LocID func() null.Val[uuid.UUID] - Voltage func() null.Val[float64] - Winddir func() null.Val[string] - Windspeed func() null.Val[float64] - Avetemp func() null.Val[float64] - Raingauge func() null.Val[float64] - LR func() null.Val[int16] - Field func() null.Val[int32] - Vectorsurvtrapdataid func() null.Val[string] - Vectorsurvtraplocationid 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] - Lure func() null.Val[string] - Geometry func() types.JSON[json.RawMessage] - Geospatial func() null.Val[string] - Version func() int32 - OrganizationID func() int32 - H3cell func() null.Val[string] - - 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerTrapdatumTemplate) BuildSetter() *models.FieldseekerTrapdatumSetter { - m := &models.FieldseekerTrapdatumSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Traptype != nil { - val := o.Traptype() - m.Traptype = omitnull.FromNull(val) - } - if o.Trapactivitytype != nil { - val := o.Trapactivitytype() - m.Trapactivitytype = omitnull.FromNull(val) - } - if o.Startdatetime != nil { - val := o.Startdatetime() - m.Startdatetime = omitnull.FromNull(val) - } - if o.Enddatetime != nil { - val := o.Enddatetime() - m.Enddatetime = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Idbytech != nil { - val := o.Idbytech() - m.Idbytech = omitnull.FromNull(val) - } - if o.Sortbytech != nil { - val := o.Sortbytech() - m.Sortbytech = omitnull.FromNull(val) - } - if o.Processed != nil { - val := o.Processed() - m.Processed = omitnull.FromNull(val) - } - if o.Sitecond != nil { - val := o.Sitecond() - m.Sitecond = omitnull.FromNull(val) - } - if o.Locationname != nil { - val := o.Locationname() - m.Locationname = 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.Trapcondition != nil { - val := o.Trapcondition() - m.Trapcondition = omitnull.FromNull(val) - } - if o.Trapnights != nil { - val := o.Trapnights() - m.Trapnights = 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.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.Srid != nil { - val := o.Srid() - m.Srid = omitnull.FromNull(val) - } - if o.Fieldtech != nil { - val := o.Fieldtech() - m.Fieldtech = omitnull.FromNull(val) - } - if o.Gatewaysync != nil { - val := o.Gatewaysync() - m.Gatewaysync = omitnull.FromNull(val) - } - if o.LocID != nil { - val := o.LocID() - m.LocID = 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.Avetemp != nil { - val := o.Avetemp() - m.Avetemp = omitnull.FromNull(val) - } - if o.Raingauge != nil { - val := o.Raingauge() - m.Raingauge = omitnull.FromNull(val) - } - if o.LR != nil { - val := o.LR() - m.LR = omitnull.FromNull(val) - } - if o.Field != nil { - val := o.Field() - m.Field = 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.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.Lure != nil { - 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 -} - -// BuildManySetter returns an []*models.FieldseekerTrapdatumSetter -// this does nothing with the relationship templates -func (o FieldseekerTrapdatumTemplate) BuildManySetter(number int) []*models.FieldseekerTrapdatumSetter { - m := make([]*models.FieldseekerTrapdatumSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerTrapdatum -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerTrapdatumTemplate.Create -func (o FieldseekerTrapdatumTemplate) Build() *models.FieldseekerTrapdatum { - m := &models.FieldseekerTrapdatum{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Traptype != nil { - m.Traptype = o.Traptype() - } - if o.Trapactivitytype != nil { - m.Trapactivitytype = o.Trapactivitytype() - } - if o.Startdatetime != nil { - m.Startdatetime = o.Startdatetime() - } - if o.Enddatetime != nil { - m.Enddatetime = o.Enddatetime() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Idbytech != nil { - m.Idbytech = o.Idbytech() - } - if o.Sortbytech != nil { - m.Sortbytech = o.Sortbytech() - } - if o.Processed != nil { - m.Processed = o.Processed() - } - if o.Sitecond != nil { - m.Sitecond = o.Sitecond() - } - if o.Locationname != nil { - m.Locationname = o.Locationname() - } - 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.Trapcondition != nil { - m.Trapcondition = o.Trapcondition() - } - if o.Trapnights != nil { - m.Trapnights = o.Trapnights() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.Srid != nil { - m.Srid = o.Srid() - } - if o.Fieldtech != nil { - m.Fieldtech = o.Fieldtech() - } - if o.Gatewaysync != nil { - m.Gatewaysync = o.Gatewaysync() - } - if o.LocID != nil { - m.LocID = o.LocID() - } - 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.Avetemp != nil { - m.Avetemp = o.Avetemp() - } - if o.Raingauge != nil { - m.Raingauge = o.Raingauge() - } - if o.LR != nil { - m.LR = o.LR() - } - if o.Field != nil { - m.Field = o.Field() - } - if o.Vectorsurvtrapdataid != nil { - m.Vectorsurvtrapdataid = o.Vectorsurvtrapdataid() - } - if o.Vectorsurvtraplocationid != nil { - m.Vectorsurvtraplocationid = o.Vectorsurvtraplocationid() - } - 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.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() - } - if o.H3cell != nil { - m.H3cell = o.H3cell() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FieldseekerTrapdatumSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerTrapdatumTemplate.CreateMany -func (o FieldseekerTrapdatumTemplate) BuildMany(number int) models.FieldseekerTrapdatumSlice { - m := make(models.FieldseekerTrapdatumSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerTrapdatum(m *models.FieldseekerTrapdatumSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerTrapdatumTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerTrapdatum) error { - var err error - - return err -} - -// Create builds a fieldseekerTrapdatum and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerTrapdatumTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerTrapdatum, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerTrapdatum and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerTrapdatumTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerTrapdatum { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerTrapdatum 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 *FieldseekerTrapdatumTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerTrapdatum { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerTrapdata and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerTrapdatumTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerTrapdatumSlice, error) { - var err error - m := make(models.FieldseekerTrapdatumSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerTrapdata and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerTrapdatumTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerTrapdatumSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerTrapdata 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 FieldseekerTrapdatumTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerTrapdatumSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerTrapdatum has methods that act as mods for the FieldseekerTrapdatumTemplate -var FieldseekerTrapdatumMods fieldseekerTrapdatumMods - -type fieldseekerTrapdatumMods struct{} - -func (m fieldseekerTrapdatumMods) RandomizeAllColumns(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModSlice{ - FieldseekerTrapdatumMods.RandomObjectid(f), - FieldseekerTrapdatumMods.RandomTraptype(f), - FieldseekerTrapdatumMods.RandomTrapactivitytype(f), - FieldseekerTrapdatumMods.RandomStartdatetime(f), - FieldseekerTrapdatumMods.RandomEnddatetime(f), - FieldseekerTrapdatumMods.RandomComments(f), - FieldseekerTrapdatumMods.RandomIdbytech(f), - FieldseekerTrapdatumMods.RandomSortbytech(f), - FieldseekerTrapdatumMods.RandomProcessed(f), - FieldseekerTrapdatumMods.RandomSitecond(f), - FieldseekerTrapdatumMods.RandomLocationname(f), - FieldseekerTrapdatumMods.RandomRecordstatus(f), - FieldseekerTrapdatumMods.RandomReviewed(f), - FieldseekerTrapdatumMods.RandomReviewedby(f), - FieldseekerTrapdatumMods.RandomRevieweddate(f), - FieldseekerTrapdatumMods.RandomTrapcondition(f), - FieldseekerTrapdatumMods.RandomTrapnights(f), - FieldseekerTrapdatumMods.RandomZone(f), - FieldseekerTrapdatumMods.RandomZone2(f), - FieldseekerTrapdatumMods.RandomGlobalid(f), - FieldseekerTrapdatumMods.RandomCreatedUser(f), - FieldseekerTrapdatumMods.RandomCreatedDate(f), - FieldseekerTrapdatumMods.RandomLastEditedUser(f), - FieldseekerTrapdatumMods.RandomLastEditedDate(f), - FieldseekerTrapdatumMods.RandomSrid(f), - FieldseekerTrapdatumMods.RandomFieldtech(f), - FieldseekerTrapdatumMods.RandomGatewaysync(f), - FieldseekerTrapdatumMods.RandomLocID(f), - FieldseekerTrapdatumMods.RandomVoltage(f), - FieldseekerTrapdatumMods.RandomWinddir(f), - FieldseekerTrapdatumMods.RandomWindspeed(f), - FieldseekerTrapdatumMods.RandomAvetemp(f), - FieldseekerTrapdatumMods.RandomRaingauge(f), - FieldseekerTrapdatumMods.RandomLR(f), - FieldseekerTrapdatumMods.RandomField(f), - FieldseekerTrapdatumMods.RandomVectorsurvtrapdataid(f), - FieldseekerTrapdatumMods.RandomVectorsurvtraplocationid(f), - FieldseekerTrapdatumMods.RandomCreationdate(f), - FieldseekerTrapdatumMods.RandomCreator(f), - FieldseekerTrapdatumMods.RandomEditdate(f), - FieldseekerTrapdatumMods.RandomEditor(f), - FieldseekerTrapdatumMods.RandomLure(f), - FieldseekerTrapdatumMods.RandomGeometry(f), - FieldseekerTrapdatumMods.RandomGeospatial(f), - FieldseekerTrapdatumMods.RandomVersion(f), - FieldseekerTrapdatumMods.RandomOrganizationID(f), - FieldseekerTrapdatumMods.RandomH3cell(f), - } -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Objectid(val int64) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) ObjectidFunc(f func() int64) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetObjectid() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomObjectid(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Traptype(val null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Traptype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) TraptypeFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Traptype = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetTraptype() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomTraptype(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Traptype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomTraptypeNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Traptype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Trapactivitytype(val null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Trapactivitytype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) TrapactivitytypeFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Trapactivitytype = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetTrapactivitytype() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomTrapactivitytype(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Trapactivitytype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "1") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomTrapactivitytypeNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Trapactivitytype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "1") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Startdatetime(val null.Val[time.Time]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Startdatetime = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) StartdatetimeFunc(f func() null.Val[time.Time]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Startdatetime = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetStartdatetime() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomStartdatetime(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Startdatetime = 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 fieldseekerTrapdatumMods) RandomStartdatetimeNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Startdatetime = 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 fieldseekerTrapdatumMods) Enddatetime(val null.Val[time.Time]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Enddatetime = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) EnddatetimeFunc(f func() null.Val[time.Time]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Enddatetime = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetEnddatetime() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomEnddatetime(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Enddatetime = 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 fieldseekerTrapdatumMods) RandomEnddatetimeNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Enddatetime = 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 fieldseekerTrapdatumMods) Comments(val null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) CommentsFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetComments() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomComments(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCommentsNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Idbytech(val null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Idbytech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) IdbytechFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Idbytech = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetIdbytech() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomIdbytech(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Idbytech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomIdbytechNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Idbytech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Sortbytech(val null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Sortbytech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) SortbytechFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Sortbytech = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetSortbytech() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomSortbytech(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Sortbytech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSortbytechNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Sortbytech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Processed(val null.Val[int16]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Processed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) ProcessedFunc(f func() null.Val[int16]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Processed = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetProcessed() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomProcessed(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomProcessedNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) Sitecond(val null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Sitecond = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) SitecondFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Sitecond = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetSitecond() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomSitecond(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Sitecond = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSitecondNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Sitecond = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Locationname(val null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Locationname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) LocationnameFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Locationname = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetLocationname() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomLocationname(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Locationname = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLocationnameNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Locationname = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Recordstatus(val null.Val[int16]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Recordstatus = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) RecordstatusFunc(f func() null.Val[int16]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Recordstatus = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetRecordstatus() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomRecordstatus(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomRecordstatusNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) Reviewed(val null.Val[int16]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Reviewed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) ReviewedFunc(f func() null.Val[int16]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Reviewed = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetReviewed() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomReviewed(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomReviewedNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) Reviewedby(val null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Reviewedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) ReviewedbyFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Reviewedby = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetReviewedby() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomReviewedby(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Reviewedby = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReviewedbyNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Reviewedby = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Revieweddate(val null.Val[time.Time]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Revieweddate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) RevieweddateFunc(f func() null.Val[time.Time]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Revieweddate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetRevieweddate() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomRevieweddate(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Revieweddate = 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 fieldseekerTrapdatumMods) RandomRevieweddateNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Revieweddate = 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 fieldseekerTrapdatumMods) Trapcondition(val null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Trapcondition = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) TrapconditionFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Trapcondition = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetTrapcondition() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomTrapcondition(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Trapcondition = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomTrapconditionNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Trapcondition = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Trapnights(val null.Val[int16]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Trapnights = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) TrapnightsFunc(f func() null.Val[int16]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Trapnights = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetTrapnights() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomTrapnights(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomTrapnightsNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) Zone(val null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) ZoneFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetZone() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomZone(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZoneNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Zone2(val null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) Zone2Func(f func() null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetZone2() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomZone2(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZone2NotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Globalid(val uuid.UUID) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) GlobalidFunc(f func() uuid.UUID) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetGlobalid() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomGlobalid(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) CreatedUser(val null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetCreatedUser() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomCreatedUser(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) CreatedDate(val null.Val[time.Time]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetCreatedDate() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomCreatedDate(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.CreatedDate = 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 fieldseekerTrapdatumMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.CreatedDate = 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 fieldseekerTrapdatumMods) LastEditedUser(val null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetLastEditedUser() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomLastEditedUser(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) LastEditedDate(val null.Val[time.Time]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetLastEditedDate() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomLastEditedDate(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.LastEditedDate = 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 fieldseekerTrapdatumMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.LastEditedDate = 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 fieldseekerTrapdatumMods) Srid(val null.Val[uuid.UUID]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Srid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) SridFunc(f func() null.Val[uuid.UUID]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Srid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetSrid() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomSrid(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Srid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSridNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Srid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Fieldtech(val null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Fieldtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) FieldtechFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Fieldtech = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetFieldtech() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomFieldtech(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Fieldtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomFieldtechNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Fieldtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Gatewaysync(val null.Val[int16]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Gatewaysync = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) GatewaysyncFunc(f func() null.Val[int16]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Gatewaysync = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetGatewaysync() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomGatewaysync(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomGatewaysyncNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) LocID(val null.Val[uuid.UUID]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.LocID = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) LocIDFunc(f func() null.Val[uuid.UUID]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.LocID = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetLocID() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomLocID(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.LocID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLocIDNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.LocID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Voltage(val null.Val[float64]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Voltage = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) VoltageFunc(f func() null.Val[float64]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Voltage = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetVoltage() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomVoltage(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomVoltageNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) Winddir(val null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Winddir = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) WinddirFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Winddir = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetWinddir() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomWinddir(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Winddir = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "3") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomWinddirNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Winddir = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "3") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Windspeed(val null.Val[float64]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Windspeed = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) WindspeedFunc(f func() null.Val[float64]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Windspeed = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetWindspeed() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomWindspeed(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomWindspeedNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) Avetemp(val null.Val[float64]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Avetemp = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) AvetempFunc(f func() null.Val[float64]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Avetemp = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetAvetemp() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomAvetemp(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomAvetempNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) Raingauge(val null.Val[float64]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Raingauge = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) RaingaugeFunc(f func() null.Val[float64]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Raingauge = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetRaingauge() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomRaingauge(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomRaingaugeNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) LR(val null.Val[int16]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.LR = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) LRFunc(f func() null.Val[int16]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.LR = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetLR() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomLR(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomLRNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) Field(val null.Val[int32]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Field = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) FieldFunc(f func() null.Val[int32]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Field = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetField() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomField(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Field = 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 fieldseekerTrapdatumMods) RandomFieldNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Field = 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 fieldseekerTrapdatumMods) Vectorsurvtrapdataid(val null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Vectorsurvtrapdataid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) VectorsurvtrapdataidFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Vectorsurvtrapdataid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetVectorsurvtrapdataid() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomVectorsurvtrapdataid(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Vectorsurvtrapdataid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomVectorsurvtrapdataidNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Vectorsurvtrapdataid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Vectorsurvtraplocationid(val null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Vectorsurvtraplocationid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) VectorsurvtraplocationidFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Vectorsurvtraplocationid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetVectorsurvtraplocationid() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomVectorsurvtraplocationid(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Vectorsurvtraplocationid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomVectorsurvtraplocationidNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Vectorsurvtraplocationid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Creationdate(val null.Val[time.Time]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetCreationdate() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomCreationdate(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Creationdate = 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 fieldseekerTrapdatumMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Creationdate = 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 fieldseekerTrapdatumMods) Creator(val null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) CreatorFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetCreator() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomCreator(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Editdate(val null.Val[time.Time]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetEditdate() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomEditdate(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Editdate = 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 fieldseekerTrapdatumMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Editdate = 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 fieldseekerTrapdatumMods) Editor(val null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) EditorFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetEditor() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomEditor(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Lure(val null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Lure = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) LureFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Lure = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetLure() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomLure(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Lure = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "256") - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fieldseekerTrapdatumMods) RandomLureNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Lure = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "256") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m 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) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) Version(val int32) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) VersionFunc(f func() int32) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetVersion() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - 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 fieldseekerTrapdatumMods) RandomVersion(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTrapdatumMods) H3cell(val null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.H3cell = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTrapdatumMods) H3cellFunc(f func() null.Val[string]) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.H3cell = f - }) -} - -// Clear any values for the column -func (m fieldseekerTrapdatumMods) UnsetH3cell() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.H3cell = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m fieldseekerTrapdatumMods) RandomH3cell(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.H3cell = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fieldseekerTrapdatumMods) RandomH3cellNotNull(f *faker.Faker) FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(_ context.Context, o *FieldseekerTrapdatumTemplate) { - o.H3cell = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -func (m fieldseekerTrapdatumMods) WithParentsCascading() FieldseekerTrapdatumMod { - return FieldseekerTrapdatumModFunc(func(ctx context.Context, o *FieldseekerTrapdatumTemplate) { - if isDone, _ := fieldseekerTrapdatumWithParentsCascadingCtx.Value(ctx); isDone { - 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 deleted file mode 100644 index 6466750d..00000000 --- a/db/factory/fieldseeker.traplocation.bob.go +++ /dev/null @@ -1,2359 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerTraplocationMod interface { - Apply(context.Context, *FieldseekerTraplocationTemplate) -} - -type FieldseekerTraplocationModFunc func(context.Context, *FieldseekerTraplocationTemplate) - -func (f FieldseekerTraplocationModFunc) Apply(ctx context.Context, n *FieldseekerTraplocationTemplate) { - f(ctx, n) -} - -type FieldseekerTraplocationModSlice []FieldseekerTraplocationMod - -func (mods FieldseekerTraplocationModSlice) Apply(ctx context.Context, n *FieldseekerTraplocationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerTraplocationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerTraplocationTemplate struct { - Objectid func() int64 - Name func() null.Val[string] - Zone func() null.Val[string] - 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] - Externalid func() null.Val[string] - Nextactiondatescheduled func() null.Val[time.Time] - Zone2 func() null.Val[string] - Locationnumber func() null.Val[int32] - Globalid func() uuid.UUID - CreatedUser func() null.Val[string] - CreatedDate func() null.Val[time.Time] - LastEditedUser func() null.Val[string] - LastEditedDate func() null.Val[time.Time] - Gatewaysync func() null.Val[int16] - Route func() null.Val[int32] - SetDow func() null.Val[int32] - RouteOrder func() null.Val[int32] - Vectorsurvsiteid 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] - 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 - H3cell func() null.Val[string] - - 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerTraplocationTemplate) BuildSetter() *models.FieldseekerTraplocationSetter { - m := &models.FieldseekerTraplocationSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Habitat != nil { - val := o.Habitat() - m.Habitat = omitnull.FromNull(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.Active != nil { - val := o.Active() - m.Active = omitnull.FromNull(val) - } - if o.Description != nil { - val := o.Description() - m.Description = omitnull.FromNull(val) - } - if o.Accessdesc != nil { - val := o.Accessdesc() - m.Accessdesc = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Externalid != nil { - val := o.Externalid() - m.Externalid = omitnull.FromNull(val) - } - if o.Nextactiondatescheduled != nil { - val := o.Nextactiondatescheduled() - m.Nextactiondatescheduled = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.Locationnumber != nil { - val := o.Locationnumber() - m.Locationnumber = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.Gatewaysync != nil { - val := o.Gatewaysync() - m.Gatewaysync = omitnull.FromNull(val) - } - if o.Route != nil { - val := o.Route() - m.Route = omitnull.FromNull(val) - } - if o.SetDow != nil { - val := o.SetDow() - m.SetDow = omitnull.FromNull(val) - } - if o.RouteOrder != nil { - val := o.RouteOrder() - m.RouteOrder = omitnull.FromNull(val) - } - if o.Vectorsurvsiteid != nil { - val := o.Vectorsurvsiteid() - m.Vectorsurvsiteid = 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.H3R7 != nil { - val := o.H3R7() - m.H3R7 = omitnull.FromNull(val) - } - if o.H3R8 != nil { - 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 -} - -// BuildManySetter returns an []*models.FieldseekerTraplocationSetter -// this does nothing with the relationship templates -func (o FieldseekerTraplocationTemplate) BuildManySetter(number int) []*models.FieldseekerTraplocationSetter { - m := make([]*models.FieldseekerTraplocationSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerTraplocation -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerTraplocationTemplate.Create -func (o FieldseekerTraplocationTemplate) Build() *models.FieldseekerTraplocation { - m := &models.FieldseekerTraplocation{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Habitat != nil { - m.Habitat = o.Habitat() - } - if o.Priority != nil { - m.Priority = o.Priority() - } - if o.Usetype != nil { - m.Usetype = o.Usetype() - } - if o.Active != nil { - m.Active = o.Active() - } - if o.Description != nil { - m.Description = o.Description() - } - if o.Accessdesc != nil { - m.Accessdesc = o.Accessdesc() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Externalid != nil { - m.Externalid = o.Externalid() - } - if o.Nextactiondatescheduled != nil { - m.Nextactiondatescheduled = o.Nextactiondatescheduled() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Locationnumber != nil { - m.Locationnumber = o.Locationnumber() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.Gatewaysync != nil { - m.Gatewaysync = o.Gatewaysync() - } - if o.Route != nil { - m.Route = o.Route() - } - if o.SetDow != nil { - m.SetDow = o.SetDow() - } - if o.RouteOrder != nil { - m.RouteOrder = o.RouteOrder() - } - if o.Vectorsurvsiteid != nil { - m.Vectorsurvsiteid = o.Vectorsurvsiteid() - } - 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.H3R7 != nil { - m.H3R7 = o.H3R7() - } - 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() - } - if o.H3cell != nil { - m.H3cell = o.H3cell() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FieldseekerTraplocationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerTraplocationTemplate.CreateMany -func (o FieldseekerTraplocationTemplate) BuildMany(number int) models.FieldseekerTraplocationSlice { - m := make(models.FieldseekerTraplocationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerTraplocation(m *models.FieldseekerTraplocationSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerTraplocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerTraplocation) error { - var err error - - return err -} - -// Create builds a fieldseekerTraplocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerTraplocationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerTraplocation, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerTraplocation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerTraplocationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerTraplocation { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerTraplocation 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 *FieldseekerTraplocationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerTraplocation { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerTraplocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerTraplocationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerTraplocationSlice, error) { - var err error - m := make(models.FieldseekerTraplocationSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerTraplocations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerTraplocationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerTraplocationSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerTraplocations 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 FieldseekerTraplocationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerTraplocationSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerTraplocation has methods that act as mods for the FieldseekerTraplocationTemplate -var FieldseekerTraplocationMods fieldseekerTraplocationMods - -type fieldseekerTraplocationMods struct{} - -func (m fieldseekerTraplocationMods) RandomizeAllColumns(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModSlice{ - FieldseekerTraplocationMods.RandomObjectid(f), - FieldseekerTraplocationMods.RandomName(f), - FieldseekerTraplocationMods.RandomZone(f), - FieldseekerTraplocationMods.RandomHabitat(f), - FieldseekerTraplocationMods.RandomPriority(f), - FieldseekerTraplocationMods.RandomUsetype(f), - FieldseekerTraplocationMods.RandomActive(f), - FieldseekerTraplocationMods.RandomDescription(f), - FieldseekerTraplocationMods.RandomAccessdesc(f), - FieldseekerTraplocationMods.RandomComments(f), - FieldseekerTraplocationMods.RandomExternalid(f), - FieldseekerTraplocationMods.RandomNextactiondatescheduled(f), - FieldseekerTraplocationMods.RandomZone2(f), - FieldseekerTraplocationMods.RandomLocationnumber(f), - FieldseekerTraplocationMods.RandomGlobalid(f), - FieldseekerTraplocationMods.RandomCreatedUser(f), - FieldseekerTraplocationMods.RandomCreatedDate(f), - FieldseekerTraplocationMods.RandomLastEditedUser(f), - FieldseekerTraplocationMods.RandomLastEditedDate(f), - FieldseekerTraplocationMods.RandomGatewaysync(f), - FieldseekerTraplocationMods.RandomRoute(f), - FieldseekerTraplocationMods.RandomSetDow(f), - FieldseekerTraplocationMods.RandomRouteOrder(f), - FieldseekerTraplocationMods.RandomVectorsurvsiteid(f), - FieldseekerTraplocationMods.RandomCreationdate(f), - FieldseekerTraplocationMods.RandomCreator(f), - FieldseekerTraplocationMods.RandomEditdate(f), - FieldseekerTraplocationMods.RandomEditor(f), - FieldseekerTraplocationMods.RandomH3R7(f), - FieldseekerTraplocationMods.RandomH3R8(f), - FieldseekerTraplocationMods.RandomGeometry(f), - FieldseekerTraplocationMods.RandomGeospatial(f), - FieldseekerTraplocationMods.RandomVersion(f), - FieldseekerTraplocationMods.RandomOrganizationID(f), - FieldseekerTraplocationMods.RandomH3cell(f), - } -} - -// Set the model columns to this value -func (m fieldseekerTraplocationMods) Objectid(val int64) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) ObjectidFunc(f func() int64) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetObjectid() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomObjectid(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTraplocationMods) Name(val null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) NameFunc(f func() null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetName() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomName(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Name = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomNameNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Name = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTraplocationMods) Zone(val null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) ZoneFunc(f func() null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetZone() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomZone(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZoneNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTraplocationMods) Habitat(val null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Habitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) HabitatFunc(f func() null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Habitat = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetHabitat() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomHabitat(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Habitat = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomHabitatNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Habitat = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTraplocationMods) Priority(val null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Priority = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) PriorityFunc(f func() null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Priority = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetPriority() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomPriority(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Priority = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomPriorityNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Priority = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTraplocationMods) Usetype(val null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Usetype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) UsetypeFunc(f func() null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Usetype = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetUsetype() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomUsetype(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Usetype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomUsetypeNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Usetype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTraplocationMods) Active(val null.Val[int16]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Active = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) ActiveFunc(f func() null.Val[int16]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Active = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetActive() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomActive(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomActiveNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) Description(val null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Description = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) DescriptionFunc(f func() null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Description = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetDescription() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomDescription(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Description = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomDescriptionNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Description = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTraplocationMods) Accessdesc(val null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Accessdesc = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) AccessdescFunc(f func() null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Accessdesc = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetAccessdesc() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomAccessdesc(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Accessdesc = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomAccessdescNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Accessdesc = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTraplocationMods) Comments(val null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) CommentsFunc(f func() null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetComments() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomComments(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCommentsNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTraplocationMods) Externalid(val null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Externalid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) ExternalidFunc(f func() null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Externalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetExternalid() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomExternalid(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Externalid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomExternalidNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Externalid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTraplocationMods) Nextactiondatescheduled(val null.Val[time.Time]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Nextactiondatescheduled = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) NextactiondatescheduledFunc(f func() null.Val[time.Time]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Nextactiondatescheduled = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetNextactiondatescheduled() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomNextactiondatescheduled(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Nextactiondatescheduled = 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 fieldseekerTraplocationMods) RandomNextactiondatescheduledNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Nextactiondatescheduled = 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 fieldseekerTraplocationMods) Zone2(val null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) Zone2Func(f func() null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetZone2() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomZone2(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZone2NotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTraplocationMods) Locationnumber(val null.Val[int32]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Locationnumber = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) LocationnumberFunc(f func() null.Val[int32]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Locationnumber = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetLocationnumber() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomLocationnumber(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Locationnumber = 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 fieldseekerTraplocationMods) RandomLocationnumberNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Locationnumber = 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 fieldseekerTraplocationMods) Globalid(val uuid.UUID) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) GlobalidFunc(f func() uuid.UUID) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetGlobalid() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomGlobalid(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTraplocationMods) CreatedUser(val null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetCreatedUser() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomCreatedUser(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTraplocationMods) CreatedDate(val null.Val[time.Time]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetCreatedDate() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomCreatedDate(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.CreatedDate = 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 fieldseekerTraplocationMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.CreatedDate = 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 fieldseekerTraplocationMods) LastEditedUser(val null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetLastEditedUser() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomLastEditedUser(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTraplocationMods) LastEditedDate(val null.Val[time.Time]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetLastEditedDate() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomLastEditedDate(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.LastEditedDate = 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 fieldseekerTraplocationMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.LastEditedDate = 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 fieldseekerTraplocationMods) Gatewaysync(val null.Val[int16]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Gatewaysync = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) GatewaysyncFunc(f func() null.Val[int16]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Gatewaysync = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetGatewaysync() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomGatewaysync(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomGatewaysyncNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) Route(val null.Val[int32]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Route = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) RouteFunc(f func() null.Val[int32]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Route = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetRoute() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomRoute(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Route = 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 fieldseekerTraplocationMods) RandomRouteNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Route = 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 fieldseekerTraplocationMods) SetDow(val null.Val[int32]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.SetDow = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) SetDowFunc(f func() null.Val[int32]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.SetDow = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetSetDow() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomSetDow(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.SetDow = 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 fieldseekerTraplocationMods) RandomSetDowNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.SetDow = 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 fieldseekerTraplocationMods) RouteOrder(val null.Val[int32]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.RouteOrder = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) RouteOrderFunc(f func() null.Val[int32]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.RouteOrder = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetRouteOrder() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomRouteOrder(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.RouteOrder = 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 fieldseekerTraplocationMods) RandomRouteOrderNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.RouteOrder = 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 fieldseekerTraplocationMods) Vectorsurvsiteid(val null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Vectorsurvsiteid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) VectorsurvsiteidFunc(f func() null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Vectorsurvsiteid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetVectorsurvsiteid() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomVectorsurvsiteid(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Vectorsurvsiteid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomVectorsurvsiteidNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Vectorsurvsiteid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTraplocationMods) Creationdate(val null.Val[time.Time]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetCreationdate() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomCreationdate(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Creationdate = 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 fieldseekerTraplocationMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Creationdate = 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 fieldseekerTraplocationMods) Creator(val null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) CreatorFunc(f func() null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetCreator() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomCreator(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTraplocationMods) Editdate(val null.Val[time.Time]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetEditdate() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomEditdate(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Editdate = 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 fieldseekerTraplocationMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Editdate = 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 fieldseekerTraplocationMods) Editor(val null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) EditorFunc(f func() null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetEditor() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomEditor(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTraplocationMods) H3R7(val null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.H3R7 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) H3R7Func(f func() null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.H3R7 = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetH3R7() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomH3R7(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.H3R7 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomH3R7NotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.H3R7 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTraplocationMods) H3R8(val null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.H3R8 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) H3R8Func(f func() null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.H3R8 = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetH3R8() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomH3R8(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.H3R8 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomH3R8NotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.H3R8 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) VersionFunc(f func() int32) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetVersion() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - 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 fieldseekerTraplocationMods) RandomVersion(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTraplocationMods) H3cell(val null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.H3cell = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTraplocationMods) H3cellFunc(f func() null.Val[string]) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.H3cell = f - }) -} - -// Clear any values for the column -func (m fieldseekerTraplocationMods) UnsetH3cell() FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.H3cell = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m fieldseekerTraplocationMods) RandomH3cell(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.H3cell = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fieldseekerTraplocationMods) RandomH3cellNotNull(f *faker.Faker) FieldseekerTraplocationMod { - return FieldseekerTraplocationModFunc(func(_ context.Context, o *FieldseekerTraplocationTemplate) { - o.H3cell = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -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 deleted file mode 100644 index 13949e67..00000000 --- a/db/factory/fieldseeker.treatment.bob.go +++ /dev/null @@ -1,3847 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerTreatmentMod interface { - Apply(context.Context, *FieldseekerTreatmentTemplate) -} - -type FieldseekerTreatmentModFunc func(context.Context, *FieldseekerTreatmentTemplate) - -func (f FieldseekerTreatmentModFunc) Apply(ctx context.Context, n *FieldseekerTreatmentTemplate) { - f(ctx, n) -} - -type FieldseekerTreatmentModSlice []FieldseekerTreatmentMod - -func (mods FieldseekerTreatmentModSlice) Apply(ctx context.Context, n *FieldseekerTreatmentTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerTreatmentTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerTreatmentTemplate struct { - Objectid func() int64 - Activity func() null.Val[string] - Treatarea func() null.Val[float64] - Areaunit func() null.Val[string] - Product func() null.Val[string] - Qty func() null.Val[float64] - 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[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[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[int16] - Recordstatus func() null.Val[int16] - Zone2 func() null.Val[string] - Treatacres func() null.Val[float64] - Tirecount func() null.Val[int16] - Cbcount func() null.Val[int16] - Containercount func() null.Val[int16] - Globalid func() uuid.UUID - Treatmentlength func() null.Val[float64] - Treatmenthours func() null.Val[float64] - Treatmentlengthunits func() null.Val[string] - Linelocid func() null.Val[uuid.UUID] - Pointlocid func() null.Val[uuid.UUID] - Polygonlocid func() null.Val[uuid.UUID] - Srid func() null.Val[uuid.UUID] - Sdid func() null.Val[uuid.UUID] - Barrierrouteid func() null.Val[uuid.UUID] - Ulvrouteid func() null.Val[uuid.UUID] - Fieldtech func() null.Val[string] - Ptaid func() null.Val[uuid.UUID] - Flowrate func() null.Val[float64] - Habitat func() null.Val[string] - Treathectares func() null.Val[float64] - Invloc func() null.Val[string] - 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 - H3cell func() null.Val[string] - - 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerTreatmentTemplate) BuildSetter() *models.FieldseekerTreatmentSetter { - m := &models.FieldseekerTreatmentSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Activity != nil { - val := o.Activity() - m.Activity = omitnull.FromNull(val) - } - if o.Treatarea != nil { - val := o.Treatarea() - m.Treatarea = omitnull.FromNull(val) - } - if o.Areaunit != nil { - val := o.Areaunit() - m.Areaunit = omitnull.FromNull(val) - } - if o.Product != nil { - val := o.Product() - m.Product = 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.Method != nil { - val := o.Method() - m.Method = omitnull.FromNull(val) - } - if o.Equiptype != nil { - val := o.Equiptype() - m.Equiptype = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Avetemp != nil { - val := o.Avetemp() - m.Avetemp = omitnull.FromNull(val) - } - if o.Windspeed != nil { - val := o.Windspeed() - m.Windspeed = omitnull.FromNull(val) - } - if o.Winddir != nil { - val := o.Winddir() - m.Winddir = omitnull.FromNull(val) - } - if o.Raingauge != nil { - val := o.Raingauge() - m.Raingauge = omitnull.FromNull(val) - } - if o.Startdatetime != nil { - val := o.Startdatetime() - m.Startdatetime = omitnull.FromNull(val) - } - if o.Enddatetime != nil { - val := o.Enddatetime() - m.Enddatetime = omitnull.FromNull(val) - } - if o.InspID != nil { - val := o.InspID() - m.InspID = 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.Locationname != nil { - val := o.Locationname() - m.Locationname = omitnull.FromNull(val) - } - if o.Zone != nil { - val := o.Zone() - m.Zone = omitnull.FromNull(val) - } - if o.Warningoverride != nil { - val := o.Warningoverride() - m.Warningoverride = omitnull.FromNull(val) - } - if o.Recordstatus != nil { - val := o.Recordstatus() - m.Recordstatus = omitnull.FromNull(val) - } - if o.Zone2 != nil { - val := o.Zone2() - m.Zone2 = omitnull.FromNull(val) - } - if o.Treatacres != nil { - val := o.Treatacres() - m.Treatacres = omitnull.FromNull(val) - } - if o.Tirecount != nil { - val := o.Tirecount() - m.Tirecount = omitnull.FromNull(val) - } - if o.Cbcount != nil { - val := o.Cbcount() - m.Cbcount = omitnull.FromNull(val) - } - if o.Containercount != nil { - val := o.Containercount() - m.Containercount = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.Treatmentlength != nil { - val := o.Treatmentlength() - m.Treatmentlength = omitnull.FromNull(val) - } - if o.Treatmenthours != nil { - val := o.Treatmenthours() - m.Treatmenthours = omitnull.FromNull(val) - } - if o.Treatmentlengthunits != nil { - val := o.Treatmentlengthunits() - m.Treatmentlengthunits = omitnull.FromNull(val) - } - if o.Linelocid != nil { - val := o.Linelocid() - m.Linelocid = 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.Srid != nil { - val := o.Srid() - m.Srid = omitnull.FromNull(val) - } - if o.Sdid != nil { - val := o.Sdid() - m.Sdid = omitnull.FromNull(val) - } - if o.Barrierrouteid != nil { - val := o.Barrierrouteid() - m.Barrierrouteid = omitnull.FromNull(val) - } - if o.Ulvrouteid != nil { - val := o.Ulvrouteid() - m.Ulvrouteid = omitnull.FromNull(val) - } - if o.Fieldtech != nil { - val := o.Fieldtech() - m.Fieldtech = omitnull.FromNull(val) - } - if o.Ptaid != nil { - val := o.Ptaid() - m.Ptaid = omitnull.FromNull(val) - } - if o.Flowrate != nil { - val := o.Flowrate() - m.Flowrate = omitnull.FromNull(val) - } - if o.Habitat != nil { - val := o.Habitat() - m.Habitat = omitnull.FromNull(val) - } - if o.Treathectares != nil { - val := o.Treathectares() - m.Treathectares = omitnull.FromNull(val) - } - if o.Invloc != nil { - val := o.Invloc() - m.Invloc = omitnull.FromNull(val) - } - if o.TempSitecond != nil { - val := o.TempSitecond() - m.TempSitecond = omitnull.FromNull(val) - } - if o.Sitecond != nil { - val := o.Sitecond() - m.Sitecond = omitnull.FromNull(val) - } - if o.Totalcostprodcut != nil { - val := o.Totalcostprodcut() - m.Totalcostprodcut = 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.Targetspecies != nil { - 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 -} - -// BuildManySetter returns an []*models.FieldseekerTreatmentSetter -// this does nothing with the relationship templates -func (o FieldseekerTreatmentTemplate) BuildManySetter(number int) []*models.FieldseekerTreatmentSetter { - m := make([]*models.FieldseekerTreatmentSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerTreatment -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerTreatmentTemplate.Create -func (o FieldseekerTreatmentTemplate) Build() *models.FieldseekerTreatment { - m := &models.FieldseekerTreatment{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Activity != nil { - m.Activity = o.Activity() - } - if o.Treatarea != nil { - m.Treatarea = o.Treatarea() - } - if o.Areaunit != nil { - m.Areaunit = o.Areaunit() - } - if o.Product != nil { - m.Product = o.Product() - } - if o.Qty != nil { - m.Qty = o.Qty() - } - if o.Qtyunit != nil { - m.Qtyunit = o.Qtyunit() - } - if o.Method != nil { - m.Method = o.Method() - } - if o.Equiptype != nil { - m.Equiptype = o.Equiptype() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Avetemp != nil { - m.Avetemp = o.Avetemp() - } - if o.Windspeed != nil { - m.Windspeed = o.Windspeed() - } - if o.Winddir != nil { - m.Winddir = o.Winddir() - } - if o.Raingauge != nil { - m.Raingauge = o.Raingauge() - } - if o.Startdatetime != nil { - m.Startdatetime = o.Startdatetime() - } - if o.Enddatetime != nil { - m.Enddatetime = o.Enddatetime() - } - if o.InspID != nil { - m.InspID = o.InspID() - } - 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.Locationname != nil { - m.Locationname = o.Locationname() - } - if o.Zone != nil { - m.Zone = o.Zone() - } - if o.Warningoverride != nil { - m.Warningoverride = o.Warningoverride() - } - if o.Recordstatus != nil { - m.Recordstatus = o.Recordstatus() - } - if o.Zone2 != nil { - m.Zone2 = o.Zone2() - } - if o.Treatacres != nil { - m.Treatacres = o.Treatacres() - } - if o.Tirecount != nil { - m.Tirecount = o.Tirecount() - } - if o.Cbcount != nil { - m.Cbcount = o.Cbcount() - } - if o.Containercount != nil { - m.Containercount = o.Containercount() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.Treatmentlength != nil { - m.Treatmentlength = o.Treatmentlength() - } - if o.Treatmenthours != nil { - m.Treatmenthours = o.Treatmenthours() - } - if o.Treatmentlengthunits != nil { - m.Treatmentlengthunits = o.Treatmentlengthunits() - } - if o.Linelocid != nil { - m.Linelocid = o.Linelocid() - } - if o.Pointlocid != nil { - m.Pointlocid = o.Pointlocid() - } - if o.Polygonlocid != nil { - m.Polygonlocid = o.Polygonlocid() - } - if o.Srid != nil { - m.Srid = o.Srid() - } - if o.Sdid != nil { - m.Sdid = o.Sdid() - } - if o.Barrierrouteid != nil { - m.Barrierrouteid = o.Barrierrouteid() - } - if o.Ulvrouteid != nil { - m.Ulvrouteid = o.Ulvrouteid() - } - if o.Fieldtech != nil { - m.Fieldtech = o.Fieldtech() - } - if o.Ptaid != nil { - m.Ptaid = o.Ptaid() - } - if o.Flowrate != nil { - m.Flowrate = o.Flowrate() - } - if o.Habitat != nil { - m.Habitat = o.Habitat() - } - if o.Treathectares != nil { - m.Treathectares = o.Treathectares() - } - if o.Invloc != nil { - m.Invloc = o.Invloc() - } - if o.TempSitecond != nil { - m.TempSitecond = o.TempSitecond() - } - if o.Sitecond != nil { - m.Sitecond = o.Sitecond() - } - if o.Totalcostprodcut != nil { - m.Totalcostprodcut = o.Totalcostprodcut() - } - 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.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() - } - if o.H3cell != nil { - m.H3cell = o.H3cell() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FieldseekerTreatmentSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerTreatmentTemplate.CreateMany -func (o FieldseekerTreatmentTemplate) BuildMany(number int) models.FieldseekerTreatmentSlice { - m := make(models.FieldseekerTreatmentSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerTreatment(m *models.FieldseekerTreatmentSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerTreatmentTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerTreatment) error { - var err error - - return err -} - -// Create builds a fieldseekerTreatment and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerTreatmentTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerTreatment, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerTreatment and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerTreatmentTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerTreatment { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerTreatment 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 *FieldseekerTreatmentTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerTreatment { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerTreatments and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerTreatmentTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerTreatmentSlice, error) { - var err error - m := make(models.FieldseekerTreatmentSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerTreatments and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerTreatmentTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerTreatmentSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerTreatments 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 FieldseekerTreatmentTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerTreatmentSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerTreatment has methods that act as mods for the FieldseekerTreatmentTemplate -var FieldseekerTreatmentMods fieldseekerTreatmentMods - -type fieldseekerTreatmentMods struct{} - -func (m fieldseekerTreatmentMods) RandomizeAllColumns(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModSlice{ - FieldseekerTreatmentMods.RandomObjectid(f), - FieldseekerTreatmentMods.RandomActivity(f), - FieldseekerTreatmentMods.RandomTreatarea(f), - FieldseekerTreatmentMods.RandomAreaunit(f), - FieldseekerTreatmentMods.RandomProduct(f), - FieldseekerTreatmentMods.RandomQty(f), - FieldseekerTreatmentMods.RandomQtyunit(f), - FieldseekerTreatmentMods.RandomMethod(f), - FieldseekerTreatmentMods.RandomEquiptype(f), - FieldseekerTreatmentMods.RandomComments(f), - FieldseekerTreatmentMods.RandomAvetemp(f), - FieldseekerTreatmentMods.RandomWindspeed(f), - FieldseekerTreatmentMods.RandomWinddir(f), - FieldseekerTreatmentMods.RandomRaingauge(f), - FieldseekerTreatmentMods.RandomStartdatetime(f), - FieldseekerTreatmentMods.RandomEnddatetime(f), - FieldseekerTreatmentMods.RandomInspID(f), - FieldseekerTreatmentMods.RandomReviewed(f), - FieldseekerTreatmentMods.RandomReviewedby(f), - FieldseekerTreatmentMods.RandomRevieweddate(f), - FieldseekerTreatmentMods.RandomLocationname(f), - FieldseekerTreatmentMods.RandomZone(f), - FieldseekerTreatmentMods.RandomWarningoverride(f), - FieldseekerTreatmentMods.RandomRecordstatus(f), - FieldseekerTreatmentMods.RandomZone2(f), - FieldseekerTreatmentMods.RandomTreatacres(f), - FieldseekerTreatmentMods.RandomTirecount(f), - FieldseekerTreatmentMods.RandomCbcount(f), - FieldseekerTreatmentMods.RandomContainercount(f), - FieldseekerTreatmentMods.RandomGlobalid(f), - FieldseekerTreatmentMods.RandomTreatmentlength(f), - FieldseekerTreatmentMods.RandomTreatmenthours(f), - FieldseekerTreatmentMods.RandomTreatmentlengthunits(f), - FieldseekerTreatmentMods.RandomLinelocid(f), - FieldseekerTreatmentMods.RandomPointlocid(f), - FieldseekerTreatmentMods.RandomPolygonlocid(f), - FieldseekerTreatmentMods.RandomSrid(f), - FieldseekerTreatmentMods.RandomSdid(f), - FieldseekerTreatmentMods.RandomBarrierrouteid(f), - FieldseekerTreatmentMods.RandomUlvrouteid(f), - FieldseekerTreatmentMods.RandomFieldtech(f), - FieldseekerTreatmentMods.RandomPtaid(f), - FieldseekerTreatmentMods.RandomFlowrate(f), - FieldseekerTreatmentMods.RandomHabitat(f), - FieldseekerTreatmentMods.RandomTreathectares(f), - FieldseekerTreatmentMods.RandomInvloc(f), - FieldseekerTreatmentMods.RandomTempSitecond(f), - FieldseekerTreatmentMods.RandomSitecond(f), - FieldseekerTreatmentMods.RandomTotalcostprodcut(f), - FieldseekerTreatmentMods.RandomCreationdate(f), - FieldseekerTreatmentMods.RandomCreator(f), - FieldseekerTreatmentMods.RandomEditdate(f), - FieldseekerTreatmentMods.RandomEditor(f), - FieldseekerTreatmentMods.RandomTargetspecies(f), - FieldseekerTreatmentMods.RandomGeometry(f), - FieldseekerTreatmentMods.RandomGeospatial(f), - FieldseekerTreatmentMods.RandomVersion(f), - FieldseekerTreatmentMods.RandomOrganizationID(f), - FieldseekerTreatmentMods.RandomH3cell(f), - } -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Objectid(val int64) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) ObjectidFunc(f func() int64) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetObjectid() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomObjectid(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Activity(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Activity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) ActivityFunc(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Activity = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetActivity() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomActivity(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Activity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomActivityNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Activity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Treatarea(val null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Treatarea = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) TreatareaFunc(f func() null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Treatarea = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetTreatarea() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomTreatarea(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomTreatareaNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) Areaunit(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Areaunit = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) AreaunitFunc(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Areaunit = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetAreaunit() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomAreaunit(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Areaunit = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "10") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomAreaunitNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Areaunit = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "10") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Product(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Product = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) ProductFunc(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Product = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetProduct() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomProduct(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Product = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomProductNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Product = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Qty(val null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Qty = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) QtyFunc(f func() null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Qty = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetQty() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomQty(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomQtyNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) Qtyunit(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Qtyunit = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) QtyunitFunc(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Qtyunit = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetQtyunit() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomQtyunit(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Qtyunit = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "10") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomQtyunitNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Qtyunit = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "10") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Method(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Method = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) MethodFunc(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Method = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetMethod() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomMethod(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Method = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomMethodNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Method = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Equiptype(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Equiptype = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) EquiptypeFunc(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Equiptype = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetEquiptype() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomEquiptype(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Equiptype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEquiptypeNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Equiptype = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Comments(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) CommentsFunc(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetComments() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomComments(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCommentsNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Avetemp(val null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Avetemp = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) AvetempFunc(f func() null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Avetemp = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetAvetemp() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomAvetemp(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomAvetempNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) Windspeed(val null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Windspeed = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) WindspeedFunc(f func() null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Windspeed = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetWindspeed() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomWindspeed(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomWindspeedNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) Winddir(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Winddir = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) WinddirFunc(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Winddir = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetWinddir() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomWinddir(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Winddir = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "3") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomWinddirNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Winddir = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "3") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Raingauge(val null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Raingauge = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) RaingaugeFunc(f func() null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Raingauge = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetRaingauge() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomRaingauge(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomRaingaugeNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) Startdatetime(val null.Val[time.Time]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Startdatetime = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) StartdatetimeFunc(f func() null.Val[time.Time]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Startdatetime = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetStartdatetime() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomStartdatetime(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Startdatetime = 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 fieldseekerTreatmentMods) RandomStartdatetimeNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Startdatetime = 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 fieldseekerTreatmentMods) Enddatetime(val null.Val[time.Time]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Enddatetime = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) EnddatetimeFunc(f func() null.Val[time.Time]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Enddatetime = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetEnddatetime() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomEnddatetime(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Enddatetime = 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 fieldseekerTreatmentMods) RandomEnddatetimeNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Enddatetime = 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 fieldseekerTreatmentMods) InspID(val null.Val[uuid.UUID]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.InspID = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) InspIDFunc(f func() null.Val[uuid.UUID]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.InspID = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetInspID() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomInspID(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.InspID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomInspIDNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.InspID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Reviewed(val null.Val[int16]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Reviewed = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) ReviewedFunc(f func() null.Val[int16]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Reviewed = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetReviewed() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomReviewed(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomReviewedNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) Reviewedby(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Reviewedby = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) ReviewedbyFunc(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Reviewedby = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetReviewedby() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomReviewedby(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Reviewedby = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomReviewedbyNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Reviewedby = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Revieweddate(val null.Val[time.Time]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Revieweddate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) RevieweddateFunc(f func() null.Val[time.Time]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Revieweddate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetRevieweddate() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomRevieweddate(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Revieweddate = 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 fieldseekerTreatmentMods) RandomRevieweddateNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Revieweddate = 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 fieldseekerTreatmentMods) Locationname(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Locationname = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) LocationnameFunc(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Locationname = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetLocationname() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomLocationname(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Locationname = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLocationnameNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Locationname = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Zone(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Zone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) ZoneFunc(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Zone = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetZone() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomZone(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZoneNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Zone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Warningoverride(val null.Val[int16]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Warningoverride = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) WarningoverrideFunc(f func() null.Val[int16]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Warningoverride = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetWarningoverride() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomWarningoverride(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomWarningoverrideNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) Recordstatus(val null.Val[int16]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Recordstatus = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) RecordstatusFunc(f func() null.Val[int16]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Recordstatus = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetRecordstatus() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomRecordstatus(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomRecordstatusNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) Zone2(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Zone2 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) Zone2Func(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Zone2 = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetZone2() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomZone2(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomZone2NotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Zone2 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Treatacres(val null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Treatacres = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) TreatacresFunc(f func() null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Treatacres = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetTreatacres() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomTreatacres(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomTreatacresNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) Tirecount(val null.Val[int16]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Tirecount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) TirecountFunc(f func() null.Val[int16]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Tirecount = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetTirecount() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomTirecount(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomTirecountNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) Cbcount(val null.Val[int16]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Cbcount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) CbcountFunc(f func() null.Val[int16]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Cbcount = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetCbcount() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomCbcount(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomCbcountNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) Containercount(val null.Val[int16]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Containercount = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) ContainercountFunc(f func() null.Val[int16]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Containercount = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetContainercount() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomContainercount(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomContainercountNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) Globalid(val uuid.UUID) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) GlobalidFunc(f func() uuid.UUID) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetGlobalid() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomGlobalid(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Treatmentlength(val null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Treatmentlength = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) TreatmentlengthFunc(f func() null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Treatmentlength = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetTreatmentlength() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomTreatmentlength(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomTreatmentlengthNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) Treatmenthours(val null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Treatmenthours = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) TreatmenthoursFunc(f func() null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Treatmenthours = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetTreatmenthours() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomTreatmenthours(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomTreatmenthoursNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) Treatmentlengthunits(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Treatmentlengthunits = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) TreatmentlengthunitsFunc(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Treatmentlengthunits = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetTreatmentlengthunits() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomTreatmentlengthunits(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Treatmentlengthunits = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "5") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomTreatmentlengthunitsNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Treatmentlengthunits = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "5") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Linelocid(val null.Val[uuid.UUID]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Linelocid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) LinelocidFunc(f func() null.Val[uuid.UUID]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Linelocid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetLinelocid() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomLinelocid(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Linelocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLinelocidNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Linelocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Pointlocid(val null.Val[uuid.UUID]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Pointlocid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) PointlocidFunc(f func() null.Val[uuid.UUID]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Pointlocid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetPointlocid() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomPointlocid(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Pointlocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomPointlocidNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Pointlocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Polygonlocid(val null.Val[uuid.UUID]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Polygonlocid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) PolygonlocidFunc(f func() null.Val[uuid.UUID]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Polygonlocid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetPolygonlocid() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomPolygonlocid(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Polygonlocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomPolygonlocidNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Polygonlocid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Srid(val null.Val[uuid.UUID]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Srid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) SridFunc(f func() null.Val[uuid.UUID]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Srid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetSrid() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomSrid(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Srid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSridNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Srid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Sdid(val null.Val[uuid.UUID]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Sdid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) SdidFunc(f func() null.Val[uuid.UUID]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Sdid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetSdid() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomSdid(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Sdid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSdidNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Sdid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Barrierrouteid(val null.Val[uuid.UUID]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Barrierrouteid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) BarrierrouteidFunc(f func() null.Val[uuid.UUID]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Barrierrouteid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetBarrierrouteid() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomBarrierrouteid(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Barrierrouteid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomBarrierrouteidNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Barrierrouteid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Ulvrouteid(val null.Val[uuid.UUID]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Ulvrouteid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) UlvrouteidFunc(f func() null.Val[uuid.UUID]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Ulvrouteid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetUlvrouteid() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomUlvrouteid(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Ulvrouteid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomUlvrouteidNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Ulvrouteid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Fieldtech(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Fieldtech = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) FieldtechFunc(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Fieldtech = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetFieldtech() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomFieldtech(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Fieldtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomFieldtechNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Fieldtech = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Ptaid(val null.Val[uuid.UUID]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Ptaid = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) PtaidFunc(f func() null.Val[uuid.UUID]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Ptaid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetPtaid() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomPtaid(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Ptaid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomPtaidNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Ptaid = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Flowrate(val null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Flowrate = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) FlowrateFunc(f func() null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Flowrate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetFlowrate() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomFlowrate(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomFlowrateNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) Habitat(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Habitat = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) HabitatFunc(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Habitat = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetHabitat() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomHabitat(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Habitat = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomHabitatNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Habitat = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Treathectares(val null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Treathectares = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) TreathectaresFunc(f func() null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Treathectares = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetTreathectares() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomTreathectares(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomTreathectaresNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) Invloc(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Invloc = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) InvlocFunc(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Invloc = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetInvloc() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomInvloc(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Invloc = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomInvlocNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Invloc = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) TempSitecond(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.TempSitecond = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) TempSitecondFunc(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.TempSitecond = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetTempSitecond() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomTempSitecond(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.TempSitecond = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomTempSitecondNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.TempSitecond = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Sitecond(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Sitecond = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) SitecondFunc(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Sitecond = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetSitecond() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomSitecond(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Sitecond = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSitecondNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Sitecond = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Totalcostprodcut(val null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Totalcostprodcut = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) TotalcostprodcutFunc(f func() null.Val[float64]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Totalcostprodcut = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetTotalcostprodcut() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomTotalcostprodcut(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomTotalcostprodcutNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) Creationdate(val null.Val[time.Time]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetCreationdate() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomCreationdate(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Creationdate = 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 fieldseekerTreatmentMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Creationdate = 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 fieldseekerTreatmentMods) Creator(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) CreatorFunc(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetCreator() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomCreator(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Editdate(val null.Val[time.Time]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetEditdate() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomEditdate(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Editdate = 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 fieldseekerTreatmentMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Editdate = 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 fieldseekerTreatmentMods) Editor(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) EditorFunc(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetEditor() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomEditor(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) Targetspecies(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Targetspecies = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) TargetspeciesFunc(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Targetspecies = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetTargetspecies() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomTargetspecies(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Targetspecies = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomTargetspeciesNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Targetspecies = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) VersionFunc(f func() int32) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetVersion() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - 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 fieldseekerTreatmentMods) RandomVersion(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentMods) H3cell(val null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.H3cell = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentMods) H3cellFunc(f func() null.Val[string]) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.H3cell = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentMods) UnsetH3cell() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.H3cell = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m fieldseekerTreatmentMods) RandomH3cell(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.H3cell = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fieldseekerTreatmentMods) RandomH3cellNotNull(f *faker.Faker) FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(_ context.Context, o *FieldseekerTreatmentTemplate) { - o.H3cell = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -func (m fieldseekerTreatmentMods) WithParentsCascading() FieldseekerTreatmentMod { - return FieldseekerTreatmentModFunc(func(ctx context.Context, o *FieldseekerTreatmentTemplate) { - if isDone, _ := fieldseekerTreatmentWithParentsCascadingCtx.Value(ctx); isDone { - 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 deleted file mode 100644 index f8ec7fcb..00000000 --- a/db/factory/fieldseeker.treatmentarea.bob.go +++ /dev/null @@ -1,1557 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerTreatmentareaMod interface { - Apply(context.Context, *FieldseekerTreatmentareaTemplate) -} - -type FieldseekerTreatmentareaModFunc func(context.Context, *FieldseekerTreatmentareaTemplate) - -func (f FieldseekerTreatmentareaModFunc) Apply(ctx context.Context, n *FieldseekerTreatmentareaTemplate) { - f(ctx, n) -} - -type FieldseekerTreatmentareaModSlice []FieldseekerTreatmentareaMod - -func (mods FieldseekerTreatmentareaModSlice) Apply(ctx context.Context, n *FieldseekerTreatmentareaTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerTreatmentareaTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerTreatmentareaTemplate struct { - Objectid func() int64 - TreatID func() null.Val[uuid.UUID] - SessionID func() null.Val[uuid.UUID] - Treatdate func() null.Val[time.Time] - Comments func() null.Val[string] - Globalid func() uuid.UUID - CreatedUser func() null.Val[string] - CreatedDate func() null.Val[time.Time] - LastEditedUser func() null.Val[string] - LastEditedDate func() null.Val[time.Time] - Notified func() null.Val[int16] - Type 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] - 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerTreatmentareaTemplate) BuildSetter() *models.FieldseekerTreatmentareaSetter { - m := &models.FieldseekerTreatmentareaSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.TreatID != nil { - val := o.TreatID() - m.TreatID = omitnull.FromNull(val) - } - if o.SessionID != nil { - val := o.SessionID() - m.SessionID = omitnull.FromNull(val) - } - if o.Treatdate != nil { - val := o.Treatdate() - m.Treatdate = omitnull.FromNull(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(val) - } - if o.Notified != nil { - val := o.Notified() - m.Notified = omitnull.FromNull(val) - } - if o.Type != nil { - val := o.Type() - m.Type = 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.ShapeArea != nil { - val := o.ShapeArea() - m.ShapeArea = omitnull.FromNull(val) - } - if o.ShapeLength != nil { - 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 -} - -// BuildManySetter returns an []*models.FieldseekerTreatmentareaSetter -// this does nothing with the relationship templates -func (o FieldseekerTreatmentareaTemplate) BuildManySetter(number int) []*models.FieldseekerTreatmentareaSetter { - m := make([]*models.FieldseekerTreatmentareaSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerTreatmentarea -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerTreatmentareaTemplate.Create -func (o FieldseekerTreatmentareaTemplate) Build() *models.FieldseekerTreatmentarea { - m := &models.FieldseekerTreatmentarea{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.TreatID != nil { - m.TreatID = o.TreatID() - } - if o.SessionID != nil { - m.SessionID = o.SessionID() - } - if o.Treatdate != nil { - m.Treatdate = o.Treatdate() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - if o.Notified != nil { - m.Notified = o.Notified() - } - if o.Type != nil { - m.Type = o.Type() - } - 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.ShapeArea != nil { - m.ShapeArea = o.ShapeArea() - } - 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) - - return m -} - -// BuildMany returns an models.FieldseekerTreatmentareaSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerTreatmentareaTemplate.CreateMany -func (o FieldseekerTreatmentareaTemplate) BuildMany(number int) models.FieldseekerTreatmentareaSlice { - m := make(models.FieldseekerTreatmentareaSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerTreatmentarea(m *models.FieldseekerTreatmentareaSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerTreatmentareaTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerTreatmentarea) error { - var err error - - return err -} - -// Create builds a fieldseekerTreatmentarea and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerTreatmentareaTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerTreatmentarea, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerTreatmentarea and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerTreatmentareaTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerTreatmentarea { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerTreatmentarea 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 *FieldseekerTreatmentareaTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerTreatmentarea { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerTreatmentareas and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerTreatmentareaTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerTreatmentareaSlice, error) { - var err error - m := make(models.FieldseekerTreatmentareaSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerTreatmentareas and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerTreatmentareaTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerTreatmentareaSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerTreatmentareas 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 FieldseekerTreatmentareaTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerTreatmentareaSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerTreatmentarea has methods that act as mods for the FieldseekerTreatmentareaTemplate -var FieldseekerTreatmentareaMods fieldseekerTreatmentareaMods - -type fieldseekerTreatmentareaMods struct{} - -func (m fieldseekerTreatmentareaMods) RandomizeAllColumns(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModSlice{ - FieldseekerTreatmentareaMods.RandomObjectid(f), - FieldseekerTreatmentareaMods.RandomTreatID(f), - FieldseekerTreatmentareaMods.RandomSessionID(f), - FieldseekerTreatmentareaMods.RandomTreatdate(f), - FieldseekerTreatmentareaMods.RandomComments(f), - FieldseekerTreatmentareaMods.RandomGlobalid(f), - FieldseekerTreatmentareaMods.RandomCreatedUser(f), - FieldseekerTreatmentareaMods.RandomCreatedDate(f), - FieldseekerTreatmentareaMods.RandomLastEditedUser(f), - FieldseekerTreatmentareaMods.RandomLastEditedDate(f), - FieldseekerTreatmentareaMods.RandomNotified(f), - FieldseekerTreatmentareaMods.RandomType(f), - FieldseekerTreatmentareaMods.RandomCreationdate(f), - FieldseekerTreatmentareaMods.RandomCreator(f), - FieldseekerTreatmentareaMods.RandomEditdate(f), - FieldseekerTreatmentareaMods.RandomEditor(f), - FieldseekerTreatmentareaMods.RandomShapeArea(f), - FieldseekerTreatmentareaMods.RandomShapeLength(f), - FieldseekerTreatmentareaMods.RandomGeometry(f), - FieldseekerTreatmentareaMods.RandomGeospatial(f), - FieldseekerTreatmentareaMods.RandomVersion(f), - FieldseekerTreatmentareaMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerTreatmentareaMods) Objectid(val int64) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentareaMods) ObjectidFunc(f func() int64) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentareaMods) UnsetObjectid() FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomObjectid(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentareaMods) TreatID(val null.Val[uuid.UUID]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.TreatID = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentareaMods) TreatIDFunc(f func() null.Val[uuid.UUID]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.TreatID = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentareaMods) UnsetTreatID() FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomTreatID(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.TreatID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomTreatIDNotNull(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.TreatID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentareaMods) SessionID(val null.Val[uuid.UUID]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.SessionID = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentareaMods) SessionIDFunc(f func() null.Val[uuid.UUID]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.SessionID = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentareaMods) UnsetSessionID() FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomSessionID(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.SessionID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomSessionIDNotNull(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.SessionID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentareaMods) Treatdate(val null.Val[time.Time]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Treatdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentareaMods) TreatdateFunc(f func() null.Val[time.Time]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Treatdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentareaMods) UnsetTreatdate() FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomTreatdate(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Treatdate = 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 fieldseekerTreatmentareaMods) RandomTreatdateNotNull(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Treatdate = 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 fieldseekerTreatmentareaMods) Comments(val null.Val[string]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Comments = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentareaMods) CommentsFunc(f func() null.Val[string]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentareaMods) UnsetComments() FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomComments(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCommentsNotNull(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Comments = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "250") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentareaMods) Globalid(val uuid.UUID) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentareaMods) GlobalidFunc(f func() uuid.UUID) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentareaMods) UnsetGlobalid() FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomGlobalid(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentareaMods) CreatedUser(val null.Val[string]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentareaMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentareaMods) UnsetCreatedUser() FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomCreatedUser(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentareaMods) CreatedDate(val null.Val[time.Time]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentareaMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentareaMods) UnsetCreatedDate() FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomCreatedDate(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.CreatedDate = 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 fieldseekerTreatmentareaMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.CreatedDate = 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 fieldseekerTreatmentareaMods) LastEditedUser(val null.Val[string]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentareaMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentareaMods) UnsetLastEditedUser() FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomLastEditedUser(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentareaMods) LastEditedDate(val null.Val[time.Time]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentareaMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentareaMods) UnsetLastEditedDate() FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomLastEditedDate(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.LastEditedDate = 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 fieldseekerTreatmentareaMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.LastEditedDate = 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 fieldseekerTreatmentareaMods) Notified(val null.Val[int16]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Notified = func() null.Val[int16] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentareaMods) NotifiedFunc(f func() null.Val[int16]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Notified = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentareaMods) UnsetNotified() FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomNotified(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomNotifiedNotNull(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) Type(val null.Val[string]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Type = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentareaMods) TypeFunc(f func() null.Val[string]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Type = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentareaMods) UnsetType() FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomType(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Type = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomTypeNotNull(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Type = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "25") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentareaMods) Creationdate(val null.Val[time.Time]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentareaMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentareaMods) UnsetCreationdate() FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomCreationdate(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Creationdate = 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 fieldseekerTreatmentareaMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Creationdate = 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 fieldseekerTreatmentareaMods) Creator(val null.Val[string]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentareaMods) CreatorFunc(f func() null.Val[string]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentareaMods) UnsetCreator() FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomCreator(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentareaMods) Editdate(val null.Val[time.Time]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentareaMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentareaMods) UnsetEditdate() FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomEditdate(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Editdate = 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 fieldseekerTreatmentareaMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Editdate = 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 fieldseekerTreatmentareaMods) Editor(val null.Val[string]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentareaMods) EditorFunc(f func() null.Val[string]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentareaMods) UnsetEditor() FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomEditor(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerTreatmentareaMods) ShapeArea(val null.Val[float64]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.ShapeArea = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentareaMods) ShapeAreaFunc(f func() null.Val[float64]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.ShapeArea = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentareaMods) UnsetShapeArea() FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomShapeArea(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomShapeAreaNotNull(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) ShapeLength(val null.Val[float64]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.ShapeLength = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentareaMods) ShapeLengthFunc(f func() null.Val[float64]) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.ShapeLength = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentareaMods) UnsetShapeLength() FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomShapeLength(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomShapeLengthNotNull(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerTreatmentareaMods) VersionFunc(f func() int32) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerTreatmentareaMods) UnsetVersion() FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - 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 fieldseekerTreatmentareaMods) RandomVersion(f *faker.Faker) FieldseekerTreatmentareaMod { - return FieldseekerTreatmentareaModFunc(func(_ context.Context, o *FieldseekerTreatmentareaTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index 522c7721..00000000 --- a/db/factory/fieldseeker.zones.bob.go +++ /dev/null @@ -1,1309 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerZoneMod interface { - Apply(context.Context, *FieldseekerZoneTemplate) -} - -type FieldseekerZoneModFunc func(context.Context, *FieldseekerZoneTemplate) - -func (f FieldseekerZoneModFunc) Apply(ctx context.Context, n *FieldseekerZoneTemplate) { - f(ctx, n) -} - -type FieldseekerZoneModSlice []FieldseekerZoneMod - -func (mods FieldseekerZoneModSlice) Apply(ctx context.Context, n *FieldseekerZoneTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerZoneTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerZoneTemplate struct { - Objectid func() int64 - Name func() null.Val[string] - Globalid func() uuid.UUID - CreatedUser func() null.Val[string] - CreatedDate func() null.Val[time.Time] - LastEditedUser func() null.Val[string] - LastEditedDate func() null.Val[time.Time] - Active 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] - 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerZoneTemplate) BuildSetter() *models.FieldseekerZoneSetter { - m := &models.FieldseekerZoneSetter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = omitnull.FromNull(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.ShapeArea != nil { - val := o.ShapeArea() - m.ShapeArea = omitnull.FromNull(val) - } - if o.ShapeLength != nil { - 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 -} - -// BuildManySetter returns an []*models.FieldseekerZoneSetter -// this does nothing with the relationship templates -func (o FieldseekerZoneTemplate) BuildManySetter(number int) []*models.FieldseekerZoneSetter { - m := make([]*models.FieldseekerZoneSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerZone -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerZoneTemplate.Create -func (o FieldseekerZoneTemplate) Build() *models.FieldseekerZone { - m := &models.FieldseekerZone{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - 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.ShapeArea != nil { - m.ShapeArea = o.ShapeArea() - } - 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) - - return m -} - -// BuildMany returns an models.FieldseekerZoneSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerZoneTemplate.CreateMany -func (o FieldseekerZoneTemplate) BuildMany(number int) models.FieldseekerZoneSlice { - m := make(models.FieldseekerZoneSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerZone(m *models.FieldseekerZoneSetter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerZoneTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerZone) error { - var err error - - return err -} - -// Create builds a fieldseekerZone and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerZoneTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerZone, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerZone and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerZoneTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerZone { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerZone 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 *FieldseekerZoneTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerZone { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerZones and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerZoneTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerZoneSlice, error) { - var err error - m := make(models.FieldseekerZoneSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerZones and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerZoneTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerZoneSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerZones 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 FieldseekerZoneTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerZoneSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerZone has methods that act as mods for the FieldseekerZoneTemplate -var FieldseekerZoneMods fieldseekerZoneMods - -type fieldseekerZoneMods struct{} - -func (m fieldseekerZoneMods) RandomizeAllColumns(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModSlice{ - FieldseekerZoneMods.RandomObjectid(f), - FieldseekerZoneMods.RandomName(f), - FieldseekerZoneMods.RandomGlobalid(f), - FieldseekerZoneMods.RandomCreatedUser(f), - FieldseekerZoneMods.RandomCreatedDate(f), - FieldseekerZoneMods.RandomLastEditedUser(f), - FieldseekerZoneMods.RandomLastEditedDate(f), - FieldseekerZoneMods.RandomActive(f), - FieldseekerZoneMods.RandomCreationdate(f), - FieldseekerZoneMods.RandomCreator(f), - FieldseekerZoneMods.RandomEditdate(f), - FieldseekerZoneMods.RandomEditor(f), - FieldseekerZoneMods.RandomShapeArea(f), - FieldseekerZoneMods.RandomShapeLength(f), - FieldseekerZoneMods.RandomGeometry(f), - FieldseekerZoneMods.RandomGeospatial(f), - FieldseekerZoneMods.RandomVersion(f), - FieldseekerZoneMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerZoneMods) Objectid(val int64) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZoneMods) ObjectidFunc(f func() int64) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerZoneMods) UnsetObjectid() FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - 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 fieldseekerZoneMods) RandomObjectid(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerZoneMods) Name(val null.Val[string]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZoneMods) NameFunc(f func() null.Val[string]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m fieldseekerZoneMods) UnsetName() FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - 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 fieldseekerZoneMods) RandomName(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Name = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomNameNotNull(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Name = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerZoneMods) Globalid(val uuid.UUID) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZoneMods) GlobalidFunc(f func() uuid.UUID) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerZoneMods) UnsetGlobalid() FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - 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 fieldseekerZoneMods) RandomGlobalid(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerZoneMods) CreatedUser(val null.Val[string]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZoneMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerZoneMods) UnsetCreatedUser() FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - 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 fieldseekerZoneMods) RandomCreatedUser(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerZoneMods) CreatedDate(val null.Val[time.Time]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZoneMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerZoneMods) UnsetCreatedDate() FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - 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 fieldseekerZoneMods) RandomCreatedDate(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.CreatedDate = 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 fieldseekerZoneMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.CreatedDate = 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 fieldseekerZoneMods) LastEditedUser(val null.Val[string]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZoneMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerZoneMods) UnsetLastEditedUser() FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - 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 fieldseekerZoneMods) RandomLastEditedUser(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerZoneMods) LastEditedDate(val null.Val[time.Time]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZoneMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerZoneMods) UnsetLastEditedDate() FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - 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 fieldseekerZoneMods) RandomLastEditedDate(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.LastEditedDate = 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 fieldseekerZoneMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.LastEditedDate = 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 fieldseekerZoneMods) Active(val null.Val[int32]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Active = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZoneMods) ActiveFunc(f func() null.Val[int32]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Active = f - }) -} - -// Clear any values for the column -func (m fieldseekerZoneMods) UnsetActive() FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - 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 fieldseekerZoneMods) RandomActive(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Active = 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 fieldseekerZoneMods) RandomActiveNotNull(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Active = 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 fieldseekerZoneMods) Creationdate(val null.Val[time.Time]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZoneMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerZoneMods) UnsetCreationdate() FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - 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 fieldseekerZoneMods) RandomCreationdate(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Creationdate = 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 fieldseekerZoneMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Creationdate = 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 fieldseekerZoneMods) Creator(val null.Val[string]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZoneMods) CreatorFunc(f func() null.Val[string]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerZoneMods) UnsetCreator() FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - 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 fieldseekerZoneMods) RandomCreator(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerZoneMods) Editdate(val null.Val[time.Time]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZoneMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerZoneMods) UnsetEditdate() FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - 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 fieldseekerZoneMods) RandomEditdate(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Editdate = 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 fieldseekerZoneMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Editdate = 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 fieldseekerZoneMods) Editor(val null.Val[string]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZoneMods) EditorFunc(f func() null.Val[string]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerZoneMods) UnsetEditor() FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - 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 fieldseekerZoneMods) RandomEditor(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerZoneMods) ShapeArea(val null.Val[float64]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.ShapeArea = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZoneMods) ShapeAreaFunc(f func() null.Val[float64]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.ShapeArea = f - }) -} - -// Clear any values for the column -func (m fieldseekerZoneMods) UnsetShapeArea() FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - 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 fieldseekerZoneMods) RandomShapeArea(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - 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 fieldseekerZoneMods) RandomShapeAreaNotNull(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - 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 fieldseekerZoneMods) ShapeLength(val null.Val[float64]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.ShapeLength = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZoneMods) ShapeLengthFunc(f func() null.Val[float64]) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.ShapeLength = f - }) -} - -// Clear any values for the column -func (m fieldseekerZoneMods) UnsetShapeLength() FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - 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 fieldseekerZoneMods) RandomShapeLength(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - 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 fieldseekerZoneMods) RandomShapeLengthNotNull(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - 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 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZoneMods) VersionFunc(f func() int32) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerZoneMods) UnsetVersion() FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - 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 fieldseekerZoneMods) RandomVersion(f *faker.Faker) FieldseekerZoneMod { - return FieldseekerZoneModFunc(func(_ context.Context, o *FieldseekerZoneTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index 04b70f03..00000000 --- a/db/factory/fieldseeker.zones2.bob.go +++ /dev/null @@ -1,1247 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types" - 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" -) - -type FieldseekerZones2Mod interface { - Apply(context.Context, *FieldseekerZones2Template) -} - -type FieldseekerZones2ModFunc func(context.Context, *FieldseekerZones2Template) - -func (f FieldseekerZones2ModFunc) Apply(ctx context.Context, n *FieldseekerZones2Template) { - f(ctx, n) -} - -type FieldseekerZones2ModSlice []FieldseekerZones2Mod - -func (mods FieldseekerZones2ModSlice) Apply(ctx context.Context, n *FieldseekerZones2Template) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerZones2Template is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerZones2Template struct { - Objectid func() int64 - Name func() null.Val[string] - Globalid func() uuid.UUID - CreatedUser func() null.Val[string] - CreatedDate func() null.Val[time.Time] - LastEditedUser func() null.Val[string] - LastEditedDate func() null.Val[time.Time] - Creationdate func() null.Val[time.Time] - Creator func() null.Val[string] - Editdate func() null.Val[time.Time] - 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 { - mod.Apply(ctx, o) - } -} - -// 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) { - 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 -func (o FieldseekerZones2Template) BuildSetter() *models.FieldseekerZones2Setter { - m := &models.FieldseekerZones2Setter{} - - if o.Objectid != nil { - val := o.Objectid() - m.Objectid = omit.From(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omitnull.FromNull(val) - } - if o.Globalid != nil { - val := o.Globalid() - m.Globalid = omit.From(val) - } - if o.CreatedUser != nil { - val := o.CreatedUser() - m.CreatedUser = omitnull.FromNull(val) - } - if o.CreatedDate != nil { - val := o.CreatedDate() - m.CreatedDate = omitnull.FromNull(val) - } - if o.LastEditedUser != nil { - val := o.LastEditedUser() - m.LastEditedUser = omitnull.FromNull(val) - } - if o.LastEditedDate != nil { - val := o.LastEditedDate() - m.LastEditedDate = 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.ShapeArea != nil { - val := o.ShapeArea() - m.ShapeArea = omitnull.FromNull(val) - } - if o.ShapeLength != nil { - 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 -} - -// BuildManySetter returns an []*models.FieldseekerZones2Setter -// this does nothing with the relationship templates -func (o FieldseekerZones2Template) BuildManySetter(number int) []*models.FieldseekerZones2Setter { - m := make([]*models.FieldseekerZones2Setter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerZones2 -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerZones2Template.Create -func (o FieldseekerZones2Template) Build() *models.FieldseekerZones2 { - m := &models.FieldseekerZones2{} - - if o.Objectid != nil { - m.Objectid = o.Objectid() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Globalid != nil { - m.Globalid = o.Globalid() - } - if o.CreatedUser != nil { - m.CreatedUser = o.CreatedUser() - } - if o.CreatedDate != nil { - m.CreatedDate = o.CreatedDate() - } - if o.LastEditedUser != nil { - m.LastEditedUser = o.LastEditedUser() - } - if o.LastEditedDate != nil { - m.LastEditedDate = o.LastEditedDate() - } - 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.ShapeArea != nil { - m.ShapeArea = o.ShapeArea() - } - 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) - - return m -} - -// BuildMany returns an models.FieldseekerZones2Slice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerZones2Template.CreateMany -func (o FieldseekerZones2Template) BuildMany(number int) models.FieldseekerZones2Slice { - m := make(models.FieldseekerZones2Slice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerZones2(m *models.FieldseekerZones2Setter) { - if !(m.Objectid.IsValue()) { - val := random_int64(nil) - m.Objectid = omit.From(val) - } - if !(m.Globalid.IsValue()) { - val := random_uuid_UUID(nil) - m.Globalid = omit.From(val) - } - 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 -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerZones2Template) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerZones2) error { - var err error - - return err -} - -// Create builds a fieldseekerZones2 and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerZones2Template) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerZones2, error) { - var err error - 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 - } - return m, err -} - -// MustCreate builds a fieldseekerZones2 and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerZones2Template) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerZones2 { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerZones2 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 *FieldseekerZones2Template) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerZones2 { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerZones2s and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerZones2Template) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerZones2Slice, error) { - var err error - m := make(models.FieldseekerZones2Slice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerZones2s and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerZones2Template) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerZones2Slice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerZones2s 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 FieldseekerZones2Template) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerZones2Slice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerZones2 has methods that act as mods for the FieldseekerZones2Template -var FieldseekerZones2Mods fieldseekerZones2Mods - -type fieldseekerZones2Mods struct{} - -func (m fieldseekerZones2Mods) RandomizeAllColumns(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModSlice{ - FieldseekerZones2Mods.RandomObjectid(f), - FieldseekerZones2Mods.RandomName(f), - FieldseekerZones2Mods.RandomGlobalid(f), - FieldseekerZones2Mods.RandomCreatedUser(f), - FieldseekerZones2Mods.RandomCreatedDate(f), - FieldseekerZones2Mods.RandomLastEditedUser(f), - FieldseekerZones2Mods.RandomLastEditedDate(f), - FieldseekerZones2Mods.RandomCreationdate(f), - FieldseekerZones2Mods.RandomCreator(f), - FieldseekerZones2Mods.RandomEditdate(f), - FieldseekerZones2Mods.RandomEditor(f), - FieldseekerZones2Mods.RandomShapeArea(f), - FieldseekerZones2Mods.RandomShapeLength(f), - FieldseekerZones2Mods.RandomGeometry(f), - FieldseekerZones2Mods.RandomGeospatial(f), - FieldseekerZones2Mods.RandomVersion(f), - FieldseekerZones2Mods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerZones2Mods) Objectid(val int64) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Objectid = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZones2Mods) ObjectidFunc(f func() int64) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Objectid = f - }) -} - -// Clear any values for the column -func (m fieldseekerZones2Mods) UnsetObjectid() FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - 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 fieldseekerZones2Mods) RandomObjectid(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Objectid = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerZones2Mods) Name(val null.Val[string]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Name = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZones2Mods) NameFunc(f func() null.Val[string]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Name = f - }) -} - -// Clear any values for the column -func (m fieldseekerZones2Mods) UnsetName() FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - 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 fieldseekerZones2Mods) RandomName(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Name = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomNameNotNull(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Name = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "50") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerZones2Mods) Globalid(val uuid.UUID) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Globalid = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZones2Mods) GlobalidFunc(f func() uuid.UUID) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Globalid = f - }) -} - -// Clear any values for the column -func (m fieldseekerZones2Mods) UnsetGlobalid() FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - 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 fieldseekerZones2Mods) RandomGlobalid(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Globalid = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerZones2Mods) CreatedUser(val null.Val[string]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.CreatedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZones2Mods) CreatedUserFunc(f func() null.Val[string]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.CreatedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerZones2Mods) UnsetCreatedUser() FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - 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 fieldseekerZones2Mods) RandomCreatedUser(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.CreatedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerZones2Mods) CreatedDate(val null.Val[time.Time]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.CreatedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZones2Mods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.CreatedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerZones2Mods) UnsetCreatedDate() FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - 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 fieldseekerZones2Mods) RandomCreatedDate(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.CreatedDate = 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 fieldseekerZones2Mods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.CreatedDate = 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 fieldseekerZones2Mods) LastEditedUser(val null.Val[string]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.LastEditedUser = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZones2Mods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.LastEditedUser = f - }) -} - -// Clear any values for the column -func (m fieldseekerZones2Mods) UnsetLastEditedUser() FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - 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 fieldseekerZones2Mods) RandomLastEditedUser(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.LastEditedUser = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "255") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerZones2Mods) LastEditedDate(val null.Val[time.Time]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.LastEditedDate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZones2Mods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.LastEditedDate = f - }) -} - -// Clear any values for the column -func (m fieldseekerZones2Mods) UnsetLastEditedDate() FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - 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 fieldseekerZones2Mods) RandomLastEditedDate(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.LastEditedDate = 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 fieldseekerZones2Mods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.LastEditedDate = 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 fieldseekerZones2Mods) Creationdate(val null.Val[time.Time]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Creationdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZones2Mods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Creationdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerZones2Mods) UnsetCreationdate() FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - 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 fieldseekerZones2Mods) RandomCreationdate(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Creationdate = 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 fieldseekerZones2Mods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Creationdate = 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 fieldseekerZones2Mods) Creator(val null.Val[string]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Creator = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZones2Mods) CreatorFunc(f func() null.Val[string]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m fieldseekerZones2Mods) UnsetCreator() FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - 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 fieldseekerZones2Mods) RandomCreator(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomCreatorNotNull(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Creator = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerZones2Mods) Editdate(val null.Val[time.Time]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Editdate = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZones2Mods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Editdate = f - }) -} - -// Clear any values for the column -func (m fieldseekerZones2Mods) UnsetEditdate() FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - 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 fieldseekerZones2Mods) RandomEditdate(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Editdate = 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 fieldseekerZones2Mods) RandomEditdateNotNull(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Editdate = 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 fieldseekerZones2Mods) Editor(val null.Val[string]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Editor = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZones2Mods) EditorFunc(f func() null.Val[string]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Editor = f - }) -} - -// Clear any values for the column -func (m fieldseekerZones2Mods) UnsetEditor() FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - 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 fieldseekerZones2Mods) RandomEditor(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Generates a random value 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) RandomEditorNotNull(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Editor = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "128") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerZones2Mods) ShapeArea(val null.Val[float64]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.ShapeArea = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZones2Mods) ShapeAreaFunc(f func() null.Val[float64]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.ShapeArea = f - }) -} - -// Clear any values for the column -func (m fieldseekerZones2Mods) UnsetShapeArea() FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - 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 fieldseekerZones2Mods) RandomShapeArea(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - 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 fieldseekerZones2Mods) RandomShapeAreaNotNull(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - 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 fieldseekerZones2Mods) ShapeLength(val null.Val[float64]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.ShapeLength = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZones2Mods) ShapeLengthFunc(f func() null.Val[float64]) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.ShapeLength = f - }) -} - -// Clear any values for the column -func (m fieldseekerZones2Mods) UnsetShapeLength() FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - 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 fieldseekerZones2Mods) RandomShapeLength(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - 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 fieldseekerZones2Mods) RandomShapeLengthNotNull(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - 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 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) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerZones2Mods) VersionFunc(f func() int32) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Version = f - }) -} - -// Clear any values for the column -func (m fieldseekerZones2Mods) UnsetVersion() FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - 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 fieldseekerZones2Mods) RandomVersion(f *faker.Faker) FieldseekerZones2Mod { - return FieldseekerZones2ModFunc(func(_ context.Context, o *FieldseekerZones2Template) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -// 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 deleted file mode 100644 index 10736c41..00000000 --- a/db/factory/fieldseeker_sync.bob.go +++ /dev/null @@ -1,538 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/omit" - "github.com/jaswdr/faker/v2" -) - -type FieldseekerSyncMod interface { - Apply(context.Context, *FieldseekerSyncTemplate) -} - -type FieldseekerSyncModFunc func(context.Context, *FieldseekerSyncTemplate) - -func (f FieldseekerSyncModFunc) Apply(ctx context.Context, n *FieldseekerSyncTemplate) { - f(ctx, n) -} - -type FieldseekerSyncModSlice []FieldseekerSyncMod - -func (mods FieldseekerSyncModSlice) Apply(ctx context.Context, n *FieldseekerSyncTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FieldseekerSyncTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FieldseekerSyncTemplate struct { - ID func() int32 - Created func() time.Time - RecordsCreated func() int32 - RecordsUpdated func() int32 - RecordsUnchanged func() int32 - OrganizationID func() int32 - - r fieldseekerSyncR - f *Factory - - alreadyPersisted bool -} - -type fieldseekerSyncR struct { - Organization *fieldseekerSyncROrganizationR -} - -type fieldseekerSyncROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the FieldseekerSyncTemplate -func (o *FieldseekerSyncTemplate) Apply(ctx context.Context, mods ...FieldseekerSyncMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FieldseekerSync -// according to the relationships in the template. Nothing is inserted into the db -func (t FieldseekerSyncTemplate) setModelRels(o *models.FieldseekerSync) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.FieldseekerSyncs = append(rel.R.FieldseekerSyncs, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.FieldseekerSyncSetter -// this does nothing with the relationship templates -func (o FieldseekerSyncTemplate) BuildSetter() *models.FieldseekerSyncSetter { - m := &models.FieldseekerSyncSetter{} - - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.RecordsCreated != nil { - val := o.RecordsCreated() - m.RecordsCreated = omit.From(val) - } - if o.RecordsUpdated != nil { - val := o.RecordsUpdated() - m.RecordsUpdated = omit.From(val) - } - if o.RecordsUnchanged != nil { - val := o.RecordsUnchanged() - m.RecordsUnchanged = omit.From(val) - } - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FieldseekerSyncSetter -// this does nothing with the relationship templates -func (o FieldseekerSyncTemplate) BuildManySetter(number int) []*models.FieldseekerSyncSetter { - m := make([]*models.FieldseekerSyncSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FieldseekerSync -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerSyncTemplate.Create -func (o FieldseekerSyncTemplate) Build() *models.FieldseekerSync { - m := &models.FieldseekerSync{} - - if o.ID != nil { - m.ID = o.ID() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.RecordsCreated != nil { - m.RecordsCreated = o.RecordsCreated() - } - if o.RecordsUpdated != nil { - m.RecordsUpdated = o.RecordsUpdated() - } - if o.RecordsUnchanged != nil { - m.RecordsUnchanged = o.RecordsUnchanged() - } - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FieldseekerSyncSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FieldseekerSyncTemplate.CreateMany -func (o FieldseekerSyncTemplate) BuildMany(number int) models.FieldseekerSyncSlice { - m := make(models.FieldseekerSyncSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFieldseekerSync(m *models.FieldseekerSyncSetter) { - if !(m.RecordsCreated.IsValue()) { - val := random_int32(nil) - m.RecordsCreated = omit.From(val) - } - if !(m.RecordsUpdated.IsValue()) { - val := random_int32(nil) - m.RecordsUpdated = omit.From(val) - } - if !(m.RecordsUnchanged.IsValue()) { - val := random_int32(nil) - m.RecordsUnchanged = 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.FieldseekerSync -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FieldseekerSyncTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerSync) error { - var err error - - return err -} - -// Create builds a fieldseekerSync and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FieldseekerSyncTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerSync, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFieldseekerSync(opt) - - if o.r.Organization == nil { - FieldseekerSyncMods.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.FieldseekerSyncs.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 fieldseekerSync and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FieldseekerSyncTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerSync { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fieldseekerSync 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 *FieldseekerSyncTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerSync { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fieldseekerSyncs and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FieldseekerSyncTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerSyncSlice, error) { - var err error - m := make(models.FieldseekerSyncSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fieldseekerSyncs and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FieldseekerSyncTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerSyncSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fieldseekerSyncs 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 FieldseekerSyncTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerSyncSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FieldseekerSync has methods that act as mods for the FieldseekerSyncTemplate -var FieldseekerSyncMods fieldseekerSyncMods - -type fieldseekerSyncMods struct{} - -func (m fieldseekerSyncMods) RandomizeAllColumns(f *faker.Faker) FieldseekerSyncMod { - return FieldseekerSyncModSlice{ - FieldseekerSyncMods.RandomID(f), - FieldseekerSyncMods.RandomCreated(f), - FieldseekerSyncMods.RandomRecordsCreated(f), - FieldseekerSyncMods.RandomRecordsUpdated(f), - FieldseekerSyncMods.RandomRecordsUnchanged(f), - FieldseekerSyncMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m fieldseekerSyncMods) ID(val int32) FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSyncMods) IDFunc(f func() int32) FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m fieldseekerSyncMods) UnsetID() FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fieldseekerSyncMods) RandomID(f *faker.Faker) FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSyncMods) Created(val time.Time) FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSyncMods) CreatedFunc(f func() time.Time) FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m fieldseekerSyncMods) UnsetCreated() FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - 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 fieldseekerSyncMods) RandomCreated(f *faker.Faker) FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSyncMods) RecordsCreated(val int32) FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.RecordsCreated = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSyncMods) RecordsCreatedFunc(f func() int32) FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.RecordsCreated = f - }) -} - -// Clear any values for the column -func (m fieldseekerSyncMods) UnsetRecordsCreated() FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.RecordsCreated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fieldseekerSyncMods) RandomRecordsCreated(f *faker.Faker) FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.RecordsCreated = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSyncMods) RecordsUpdated(val int32) FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.RecordsUpdated = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSyncMods) RecordsUpdatedFunc(f func() int32) FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.RecordsUpdated = f - }) -} - -// Clear any values for the column -func (m fieldseekerSyncMods) UnsetRecordsUpdated() FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.RecordsUpdated = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fieldseekerSyncMods) RandomRecordsUpdated(f *faker.Faker) FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.RecordsUpdated = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSyncMods) RecordsUnchanged(val int32) FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.RecordsUnchanged = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSyncMods) RecordsUnchangedFunc(f func() int32) FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.RecordsUnchanged = f - }) -} - -// Clear any values for the column -func (m fieldseekerSyncMods) UnsetRecordsUnchanged() FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.RecordsUnchanged = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fieldseekerSyncMods) RandomRecordsUnchanged(f *faker.Faker) FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.RecordsUnchanged = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fieldseekerSyncMods) OrganizationID(val int32) FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fieldseekerSyncMods) OrganizationIDFunc(f func() int32) FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fieldseekerSyncMods) UnsetOrganizationID() FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - 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 fieldseekerSyncMods) RandomOrganizationID(f *faker.Faker) FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -func (m fieldseekerSyncMods) WithParentsCascading() FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(ctx context.Context, o *FieldseekerSyncTemplate) { - if isDone, _ := fieldseekerSyncWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fieldseekerSyncWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fieldseekerSyncMods) WithOrganization(rel *OrganizationTemplate) FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(ctx context.Context, o *FieldseekerSyncTemplate) { - o.r.Organization = &fieldseekerSyncROrganizationR{ - o: rel, - } - }) -} - -func (m fieldseekerSyncMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(ctx context.Context, o *FieldseekerSyncTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fieldseekerSyncMods) WithExistingOrganization(em *models.Organization) FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(ctx context.Context, o *FieldseekerSyncTemplate) { - o.r.Organization = &fieldseekerSyncROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fieldseekerSyncMods) WithoutOrganization() FieldseekerSyncMod { - return FieldseekerSyncModFunc(func(ctx context.Context, o *FieldseekerSyncTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/fileupload.csv.bob.go b/db/factory/fileupload.csv.bob.go deleted file mode 100644 index 0cf7aca2..00000000 --- a/db/factory/fileupload.csv.bob.go +++ /dev/null @@ -1,651 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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/jaswdr/faker/v2" -) - -type FileuploadCSVMod interface { - Apply(context.Context, *FileuploadCSVTemplate) -} - -type FileuploadCSVModFunc func(context.Context, *FileuploadCSVTemplate) - -func (f FileuploadCSVModFunc) Apply(ctx context.Context, n *FileuploadCSVTemplate) { - f(ctx, n) -} - -type FileuploadCSVModSlice []FileuploadCSVMod - -func (mods FileuploadCSVModSlice) Apply(ctx context.Context, n *FileuploadCSVTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FileuploadCSVTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FileuploadCSVTemplate struct { - Committed func() null.Val[time.Time] - FileID func() int32 - Rowcount func() int32 - Type func() enums.FileuploadCsvtype - - r fileuploadCSVR - f *Factory - - alreadyPersisted bool -} - -type fileuploadCSVR struct { - File *fileuploadCSVRFileR - CSVFileErrorCSVS []*fileuploadCSVRCSVFileErrorCSVSR - CSVFilePools []*fileuploadCSVRCSVFilePoolsR -} - -type fileuploadCSVRFileR struct { - o *FileuploadFileTemplate -} -type fileuploadCSVRCSVFileErrorCSVSR struct { - number int - o *FileuploadErrorCSVTemplate -} -type fileuploadCSVRCSVFilePoolsR struct { - number int - o *FileuploadPoolTemplate -} - -// Apply mods to the FileuploadCSVTemplate -func (o *FileuploadCSVTemplate) Apply(ctx context.Context, mods ...FileuploadCSVMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FileuploadCSV -// according to the relationships in the template. Nothing is inserted into the db -func (t FileuploadCSVTemplate) setModelRels(o *models.FileuploadCSV) { - if t.r.File != nil { - rel := t.r.File.o.Build() - rel.R.CSV = o - o.FileID = rel.ID // h2 - o.R.File = rel - } - - if t.r.CSVFileErrorCSVS != nil { - rel := models.FileuploadErrorCSVSlice{} - for _, r := range t.r.CSVFileErrorCSVS { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.CSVFileID = o.FileID // h2 - rel.R.CSVFileCSV = o - } - rel = append(rel, related...) - } - o.R.CSVFileErrorCSVS = rel - } - - if t.r.CSVFilePools != nil { - rel := models.FileuploadPoolSlice{} - for _, r := range t.r.CSVFilePools { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.CSVFile = o.FileID // h2 - rel.R.CSVFileCSV = o - } - rel = append(rel, related...) - } - o.R.CSVFilePools = rel - } -} - -// BuildSetter returns an *models.FileuploadCSVSetter -// this does nothing with the relationship templates -func (o FileuploadCSVTemplate) BuildSetter() *models.FileuploadCSVSetter { - m := &models.FileuploadCSVSetter{} - - if o.Committed != nil { - val := o.Committed() - m.Committed = omitnull.FromNull(val) - } - if o.FileID != nil { - val := o.FileID() - m.FileID = omit.From(val) - } - if o.Rowcount != nil { - val := o.Rowcount() - m.Rowcount = omit.From(val) - } - if o.Type != nil { - val := o.Type() - m.Type = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FileuploadCSVSetter -// this does nothing with the relationship templates -func (o FileuploadCSVTemplate) BuildManySetter(number int) []*models.FileuploadCSVSetter { - m := make([]*models.FileuploadCSVSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FileuploadCSV -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FileuploadCSVTemplate.Create -func (o FileuploadCSVTemplate) Build() *models.FileuploadCSV { - m := &models.FileuploadCSV{} - - if o.Committed != nil { - m.Committed = o.Committed() - } - if o.FileID != nil { - m.FileID = o.FileID() - } - if o.Rowcount != nil { - m.Rowcount = o.Rowcount() - } - if o.Type != nil { - m.Type = o.Type() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FileuploadCSVSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FileuploadCSVTemplate.CreateMany -func (o FileuploadCSVTemplate) BuildMany(number int) models.FileuploadCSVSlice { - m := make(models.FileuploadCSVSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFileuploadCSV(m *models.FileuploadCSVSetter) { - if !(m.FileID.IsValue()) { - val := random_int32(nil) - m.FileID = omit.From(val) - } - if !(m.Rowcount.IsValue()) { - val := random_int32(nil) - m.Rowcount = omit.From(val) - } - if !(m.Type.IsValue()) { - val := random_enums_FileuploadCsvtype(nil) - m.Type = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FileuploadCSV -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FileuploadCSVTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FileuploadCSV) error { - var err error - - isCSVFileErrorCSVSDone, _ := fileuploadCSVRelCSVFileErrorCSVSCtx.Value(ctx) - if !isCSVFileErrorCSVSDone && o.r.CSVFileErrorCSVS != nil { - ctx = fileuploadCSVRelCSVFileErrorCSVSCtx.WithValue(ctx, true) - for _, r := range o.r.CSVFileErrorCSVS { - if r.o.alreadyPersisted { - m.R.CSVFileErrorCSVS = append(m.R.CSVFileErrorCSVS, r.o.Build()) - } else { - rel1, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachCSVFileErrorCSVS(ctx, exec, rel1...) - if err != nil { - return err - } - } - } - } - - isCSVFilePoolsDone, _ := fileuploadCSVRelCSVFilePoolsCtx.Value(ctx) - if !isCSVFilePoolsDone && o.r.CSVFilePools != nil { - ctx = fileuploadCSVRelCSVFilePoolsCtx.WithValue(ctx, true) - for _, r := range o.r.CSVFilePools { - if r.o.alreadyPersisted { - m.R.CSVFilePools = append(m.R.CSVFilePools, r.o.Build()) - } else { - rel2, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachCSVFilePools(ctx, exec, rel2...) - if err != nil { - return err - } - } - } - } - - return err -} - -// Create builds a fileuploadCSV and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FileuploadCSVTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FileuploadCSV, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFileuploadCSV(opt) - - if o.r.File == nil { - FileuploadCSVMods.WithNewFile().Apply(ctx, o) - } - - var rel0 *models.FileuploadFile - - if o.r.File.o.alreadyPersisted { - rel0 = o.r.File.o.Build() - } else { - rel0, err = o.r.File.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.FileID = omit.From(rel0.ID) - - m, err := models.FileuploadCSVS.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.File = rel0 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a fileuploadCSV and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FileuploadCSVTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FileuploadCSV { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fileuploadCSV 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 *FileuploadCSVTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FileuploadCSV { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fileuploadCSVS and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FileuploadCSVTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FileuploadCSVSlice, error) { - var err error - m := make(models.FileuploadCSVSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fileuploadCSVS and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FileuploadCSVTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FileuploadCSVSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fileuploadCSVS 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 FileuploadCSVTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FileuploadCSVSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FileuploadCSV has methods that act as mods for the FileuploadCSVTemplate -var FileuploadCSVMods fileuploadCSVMods - -type fileuploadCSVMods struct{} - -func (m fileuploadCSVMods) RandomizeAllColumns(f *faker.Faker) FileuploadCSVMod { - return FileuploadCSVModSlice{ - FileuploadCSVMods.RandomCommitted(f), - FileuploadCSVMods.RandomFileID(f), - FileuploadCSVMods.RandomRowcount(f), - FileuploadCSVMods.RandomType(f), - } -} - -// Set the model columns to this value -func (m fileuploadCSVMods) Committed(val null.Val[time.Time]) FileuploadCSVMod { - return FileuploadCSVModFunc(func(_ context.Context, o *FileuploadCSVTemplate) { - o.Committed = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fileuploadCSVMods) CommittedFunc(f func() null.Val[time.Time]) FileuploadCSVMod { - return FileuploadCSVModFunc(func(_ context.Context, o *FileuploadCSVTemplate) { - o.Committed = f - }) -} - -// Clear any values for the column -func (m fileuploadCSVMods) UnsetCommitted() FileuploadCSVMod { - return FileuploadCSVModFunc(func(_ context.Context, o *FileuploadCSVTemplate) { - o.Committed = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m fileuploadCSVMods) RandomCommitted(f *faker.Faker) FileuploadCSVMod { - return FileuploadCSVModFunc(func(_ context.Context, o *FileuploadCSVTemplate) { - o.Committed = 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 fileuploadCSVMods) RandomCommittedNotNull(f *faker.Faker) FileuploadCSVMod { - return FileuploadCSVModFunc(func(_ context.Context, o *FileuploadCSVTemplate) { - o.Committed = 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 fileuploadCSVMods) FileID(val int32) FileuploadCSVMod { - return FileuploadCSVModFunc(func(_ context.Context, o *FileuploadCSVTemplate) { - o.FileID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fileuploadCSVMods) FileIDFunc(f func() int32) FileuploadCSVMod { - return FileuploadCSVModFunc(func(_ context.Context, o *FileuploadCSVTemplate) { - o.FileID = f - }) -} - -// Clear any values for the column -func (m fileuploadCSVMods) UnsetFileID() FileuploadCSVMod { - return FileuploadCSVModFunc(func(_ context.Context, o *FileuploadCSVTemplate) { - o.FileID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadCSVMods) RandomFileID(f *faker.Faker) FileuploadCSVMod { - return FileuploadCSVModFunc(func(_ context.Context, o *FileuploadCSVTemplate) { - o.FileID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadCSVMods) Rowcount(val int32) FileuploadCSVMod { - return FileuploadCSVModFunc(func(_ context.Context, o *FileuploadCSVTemplate) { - o.Rowcount = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fileuploadCSVMods) RowcountFunc(f func() int32) FileuploadCSVMod { - return FileuploadCSVModFunc(func(_ context.Context, o *FileuploadCSVTemplate) { - o.Rowcount = f - }) -} - -// Clear any values for the column -func (m fileuploadCSVMods) UnsetRowcount() FileuploadCSVMod { - return FileuploadCSVModFunc(func(_ context.Context, o *FileuploadCSVTemplate) { - o.Rowcount = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadCSVMods) RandomRowcount(f *faker.Faker) FileuploadCSVMod { - return FileuploadCSVModFunc(func(_ context.Context, o *FileuploadCSVTemplate) { - o.Rowcount = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadCSVMods) Type(val enums.FileuploadCsvtype) FileuploadCSVMod { - return FileuploadCSVModFunc(func(_ context.Context, o *FileuploadCSVTemplate) { - o.Type = func() enums.FileuploadCsvtype { return val } - }) -} - -// Set the Column from the function -func (m fileuploadCSVMods) TypeFunc(f func() enums.FileuploadCsvtype) FileuploadCSVMod { - return FileuploadCSVModFunc(func(_ context.Context, o *FileuploadCSVTemplate) { - o.Type = f - }) -} - -// Clear any values for the column -func (m fileuploadCSVMods) UnsetType() FileuploadCSVMod { - return FileuploadCSVModFunc(func(_ context.Context, o *FileuploadCSVTemplate) { - 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 fileuploadCSVMods) RandomType(f *faker.Faker) FileuploadCSVMod { - return FileuploadCSVModFunc(func(_ context.Context, o *FileuploadCSVTemplate) { - o.Type = func() enums.FileuploadCsvtype { - return random_enums_FileuploadCsvtype(f) - } - }) -} - -func (m fileuploadCSVMods) WithParentsCascading() FileuploadCSVMod { - return FileuploadCSVModFunc(func(ctx context.Context, o *FileuploadCSVTemplate) { - if isDone, _ := fileuploadCSVWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fileuploadCSVWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewFileuploadFileWithContext(ctx, FileuploadFileMods.WithParentsCascading()) - m.WithFile(related).Apply(ctx, o) - } - }) -} - -func (m fileuploadCSVMods) WithFile(rel *FileuploadFileTemplate) FileuploadCSVMod { - return FileuploadCSVModFunc(func(ctx context.Context, o *FileuploadCSVTemplate) { - o.r.File = &fileuploadCSVRFileR{ - o: rel, - } - }) -} - -func (m fileuploadCSVMods) WithNewFile(mods ...FileuploadFileMod) FileuploadCSVMod { - return FileuploadCSVModFunc(func(ctx context.Context, o *FileuploadCSVTemplate) { - related := o.f.NewFileuploadFileWithContext(ctx, mods...) - - m.WithFile(related).Apply(ctx, o) - }) -} - -func (m fileuploadCSVMods) WithExistingFile(em *models.FileuploadFile) FileuploadCSVMod { - return FileuploadCSVModFunc(func(ctx context.Context, o *FileuploadCSVTemplate) { - o.r.File = &fileuploadCSVRFileR{ - o: o.f.FromExistingFileuploadFile(em), - } - }) -} - -func (m fileuploadCSVMods) WithoutFile() FileuploadCSVMod { - return FileuploadCSVModFunc(func(ctx context.Context, o *FileuploadCSVTemplate) { - o.r.File = nil - }) -} - -func (m fileuploadCSVMods) WithCSVFileErrorCSVS(number int, related *FileuploadErrorCSVTemplate) FileuploadCSVMod { - return FileuploadCSVModFunc(func(ctx context.Context, o *FileuploadCSVTemplate) { - o.r.CSVFileErrorCSVS = []*fileuploadCSVRCSVFileErrorCSVSR{{ - number: number, - o: related, - }} - }) -} - -func (m fileuploadCSVMods) WithNewCSVFileErrorCSVS(number int, mods ...FileuploadErrorCSVMod) FileuploadCSVMod { - return FileuploadCSVModFunc(func(ctx context.Context, o *FileuploadCSVTemplate) { - related := o.f.NewFileuploadErrorCSVWithContext(ctx, mods...) - m.WithCSVFileErrorCSVS(number, related).Apply(ctx, o) - }) -} - -func (m fileuploadCSVMods) AddCSVFileErrorCSVS(number int, related *FileuploadErrorCSVTemplate) FileuploadCSVMod { - return FileuploadCSVModFunc(func(ctx context.Context, o *FileuploadCSVTemplate) { - o.r.CSVFileErrorCSVS = append(o.r.CSVFileErrorCSVS, &fileuploadCSVRCSVFileErrorCSVSR{ - number: number, - o: related, - }) - }) -} - -func (m fileuploadCSVMods) AddNewCSVFileErrorCSVS(number int, mods ...FileuploadErrorCSVMod) FileuploadCSVMod { - return FileuploadCSVModFunc(func(ctx context.Context, o *FileuploadCSVTemplate) { - related := o.f.NewFileuploadErrorCSVWithContext(ctx, mods...) - m.AddCSVFileErrorCSVS(number, related).Apply(ctx, o) - }) -} - -func (m fileuploadCSVMods) AddExistingCSVFileErrorCSVS(existingModels ...*models.FileuploadErrorCSV) FileuploadCSVMod { - return FileuploadCSVModFunc(func(ctx context.Context, o *FileuploadCSVTemplate) { - for _, em := range existingModels { - o.r.CSVFileErrorCSVS = append(o.r.CSVFileErrorCSVS, &fileuploadCSVRCSVFileErrorCSVSR{ - o: o.f.FromExistingFileuploadErrorCSV(em), - }) - } - }) -} - -func (m fileuploadCSVMods) WithoutCSVFileErrorCSVS() FileuploadCSVMod { - return FileuploadCSVModFunc(func(ctx context.Context, o *FileuploadCSVTemplate) { - o.r.CSVFileErrorCSVS = nil - }) -} - -func (m fileuploadCSVMods) WithCSVFilePools(number int, related *FileuploadPoolTemplate) FileuploadCSVMod { - return FileuploadCSVModFunc(func(ctx context.Context, o *FileuploadCSVTemplate) { - o.r.CSVFilePools = []*fileuploadCSVRCSVFilePoolsR{{ - number: number, - o: related, - }} - }) -} - -func (m fileuploadCSVMods) WithNewCSVFilePools(number int, mods ...FileuploadPoolMod) FileuploadCSVMod { - return FileuploadCSVModFunc(func(ctx context.Context, o *FileuploadCSVTemplate) { - related := o.f.NewFileuploadPoolWithContext(ctx, mods...) - m.WithCSVFilePools(number, related).Apply(ctx, o) - }) -} - -func (m fileuploadCSVMods) AddCSVFilePools(number int, related *FileuploadPoolTemplate) FileuploadCSVMod { - return FileuploadCSVModFunc(func(ctx context.Context, o *FileuploadCSVTemplate) { - o.r.CSVFilePools = append(o.r.CSVFilePools, &fileuploadCSVRCSVFilePoolsR{ - number: number, - o: related, - }) - }) -} - -func (m fileuploadCSVMods) AddNewCSVFilePools(number int, mods ...FileuploadPoolMod) FileuploadCSVMod { - return FileuploadCSVModFunc(func(ctx context.Context, o *FileuploadCSVTemplate) { - related := o.f.NewFileuploadPoolWithContext(ctx, mods...) - m.AddCSVFilePools(number, related).Apply(ctx, o) - }) -} - -func (m fileuploadCSVMods) AddExistingCSVFilePools(existingModels ...*models.FileuploadPool) FileuploadCSVMod { - return FileuploadCSVModFunc(func(ctx context.Context, o *FileuploadCSVTemplate) { - for _, em := range existingModels { - o.r.CSVFilePools = append(o.r.CSVFilePools, &fileuploadCSVRCSVFilePoolsR{ - o: o.f.FromExistingFileuploadPool(em), - }) - } - }) -} - -func (m fileuploadCSVMods) WithoutCSVFilePools() FileuploadCSVMod { - return FileuploadCSVModFunc(func(ctx context.Context, o *FileuploadCSVTemplate) { - o.r.CSVFilePools = nil - }) -} diff --git a/db/factory/fileupload.error_csv.bob.go b/db/factory/fileupload.error_csv.bob.go deleted file mode 100644 index 0ea71e4b..00000000 --- a/db/factory/fileupload.error_csv.bob.go +++ /dev/null @@ -1,497 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/omit" - "github.com/jaswdr/faker/v2" -) - -type FileuploadErrorCSVMod interface { - Apply(context.Context, *FileuploadErrorCSVTemplate) -} - -type FileuploadErrorCSVModFunc func(context.Context, *FileuploadErrorCSVTemplate) - -func (f FileuploadErrorCSVModFunc) Apply(ctx context.Context, n *FileuploadErrorCSVTemplate) { - f(ctx, n) -} - -type FileuploadErrorCSVModSlice []FileuploadErrorCSVMod - -func (mods FileuploadErrorCSVModSlice) Apply(ctx context.Context, n *FileuploadErrorCSVTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FileuploadErrorCSVTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FileuploadErrorCSVTemplate struct { - Col func() int32 - CSVFileID func() int32 - ID func() int32 - Line func() int32 - Message func() string - - r fileuploadErrorCSVR - f *Factory - - alreadyPersisted bool -} - -type fileuploadErrorCSVR struct { - CSVFileCSV *fileuploadErrorCSVRCSVFileCSVR -} - -type fileuploadErrorCSVRCSVFileCSVR struct { - o *FileuploadCSVTemplate -} - -// Apply mods to the FileuploadErrorCSVTemplate -func (o *FileuploadErrorCSVTemplate) Apply(ctx context.Context, mods ...FileuploadErrorCSVMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FileuploadErrorCSV -// according to the relationships in the template. Nothing is inserted into the db -func (t FileuploadErrorCSVTemplate) setModelRels(o *models.FileuploadErrorCSV) { - if t.r.CSVFileCSV != nil { - rel := t.r.CSVFileCSV.o.Build() - rel.R.CSVFileErrorCSVS = append(rel.R.CSVFileErrorCSVS, o) - o.CSVFileID = rel.FileID // h2 - o.R.CSVFileCSV = rel - } -} - -// BuildSetter returns an *models.FileuploadErrorCSVSetter -// this does nothing with the relationship templates -func (o FileuploadErrorCSVTemplate) BuildSetter() *models.FileuploadErrorCSVSetter { - m := &models.FileuploadErrorCSVSetter{} - - if o.Col != nil { - val := o.Col() - m.Col = omit.From(val) - } - if o.CSVFileID != nil { - val := o.CSVFileID() - m.CSVFileID = omit.From(val) - } - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.Line != nil { - val := o.Line() - m.Line = omit.From(val) - } - if o.Message != nil { - val := o.Message() - m.Message = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FileuploadErrorCSVSetter -// this does nothing with the relationship templates -func (o FileuploadErrorCSVTemplate) BuildManySetter(number int) []*models.FileuploadErrorCSVSetter { - m := make([]*models.FileuploadErrorCSVSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FileuploadErrorCSV -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FileuploadErrorCSVTemplate.Create -func (o FileuploadErrorCSVTemplate) Build() *models.FileuploadErrorCSV { - m := &models.FileuploadErrorCSV{} - - if o.Col != nil { - m.Col = o.Col() - } - if o.CSVFileID != nil { - m.CSVFileID = o.CSVFileID() - } - if o.ID != nil { - m.ID = o.ID() - } - if o.Line != nil { - m.Line = o.Line() - } - if o.Message != nil { - m.Message = o.Message() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FileuploadErrorCSVSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FileuploadErrorCSVTemplate.CreateMany -func (o FileuploadErrorCSVTemplate) BuildMany(number int) models.FileuploadErrorCSVSlice { - m := make(models.FileuploadErrorCSVSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFileuploadErrorCSV(m *models.FileuploadErrorCSVSetter) { - if !(m.Col.IsValue()) { - val := random_int32(nil) - m.Col = omit.From(val) - } - if !(m.CSVFileID.IsValue()) { - val := random_int32(nil) - m.CSVFileID = omit.From(val) - } - if !(m.Line.IsValue()) { - val := random_int32(nil) - m.Line = omit.From(val) - } - if !(m.Message.IsValue()) { - val := random_string(nil) - m.Message = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FileuploadErrorCSV -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FileuploadErrorCSVTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FileuploadErrorCSV) error { - var err error - - return err -} - -// Create builds a fileuploadErrorCSV and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FileuploadErrorCSVTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FileuploadErrorCSV, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFileuploadErrorCSV(opt) - - if o.r.CSVFileCSV == nil { - FileuploadErrorCSVMods.WithNewCSVFileCSV().Apply(ctx, o) - } - - var rel0 *models.FileuploadCSV - - if o.r.CSVFileCSV.o.alreadyPersisted { - rel0 = o.r.CSVFileCSV.o.Build() - } else { - rel0, err = o.r.CSVFileCSV.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.CSVFileID = omit.From(rel0.FileID) - - m, err := models.FileuploadErrorCSVS.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.CSVFileCSV = rel0 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a fileuploadErrorCSV and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FileuploadErrorCSVTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FileuploadErrorCSV { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fileuploadErrorCSV 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 *FileuploadErrorCSVTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FileuploadErrorCSV { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fileuploadErrorCSVS and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FileuploadErrorCSVTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FileuploadErrorCSVSlice, error) { - var err error - m := make(models.FileuploadErrorCSVSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fileuploadErrorCSVS and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FileuploadErrorCSVTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FileuploadErrorCSVSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fileuploadErrorCSVS 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 FileuploadErrorCSVTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FileuploadErrorCSVSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FileuploadErrorCSV has methods that act as mods for the FileuploadErrorCSVTemplate -var FileuploadErrorCSVMods fileuploadErrorCSVMods - -type fileuploadErrorCSVMods struct{} - -func (m fileuploadErrorCSVMods) RandomizeAllColumns(f *faker.Faker) FileuploadErrorCSVMod { - return FileuploadErrorCSVModSlice{ - FileuploadErrorCSVMods.RandomCol(f), - FileuploadErrorCSVMods.RandomCSVFileID(f), - FileuploadErrorCSVMods.RandomID(f), - FileuploadErrorCSVMods.RandomLine(f), - FileuploadErrorCSVMods.RandomMessage(f), - } -} - -// Set the model columns to this value -func (m fileuploadErrorCSVMods) Col(val int32) FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(_ context.Context, o *FileuploadErrorCSVTemplate) { - o.Col = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fileuploadErrorCSVMods) ColFunc(f func() int32) FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(_ context.Context, o *FileuploadErrorCSVTemplate) { - o.Col = f - }) -} - -// Clear any values for the column -func (m fileuploadErrorCSVMods) UnsetCol() FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(_ context.Context, o *FileuploadErrorCSVTemplate) { - o.Col = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadErrorCSVMods) RandomCol(f *faker.Faker) FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(_ context.Context, o *FileuploadErrorCSVTemplate) { - o.Col = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadErrorCSVMods) CSVFileID(val int32) FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(_ context.Context, o *FileuploadErrorCSVTemplate) { - o.CSVFileID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fileuploadErrorCSVMods) CSVFileIDFunc(f func() int32) FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(_ context.Context, o *FileuploadErrorCSVTemplate) { - o.CSVFileID = f - }) -} - -// Clear any values for the column -func (m fileuploadErrorCSVMods) UnsetCSVFileID() FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(_ context.Context, o *FileuploadErrorCSVTemplate) { - o.CSVFileID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadErrorCSVMods) RandomCSVFileID(f *faker.Faker) FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(_ context.Context, o *FileuploadErrorCSVTemplate) { - o.CSVFileID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadErrorCSVMods) ID(val int32) FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(_ context.Context, o *FileuploadErrorCSVTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fileuploadErrorCSVMods) IDFunc(f func() int32) FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(_ context.Context, o *FileuploadErrorCSVTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m fileuploadErrorCSVMods) UnsetID() FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(_ context.Context, o *FileuploadErrorCSVTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadErrorCSVMods) RandomID(f *faker.Faker) FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(_ context.Context, o *FileuploadErrorCSVTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadErrorCSVMods) Line(val int32) FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(_ context.Context, o *FileuploadErrorCSVTemplate) { - o.Line = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fileuploadErrorCSVMods) LineFunc(f func() int32) FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(_ context.Context, o *FileuploadErrorCSVTemplate) { - o.Line = f - }) -} - -// Clear any values for the column -func (m fileuploadErrorCSVMods) UnsetLine() FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(_ context.Context, o *FileuploadErrorCSVTemplate) { - o.Line = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadErrorCSVMods) RandomLine(f *faker.Faker) FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(_ context.Context, o *FileuploadErrorCSVTemplate) { - o.Line = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadErrorCSVMods) Message(val string) FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(_ context.Context, o *FileuploadErrorCSVTemplate) { - o.Message = func() string { return val } - }) -} - -// Set the Column from the function -func (m fileuploadErrorCSVMods) MessageFunc(f func() string) FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(_ context.Context, o *FileuploadErrorCSVTemplate) { - o.Message = f - }) -} - -// Clear any values for the column -func (m fileuploadErrorCSVMods) UnsetMessage() FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(_ context.Context, o *FileuploadErrorCSVTemplate) { - o.Message = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadErrorCSVMods) RandomMessage(f *faker.Faker) FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(_ context.Context, o *FileuploadErrorCSVTemplate) { - o.Message = func() string { - return random_string(f) - } - }) -} - -func (m fileuploadErrorCSVMods) WithParentsCascading() FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(ctx context.Context, o *FileuploadErrorCSVTemplate) { - if isDone, _ := fileuploadErrorCSVWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fileuploadErrorCSVWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewFileuploadCSVWithContext(ctx, FileuploadCSVMods.WithParentsCascading()) - m.WithCSVFileCSV(related).Apply(ctx, o) - } - }) -} - -func (m fileuploadErrorCSVMods) WithCSVFileCSV(rel *FileuploadCSVTemplate) FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(ctx context.Context, o *FileuploadErrorCSVTemplate) { - o.r.CSVFileCSV = &fileuploadErrorCSVRCSVFileCSVR{ - o: rel, - } - }) -} - -func (m fileuploadErrorCSVMods) WithNewCSVFileCSV(mods ...FileuploadCSVMod) FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(ctx context.Context, o *FileuploadErrorCSVTemplate) { - related := o.f.NewFileuploadCSVWithContext(ctx, mods...) - - m.WithCSVFileCSV(related).Apply(ctx, o) - }) -} - -func (m fileuploadErrorCSVMods) WithExistingCSVFileCSV(em *models.FileuploadCSV) FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(ctx context.Context, o *FileuploadErrorCSVTemplate) { - o.r.CSVFileCSV = &fileuploadErrorCSVRCSVFileCSVR{ - o: o.f.FromExistingFileuploadCSV(em), - } - }) -} - -func (m fileuploadErrorCSVMods) WithoutCSVFileCSV() FileuploadErrorCSVMod { - return FileuploadErrorCSVModFunc(func(ctx context.Context, o *FileuploadErrorCSVTemplate) { - o.r.CSVFileCSV = nil - }) -} diff --git a/db/factory/fileupload.error_file.bob.go b/db/factory/fileupload.error_file.bob.go deleted file mode 100644 index 665a0e9b..00000000 --- a/db/factory/fileupload.error_file.bob.go +++ /dev/null @@ -1,409 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/omit" - "github.com/jaswdr/faker/v2" -) - -type FileuploadErrorFileMod interface { - Apply(context.Context, *FileuploadErrorFileTemplate) -} - -type FileuploadErrorFileModFunc func(context.Context, *FileuploadErrorFileTemplate) - -func (f FileuploadErrorFileModFunc) Apply(ctx context.Context, n *FileuploadErrorFileTemplate) { - f(ctx, n) -} - -type FileuploadErrorFileModSlice []FileuploadErrorFileMod - -func (mods FileuploadErrorFileModSlice) Apply(ctx context.Context, n *FileuploadErrorFileTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FileuploadErrorFileTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FileuploadErrorFileTemplate struct { - FileID func() int32 - ID func() int32 - Message func() string - - r fileuploadErrorFileR - f *Factory - - alreadyPersisted bool -} - -type fileuploadErrorFileR struct { - File *fileuploadErrorFileRFileR -} - -type fileuploadErrorFileRFileR struct { - o *FileuploadFileTemplate -} - -// Apply mods to the FileuploadErrorFileTemplate -func (o *FileuploadErrorFileTemplate) Apply(ctx context.Context, mods ...FileuploadErrorFileMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FileuploadErrorFile -// according to the relationships in the template. Nothing is inserted into the db -func (t FileuploadErrorFileTemplate) setModelRels(o *models.FileuploadErrorFile) { - if t.r.File != nil { - rel := t.r.File.o.Build() - rel.R.ErrorFiles = append(rel.R.ErrorFiles, o) - o.FileID = rel.ID // h2 - o.R.File = rel - } -} - -// BuildSetter returns an *models.FileuploadErrorFileSetter -// this does nothing with the relationship templates -func (o FileuploadErrorFileTemplate) BuildSetter() *models.FileuploadErrorFileSetter { - m := &models.FileuploadErrorFileSetter{} - - if o.FileID != nil { - val := o.FileID() - m.FileID = omit.From(val) - } - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.Message != nil { - val := o.Message() - m.Message = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FileuploadErrorFileSetter -// this does nothing with the relationship templates -func (o FileuploadErrorFileTemplate) BuildManySetter(number int) []*models.FileuploadErrorFileSetter { - m := make([]*models.FileuploadErrorFileSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FileuploadErrorFile -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FileuploadErrorFileTemplate.Create -func (o FileuploadErrorFileTemplate) Build() *models.FileuploadErrorFile { - m := &models.FileuploadErrorFile{} - - if o.FileID != nil { - m.FileID = o.FileID() - } - if o.ID != nil { - m.ID = o.ID() - } - if o.Message != nil { - m.Message = o.Message() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FileuploadErrorFileSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FileuploadErrorFileTemplate.CreateMany -func (o FileuploadErrorFileTemplate) BuildMany(number int) models.FileuploadErrorFileSlice { - m := make(models.FileuploadErrorFileSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFileuploadErrorFile(m *models.FileuploadErrorFileSetter) { - if !(m.FileID.IsValue()) { - val := random_int32(nil) - m.FileID = omit.From(val) - } - if !(m.Message.IsValue()) { - val := random_string(nil) - m.Message = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FileuploadErrorFile -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FileuploadErrorFileTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FileuploadErrorFile) error { - var err error - - return err -} - -// Create builds a fileuploadErrorFile and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FileuploadErrorFileTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FileuploadErrorFile, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFileuploadErrorFile(opt) - - if o.r.File == nil { - FileuploadErrorFileMods.WithNewFile().Apply(ctx, o) - } - - var rel0 *models.FileuploadFile - - if o.r.File.o.alreadyPersisted { - rel0 = o.r.File.o.Build() - } else { - rel0, err = o.r.File.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.FileID = omit.From(rel0.ID) - - m, err := models.FileuploadErrorFiles.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.File = rel0 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a fileuploadErrorFile and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FileuploadErrorFileTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FileuploadErrorFile { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fileuploadErrorFile 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 *FileuploadErrorFileTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FileuploadErrorFile { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fileuploadErrorFiles and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FileuploadErrorFileTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FileuploadErrorFileSlice, error) { - var err error - m := make(models.FileuploadErrorFileSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fileuploadErrorFiles and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FileuploadErrorFileTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FileuploadErrorFileSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fileuploadErrorFiles 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 FileuploadErrorFileTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FileuploadErrorFileSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FileuploadErrorFile has methods that act as mods for the FileuploadErrorFileTemplate -var FileuploadErrorFileMods fileuploadErrorFileMods - -type fileuploadErrorFileMods struct{} - -func (m fileuploadErrorFileMods) RandomizeAllColumns(f *faker.Faker) FileuploadErrorFileMod { - return FileuploadErrorFileModSlice{ - FileuploadErrorFileMods.RandomFileID(f), - FileuploadErrorFileMods.RandomID(f), - FileuploadErrorFileMods.RandomMessage(f), - } -} - -// Set the model columns to this value -func (m fileuploadErrorFileMods) FileID(val int32) FileuploadErrorFileMod { - return FileuploadErrorFileModFunc(func(_ context.Context, o *FileuploadErrorFileTemplate) { - o.FileID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fileuploadErrorFileMods) FileIDFunc(f func() int32) FileuploadErrorFileMod { - return FileuploadErrorFileModFunc(func(_ context.Context, o *FileuploadErrorFileTemplate) { - o.FileID = f - }) -} - -// Clear any values for the column -func (m fileuploadErrorFileMods) UnsetFileID() FileuploadErrorFileMod { - return FileuploadErrorFileModFunc(func(_ context.Context, o *FileuploadErrorFileTemplate) { - o.FileID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadErrorFileMods) RandomFileID(f *faker.Faker) FileuploadErrorFileMod { - return FileuploadErrorFileModFunc(func(_ context.Context, o *FileuploadErrorFileTemplate) { - o.FileID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadErrorFileMods) ID(val int32) FileuploadErrorFileMod { - return FileuploadErrorFileModFunc(func(_ context.Context, o *FileuploadErrorFileTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fileuploadErrorFileMods) IDFunc(f func() int32) FileuploadErrorFileMod { - return FileuploadErrorFileModFunc(func(_ context.Context, o *FileuploadErrorFileTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m fileuploadErrorFileMods) UnsetID() FileuploadErrorFileMod { - return FileuploadErrorFileModFunc(func(_ context.Context, o *FileuploadErrorFileTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadErrorFileMods) RandomID(f *faker.Faker) FileuploadErrorFileMod { - return FileuploadErrorFileModFunc(func(_ context.Context, o *FileuploadErrorFileTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadErrorFileMods) Message(val string) FileuploadErrorFileMod { - return FileuploadErrorFileModFunc(func(_ context.Context, o *FileuploadErrorFileTemplate) { - o.Message = func() string { return val } - }) -} - -// Set the Column from the function -func (m fileuploadErrorFileMods) MessageFunc(f func() string) FileuploadErrorFileMod { - return FileuploadErrorFileModFunc(func(_ context.Context, o *FileuploadErrorFileTemplate) { - o.Message = f - }) -} - -// Clear any values for the column -func (m fileuploadErrorFileMods) UnsetMessage() FileuploadErrorFileMod { - return FileuploadErrorFileModFunc(func(_ context.Context, o *FileuploadErrorFileTemplate) { - o.Message = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadErrorFileMods) RandomMessage(f *faker.Faker) FileuploadErrorFileMod { - return FileuploadErrorFileModFunc(func(_ context.Context, o *FileuploadErrorFileTemplate) { - o.Message = func() string { - return random_string(f) - } - }) -} - -func (m fileuploadErrorFileMods) WithParentsCascading() FileuploadErrorFileMod { - return FileuploadErrorFileModFunc(func(ctx context.Context, o *FileuploadErrorFileTemplate) { - if isDone, _ := fileuploadErrorFileWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fileuploadErrorFileWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewFileuploadFileWithContext(ctx, FileuploadFileMods.WithParentsCascading()) - m.WithFile(related).Apply(ctx, o) - } - }) -} - -func (m fileuploadErrorFileMods) WithFile(rel *FileuploadFileTemplate) FileuploadErrorFileMod { - return FileuploadErrorFileModFunc(func(ctx context.Context, o *FileuploadErrorFileTemplate) { - o.r.File = &fileuploadErrorFileRFileR{ - o: rel, - } - }) -} - -func (m fileuploadErrorFileMods) WithNewFile(mods ...FileuploadFileMod) FileuploadErrorFileMod { - return FileuploadErrorFileModFunc(func(ctx context.Context, o *FileuploadErrorFileTemplate) { - related := o.f.NewFileuploadFileWithContext(ctx, mods...) - - m.WithFile(related).Apply(ctx, o) - }) -} - -func (m fileuploadErrorFileMods) WithExistingFile(em *models.FileuploadFile) FileuploadErrorFileMod { - return FileuploadErrorFileModFunc(func(ctx context.Context, o *FileuploadErrorFileTemplate) { - o.r.File = &fileuploadErrorFileRFileR{ - o: o.f.FromExistingFileuploadFile(em), - } - }) -} - -func (m fileuploadErrorFileMods) WithoutFile() FileuploadErrorFileMod { - return FileuploadErrorFileModFunc(func(ctx context.Context, o *FileuploadErrorFileTemplate) { - o.r.File = nil - }) -} diff --git a/db/factory/fileupload.file.bob.go b/db/factory/fileupload.file.bob.go deleted file mode 100644 index 066b6540..00000000 --- a/db/factory/fileupload.file.bob.go +++ /dev/null @@ -1,1168 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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/google/uuid" - "github.com/jaswdr/faker/v2" -) - -type FileuploadFileMod interface { - Apply(context.Context, *FileuploadFileTemplate) -} - -type FileuploadFileModFunc func(context.Context, *FileuploadFileTemplate) - -func (f FileuploadFileModFunc) Apply(ctx context.Context, n *FileuploadFileTemplate) { - f(ctx, n) -} - -type FileuploadFileModSlice []FileuploadFileMod - -func (mods FileuploadFileModSlice) Apply(ctx context.Context, n *FileuploadFileTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FileuploadFileTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FileuploadFileTemplate struct { - ID func() int32 - ContentType func() string - Created func() time.Time - CreatorID func() int32 - Deleted func() null.Val[time.Time] - Name func() string - OrganizationID func() int32 - Status func() enums.FileuploadFilestatustype - SizeBytes func() int32 - FileUUID func() uuid.UUID - Committer func() null.Val[int32] - - r fileuploadFileR - f *Factory - - alreadyPersisted bool -} - -type fileuploadFileR struct { - CSV *fileuploadFileRCSVR - ErrorFiles []*fileuploadFileRErrorFilesR - CommitterUser *fileuploadFileRCommitterUserR - CreatorUser *fileuploadFileRCreatorUserR - Organization *fileuploadFileROrganizationR - Sites []*fileuploadFileRSitesR -} - -type fileuploadFileRCSVR struct { - o *FileuploadCSVTemplate -} -type fileuploadFileRErrorFilesR struct { - number int - o *FileuploadErrorFileTemplate -} -type fileuploadFileRCommitterUserR struct { - o *UserTemplate -} -type fileuploadFileRCreatorUserR struct { - o *UserTemplate -} -type fileuploadFileROrganizationR struct { - o *OrganizationTemplate -} -type fileuploadFileRSitesR struct { - number int - o *SiteTemplate -} - -// Apply mods to the FileuploadFileTemplate -func (o *FileuploadFileTemplate) Apply(ctx context.Context, mods ...FileuploadFileMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FileuploadFile -// according to the relationships in the template. Nothing is inserted into the db -func (t FileuploadFileTemplate) setModelRels(o *models.FileuploadFile) { - if t.r.CSV != nil { - rel := t.r.CSV.o.Build() - rel.R.File = o - rel.FileID = o.ID // h2 - o.R.CSV = rel - } - - if t.r.ErrorFiles != nil { - rel := models.FileuploadErrorFileSlice{} - for _, r := range t.r.ErrorFiles { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.FileID = o.ID // h2 - rel.R.File = o - } - rel = append(rel, related...) - } - o.R.ErrorFiles = rel - } - - if t.r.CommitterUser != nil { - rel := t.r.CommitterUser.o.Build() - rel.R.CommitterFiles = append(rel.R.CommitterFiles, o) - o.Committer = null.From(rel.ID) // h2 - o.R.CommitterUser = rel - } - - if t.r.CreatorUser != nil { - rel := t.r.CreatorUser.o.Build() - rel.R.CreatorFiles = append(rel.R.CreatorFiles, o) - o.CreatorID = rel.ID // h2 - o.R.CreatorUser = rel - } - - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.Files = append(rel.R.Files, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } - - if t.r.Sites != nil { - rel := models.SiteSlice{} - for _, r := range t.r.Sites { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.FileID = null.From(o.ID) // h2 - rel.R.File = o - } - rel = append(rel, related...) - } - o.R.Sites = rel - } -} - -// BuildSetter returns an *models.FileuploadFileSetter -// this does nothing with the relationship templates -func (o FileuploadFileTemplate) BuildSetter() *models.FileuploadFileSetter { - m := &models.FileuploadFileSetter{} - - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.ContentType != nil { - val := o.ContentType() - m.ContentType = omit.From(val) - } - 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.Name != nil { - val := o.Name() - m.Name = omit.From(val) - } - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Status != nil { - val := o.Status() - m.Status = omit.From(val) - } - if o.SizeBytes != nil { - val := o.SizeBytes() - m.SizeBytes = omit.From(val) - } - if o.FileUUID != nil { - val := o.FileUUID() - m.FileUUID = omit.From(val) - } - if o.Committer != nil { - val := o.Committer() - m.Committer = omitnull.FromNull(val) - } - - return m -} - -// BuildManySetter returns an []*models.FileuploadFileSetter -// this does nothing with the relationship templates -func (o FileuploadFileTemplate) BuildManySetter(number int) []*models.FileuploadFileSetter { - m := make([]*models.FileuploadFileSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FileuploadFile -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FileuploadFileTemplate.Create -func (o FileuploadFileTemplate) Build() *models.FileuploadFile { - m := &models.FileuploadFile{} - - if o.ID != nil { - m.ID = o.ID() - } - if o.ContentType != nil { - m.ContentType = o.ContentType() - } - 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.Name != nil { - m.Name = o.Name() - } - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Status != nil { - m.Status = o.Status() - } - if o.SizeBytes != nil { - m.SizeBytes = o.SizeBytes() - } - if o.FileUUID != nil { - m.FileUUID = o.FileUUID() - } - if o.Committer != nil { - m.Committer = o.Committer() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FileuploadFileSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FileuploadFileTemplate.CreateMany -func (o FileuploadFileTemplate) BuildMany(number int) models.FileuploadFileSlice { - m := make(models.FileuploadFileSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFileuploadFile(m *models.FileuploadFileSetter) { - if !(m.ContentType.IsValue()) { - val := random_string(nil) - m.ContentType = omit.From(val) - } - 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.Name.IsValue()) { - val := random_string(nil) - m.Name = omit.From(val) - } - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Status.IsValue()) { - val := random_enums_FileuploadFilestatustype(nil) - m.Status = omit.From(val) - } - if !(m.SizeBytes.IsValue()) { - val := random_int32(nil) - m.SizeBytes = omit.From(val) - } - if !(m.FileUUID.IsValue()) { - val := random_uuid_UUID(nil) - m.FileUUID = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FileuploadFile -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FileuploadFileTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FileuploadFile) error { - var err error - - isCSVDone, _ := fileuploadFileRelCSVCtx.Value(ctx) - if !isCSVDone && o.r.CSV != nil { - ctx = fileuploadFileRelCSVCtx.WithValue(ctx, true) - if o.r.CSV.o.alreadyPersisted { - m.R.CSV = o.r.CSV.o.Build() - } else { - var rel0 *models.FileuploadCSV - rel0, err = o.r.CSV.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachCSV(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - - isErrorFilesDone, _ := fileuploadFileRelErrorFilesCtx.Value(ctx) - if !isErrorFilesDone && o.r.ErrorFiles != nil { - ctx = fileuploadFileRelErrorFilesCtx.WithValue(ctx, true) - for _, r := range o.r.ErrorFiles { - if r.o.alreadyPersisted { - m.R.ErrorFiles = append(m.R.ErrorFiles, r.o.Build()) - } else { - rel1, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachErrorFiles(ctx, exec, rel1...) - if err != nil { - return err - } - } - } - } - - isCommitterUserDone, _ := fileuploadFileRelCommitterUserCtx.Value(ctx) - if !isCommitterUserDone && o.r.CommitterUser != nil { - ctx = fileuploadFileRelCommitterUserCtx.WithValue(ctx, true) - if o.r.CommitterUser.o.alreadyPersisted { - m.R.CommitterUser = o.r.CommitterUser.o.Build() - } else { - var rel2 *models.User - rel2, err = o.r.CommitterUser.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachCommitterUser(ctx, exec, rel2) - if err != nil { - return err - } - } - - } - - isSitesDone, _ := fileuploadFileRelSitesCtx.Value(ctx) - if !isSitesDone && o.r.Sites != nil { - ctx = fileuploadFileRelSitesCtx.WithValue(ctx, true) - for _, r := range o.r.Sites { - if r.o.alreadyPersisted { - m.R.Sites = append(m.R.Sites, r.o.Build()) - } else { - rel5, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachSites(ctx, exec, rel5...) - if err != nil { - return err - } - } - } - } - - return err -} - -// Create builds a fileuploadFile and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FileuploadFileTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FileuploadFile, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFileuploadFile(opt) - - if o.r.CreatorUser == nil { - FileuploadFileMods.WithNewCreatorUser().Apply(ctx, o) - } - - var rel3 *models.User - - if o.r.CreatorUser.o.alreadyPersisted { - rel3 = o.r.CreatorUser.o.Build() - } else { - rel3, err = o.r.CreatorUser.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.CreatorID = omit.From(rel3.ID) - - if o.r.Organization == nil { - FileuploadFileMods.WithNewOrganization().Apply(ctx, o) - } - - var rel4 *models.Organization - - if o.r.Organization.o.alreadyPersisted { - rel4 = o.r.Organization.o.Build() - } else { - rel4, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.OrganizationID = omit.From(rel4.ID) - - m, err := models.FileuploadFiles.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.CreatorUser = rel3 - m.R.Organization = rel4 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a fileuploadFile and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FileuploadFileTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FileuploadFile { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fileuploadFile 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 *FileuploadFileTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FileuploadFile { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fileuploadFiles and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FileuploadFileTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FileuploadFileSlice, error) { - var err error - m := make(models.FileuploadFileSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fileuploadFiles and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FileuploadFileTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FileuploadFileSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fileuploadFiles 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 FileuploadFileTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FileuploadFileSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FileuploadFile has methods that act as mods for the FileuploadFileTemplate -var FileuploadFileMods fileuploadFileMods - -type fileuploadFileMods struct{} - -func (m fileuploadFileMods) RandomizeAllColumns(f *faker.Faker) FileuploadFileMod { - return FileuploadFileModSlice{ - FileuploadFileMods.RandomID(f), - FileuploadFileMods.RandomContentType(f), - FileuploadFileMods.RandomCreated(f), - FileuploadFileMods.RandomCreatorID(f), - FileuploadFileMods.RandomDeleted(f), - FileuploadFileMods.RandomName(f), - FileuploadFileMods.RandomOrganizationID(f), - FileuploadFileMods.RandomStatus(f), - FileuploadFileMods.RandomSizeBytes(f), - FileuploadFileMods.RandomFileUUID(f), - FileuploadFileMods.RandomCommitter(f), - } -} - -// Set the model columns to this value -func (m fileuploadFileMods) ID(val int32) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fileuploadFileMods) IDFunc(f func() int32) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m fileuploadFileMods) UnsetID() FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadFileMods) RandomID(f *faker.Faker) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadFileMods) ContentType(val string) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.ContentType = func() string { return val } - }) -} - -// Set the Column from the function -func (m fileuploadFileMods) ContentTypeFunc(f func() string) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.ContentType = f - }) -} - -// Clear any values for the column -func (m fileuploadFileMods) UnsetContentType() FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.ContentType = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadFileMods) RandomContentType(f *faker.Faker) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.ContentType = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadFileMods) Created(val time.Time) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fileuploadFileMods) CreatedFunc(f func() time.Time) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m fileuploadFileMods) UnsetCreated() FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - 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 fileuploadFileMods) RandomCreated(f *faker.Faker) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadFileMods) CreatorID(val int32) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.CreatorID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fileuploadFileMods) CreatorIDFunc(f func() int32) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.CreatorID = f - }) -} - -// Clear any values for the column -func (m fileuploadFileMods) UnsetCreatorID() FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - 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 fileuploadFileMods) RandomCreatorID(f *faker.Faker) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.CreatorID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadFileMods) Deleted(val null.Val[time.Time]) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.Deleted = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fileuploadFileMods) DeletedFunc(f func() null.Val[time.Time]) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.Deleted = f - }) -} - -// Clear any values for the column -func (m fileuploadFileMods) UnsetDeleted() FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - 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 fileuploadFileMods) RandomDeleted(f *faker.Faker) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - 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 fileuploadFileMods) RandomDeletedNotNull(f *faker.Faker) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - 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 fileuploadFileMods) Name(val string) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.Name = func() string { return val } - }) -} - -// Set the Column from the function -func (m fileuploadFileMods) NameFunc(f func() string) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m fileuploadFileMods) UnsetName() FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.Name = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadFileMods) RandomName(f *faker.Faker) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.Name = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadFileMods) OrganizationID(val int32) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fileuploadFileMods) OrganizationIDFunc(f func() int32) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m fileuploadFileMods) UnsetOrganizationID() FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - 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 fileuploadFileMods) RandomOrganizationID(f *faker.Faker) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadFileMods) Status(val enums.FileuploadFilestatustype) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.Status = func() enums.FileuploadFilestatustype { return val } - }) -} - -// Set the Column from the function -func (m fileuploadFileMods) StatusFunc(f func() enums.FileuploadFilestatustype) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.Status = f - }) -} - -// Clear any values for the column -func (m fileuploadFileMods) UnsetStatus() FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.Status = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadFileMods) RandomStatus(f *faker.Faker) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.Status = func() enums.FileuploadFilestatustype { - return random_enums_FileuploadFilestatustype(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadFileMods) SizeBytes(val int32) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.SizeBytes = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fileuploadFileMods) SizeBytesFunc(f func() int32) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.SizeBytes = f - }) -} - -// Clear any values for the column -func (m fileuploadFileMods) UnsetSizeBytes() FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.SizeBytes = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadFileMods) RandomSizeBytes(f *faker.Faker) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.SizeBytes = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadFileMods) FileUUID(val uuid.UUID) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.FileUUID = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m fileuploadFileMods) FileUUIDFunc(f func() uuid.UUID) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.FileUUID = f - }) -} - -// Clear any values for the column -func (m fileuploadFileMods) UnsetFileUUID() FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.FileUUID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadFileMods) RandomFileUUID(f *faker.Faker) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.FileUUID = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadFileMods) Committer(val null.Val[int32]) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.Committer = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m fileuploadFileMods) CommitterFunc(f func() null.Val[int32]) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.Committer = f - }) -} - -// Clear any values for the column -func (m fileuploadFileMods) UnsetCommitter() FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.Committer = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m fileuploadFileMods) RandomCommitter(f *faker.Faker) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.Committer = 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 fileuploadFileMods) RandomCommitterNotNull(f *faker.Faker) FileuploadFileMod { - return FileuploadFileModFunc(func(_ context.Context, o *FileuploadFileTemplate) { - o.Committer = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -func (m fileuploadFileMods) WithParentsCascading() FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - if isDone, _ := fileuploadFileWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fileuploadFileWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewFileuploadCSVWithContext(ctx, FileuploadCSVMods.WithParentsCascading()) - m.WithCSV(related).Apply(ctx, o) - } - { - - related := o.f.NewUserWithContext(ctx, UserMods.WithParentsCascading()) - m.WithCommitterUser(related).Apply(ctx, o) - } - { - - related := o.f.NewUserWithContext(ctx, UserMods.WithParentsCascading()) - m.WithCreatorUser(related).Apply(ctx, o) - } - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m fileuploadFileMods) WithCSV(rel *FileuploadCSVTemplate) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - o.r.CSV = &fileuploadFileRCSVR{ - o: rel, - } - }) -} - -func (m fileuploadFileMods) WithNewCSV(mods ...FileuploadCSVMod) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - related := o.f.NewFileuploadCSVWithContext(ctx, mods...) - - m.WithCSV(related).Apply(ctx, o) - }) -} - -func (m fileuploadFileMods) WithExistingCSV(em *models.FileuploadCSV) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - o.r.CSV = &fileuploadFileRCSVR{ - o: o.f.FromExistingFileuploadCSV(em), - } - }) -} - -func (m fileuploadFileMods) WithoutCSV() FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - o.r.CSV = nil - }) -} - -func (m fileuploadFileMods) WithCommitterUser(rel *UserTemplate) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - o.r.CommitterUser = &fileuploadFileRCommitterUserR{ - o: rel, - } - }) -} - -func (m fileuploadFileMods) WithNewCommitterUser(mods ...UserMod) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - related := o.f.NewUserWithContext(ctx, mods...) - - m.WithCommitterUser(related).Apply(ctx, o) - }) -} - -func (m fileuploadFileMods) WithExistingCommitterUser(em *models.User) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - o.r.CommitterUser = &fileuploadFileRCommitterUserR{ - o: o.f.FromExistingUser(em), - } - }) -} - -func (m fileuploadFileMods) WithoutCommitterUser() FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - o.r.CommitterUser = nil - }) -} - -func (m fileuploadFileMods) WithCreatorUser(rel *UserTemplate) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - o.r.CreatorUser = &fileuploadFileRCreatorUserR{ - o: rel, - } - }) -} - -func (m fileuploadFileMods) WithNewCreatorUser(mods ...UserMod) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - related := o.f.NewUserWithContext(ctx, mods...) - - m.WithCreatorUser(related).Apply(ctx, o) - }) -} - -func (m fileuploadFileMods) WithExistingCreatorUser(em *models.User) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - o.r.CreatorUser = &fileuploadFileRCreatorUserR{ - o: o.f.FromExistingUser(em), - } - }) -} - -func (m fileuploadFileMods) WithoutCreatorUser() FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - o.r.CreatorUser = nil - }) -} - -func (m fileuploadFileMods) WithOrganization(rel *OrganizationTemplate) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - o.r.Organization = &fileuploadFileROrganizationR{ - o: rel, - } - }) -} - -func (m fileuploadFileMods) WithNewOrganization(mods ...OrganizationMod) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m fileuploadFileMods) WithExistingOrganization(em *models.Organization) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - o.r.Organization = &fileuploadFileROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m fileuploadFileMods) WithoutOrganization() FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - o.r.Organization = nil - }) -} - -func (m fileuploadFileMods) WithErrorFiles(number int, related *FileuploadErrorFileTemplate) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - o.r.ErrorFiles = []*fileuploadFileRErrorFilesR{{ - number: number, - o: related, - }} - }) -} - -func (m fileuploadFileMods) WithNewErrorFiles(number int, mods ...FileuploadErrorFileMod) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - related := o.f.NewFileuploadErrorFileWithContext(ctx, mods...) - m.WithErrorFiles(number, related).Apply(ctx, o) - }) -} - -func (m fileuploadFileMods) AddErrorFiles(number int, related *FileuploadErrorFileTemplate) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - o.r.ErrorFiles = append(o.r.ErrorFiles, &fileuploadFileRErrorFilesR{ - number: number, - o: related, - }) - }) -} - -func (m fileuploadFileMods) AddNewErrorFiles(number int, mods ...FileuploadErrorFileMod) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - related := o.f.NewFileuploadErrorFileWithContext(ctx, mods...) - m.AddErrorFiles(number, related).Apply(ctx, o) - }) -} - -func (m fileuploadFileMods) AddExistingErrorFiles(existingModels ...*models.FileuploadErrorFile) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - for _, em := range existingModels { - o.r.ErrorFiles = append(o.r.ErrorFiles, &fileuploadFileRErrorFilesR{ - o: o.f.FromExistingFileuploadErrorFile(em), - }) - } - }) -} - -func (m fileuploadFileMods) WithoutErrorFiles() FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - o.r.ErrorFiles = nil - }) -} - -func (m fileuploadFileMods) WithSites(number int, related *SiteTemplate) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - o.r.Sites = []*fileuploadFileRSitesR{{ - number: number, - o: related, - }} - }) -} - -func (m fileuploadFileMods) WithNewSites(number int, mods ...SiteMod) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - related := o.f.NewSiteWithContext(ctx, mods...) - m.WithSites(number, related).Apply(ctx, o) - }) -} - -func (m fileuploadFileMods) AddSites(number int, related *SiteTemplate) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - o.r.Sites = append(o.r.Sites, &fileuploadFileRSitesR{ - number: number, - o: related, - }) - }) -} - -func (m fileuploadFileMods) AddNewSites(number int, mods ...SiteMod) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - related := o.f.NewSiteWithContext(ctx, mods...) - m.AddSites(number, related).Apply(ctx, o) - }) -} - -func (m fileuploadFileMods) AddExistingSites(existingModels ...*models.Site) FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - for _, em := range existingModels { - o.r.Sites = append(o.r.Sites, &fileuploadFileRSitesR{ - o: o.f.FromExistingSite(em), - }) - } - }) -} - -func (m fileuploadFileMods) WithoutSites() FileuploadFileMod { - return FileuploadFileModFunc(func(ctx context.Context, o *FileuploadFileTemplate) { - o.r.Sites = nil - }) -} diff --git a/db/factory/fileupload.pool.bob.go b/db/factory/fileupload.pool.bob.go deleted file mode 100644 index c4d18d57..00000000 --- a/db/factory/fileupload.pool.bob.go +++ /dev/null @@ -1,1596 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types/pgtypes" - 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/jaswdr/faker/v2" -) - -type FileuploadPoolMod interface { - Apply(context.Context, *FileuploadPoolTemplate) -} - -type FileuploadPoolModFunc func(context.Context, *FileuploadPoolTemplate) - -func (f FileuploadPoolModFunc) Apply(ctx context.Context, n *FileuploadPoolTemplate) { - f(ctx, n) -} - -type FileuploadPoolModSlice []FileuploadPoolMod - -func (mods FileuploadPoolModSlice) Apply(ctx context.Context, n *FileuploadPoolTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// FileuploadPoolTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type FileuploadPoolTemplate struct { - AddressPostalCode func() string - AddressStreet func() string - Committed func() bool - Created func() time.Time - CreatorID func() int32 - CSVFile func() int32 - Deleted func() null.Val[time.Time] - Geom func() null.Val[string] - H3cell func() null.Val[string] - ID func() int32 - IsInDistrict func() bool - IsNew func() bool - Notes func() string - PropertyOwnerName func() string - PropertyOwnerPhoneE164 func() null.Val[string] - ResidentOwned func() null.Val[bool] - ResidentPhoneE164 func() null.Val[string] - LineNumber func() int32 - Tags func() pgtypes.HStore - AddressNumber func() string - AddressLocality func() string - AddressRegion func() string - Condition func() enums.Poolconditiontype - - r fileuploadPoolR - f *Factory - - alreadyPersisted bool -} - -type fileuploadPoolR struct { - CreatorUser *fileuploadPoolRCreatorUserR - CSVFileCSV *fileuploadPoolRCSVFileCSVR - PropertyOwnerPhoneE164Phone *fileuploadPoolRPropertyOwnerPhoneE164PhoneR - ResidentPhoneE164Phone *fileuploadPoolRResidentPhoneE164PhoneR -} - -type fileuploadPoolRCreatorUserR struct { - o *UserTemplate -} -type fileuploadPoolRCSVFileCSVR struct { - o *FileuploadCSVTemplate -} -type fileuploadPoolRPropertyOwnerPhoneE164PhoneR struct { - o *CommsPhoneTemplate -} -type fileuploadPoolRResidentPhoneE164PhoneR struct { - o *CommsPhoneTemplate -} - -// Apply mods to the FileuploadPoolTemplate -func (o *FileuploadPoolTemplate) Apply(ctx context.Context, mods ...FileuploadPoolMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.FileuploadPool -// according to the relationships in the template. Nothing is inserted into the db -func (t FileuploadPoolTemplate) setModelRels(o *models.FileuploadPool) { - if t.r.CreatorUser != nil { - rel := t.r.CreatorUser.o.Build() - rel.R.FileuploadPool = append(rel.R.FileuploadPool, o) - o.CreatorID = rel.ID // h2 - o.R.CreatorUser = rel - } - - if t.r.CSVFileCSV != nil { - rel := t.r.CSVFileCSV.o.Build() - rel.R.CSVFilePools = append(rel.R.CSVFilePools, o) - o.CSVFile = rel.FileID // h2 - o.R.CSVFileCSV = rel - } - - if t.r.PropertyOwnerPhoneE164Phone != nil { - rel := t.r.PropertyOwnerPhoneE164Phone.o.Build() - rel.R.PropertyOwnerPhoneE164Pools = append(rel.R.PropertyOwnerPhoneE164Pools, o) - o.PropertyOwnerPhoneE164 = null.From(rel.E164) // h2 - o.R.PropertyOwnerPhoneE164Phone = rel - } - - if t.r.ResidentPhoneE164Phone != nil { - rel := t.r.ResidentPhoneE164Phone.o.Build() - rel.R.ResidentPhoneE164Pools = append(rel.R.ResidentPhoneE164Pools, o) - o.ResidentPhoneE164 = null.From(rel.E164) // h2 - o.R.ResidentPhoneE164Phone = rel - } -} - -// BuildSetter returns an *models.FileuploadPoolSetter -// this does nothing with the relationship templates -func (o FileuploadPoolTemplate) BuildSetter() *models.FileuploadPoolSetter { - m := &models.FileuploadPoolSetter{} - - if o.AddressPostalCode != nil { - val := o.AddressPostalCode() - m.AddressPostalCode = omit.From(val) - } - if o.AddressStreet != nil { - val := o.AddressStreet() - m.AddressStreet = omit.From(val) - } - if o.Committed != nil { - val := o.Committed() - m.Committed = omit.From(val) - } - 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.CSVFile != nil { - val := o.CSVFile() - m.CSVFile = omit.From(val) - } - if o.Deleted != nil { - val := o.Deleted() - m.Deleted = omitnull.FromNull(val) - } - if o.Geom != nil { - val := o.Geom() - m.Geom = omitnull.FromNull(val) - } - if o.H3cell != nil { - val := o.H3cell() - m.H3cell = omitnull.FromNull(val) - } - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.IsInDistrict != nil { - val := o.IsInDistrict() - m.IsInDistrict = omit.From(val) - } - if o.IsNew != nil { - val := o.IsNew() - m.IsNew = omit.From(val) - } - if o.Notes != nil { - val := o.Notes() - m.Notes = omit.From(val) - } - if o.PropertyOwnerName != nil { - val := o.PropertyOwnerName() - m.PropertyOwnerName = omit.From(val) - } - if o.PropertyOwnerPhoneE164 != nil { - val := o.PropertyOwnerPhoneE164() - m.PropertyOwnerPhoneE164 = omitnull.FromNull(val) - } - if o.ResidentOwned != nil { - val := o.ResidentOwned() - m.ResidentOwned = omitnull.FromNull(val) - } - if o.ResidentPhoneE164 != nil { - val := o.ResidentPhoneE164() - m.ResidentPhoneE164 = omitnull.FromNull(val) - } - if o.LineNumber != nil { - val := o.LineNumber() - m.LineNumber = omit.From(val) - } - if o.Tags != nil { - val := o.Tags() - m.Tags = omit.From(val) - } - if o.AddressNumber != nil { - val := o.AddressNumber() - m.AddressNumber = omit.From(val) - } - if o.AddressLocality != nil { - val := o.AddressLocality() - m.AddressLocality = omit.From(val) - } - if o.AddressRegion != nil { - val := o.AddressRegion() - m.AddressRegion = omit.From(val) - } - if o.Condition != nil { - val := o.Condition() - m.Condition = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.FileuploadPoolSetter -// this does nothing with the relationship templates -func (o FileuploadPoolTemplate) BuildManySetter(number int) []*models.FileuploadPoolSetter { - m := make([]*models.FileuploadPoolSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.FileuploadPool -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FileuploadPoolTemplate.Create -func (o FileuploadPoolTemplate) Build() *models.FileuploadPool { - m := &models.FileuploadPool{} - - if o.AddressPostalCode != nil { - m.AddressPostalCode = o.AddressPostalCode() - } - if o.AddressStreet != nil { - m.AddressStreet = o.AddressStreet() - } - if o.Committed != nil { - m.Committed = o.Committed() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatorID != nil { - m.CreatorID = o.CreatorID() - } - if o.CSVFile != nil { - m.CSVFile = o.CSVFile() - } - if o.Deleted != nil { - m.Deleted = o.Deleted() - } - if o.Geom != nil { - m.Geom = o.Geom() - } - if o.H3cell != nil { - m.H3cell = o.H3cell() - } - if o.ID != nil { - m.ID = o.ID() - } - if o.IsInDistrict != nil { - m.IsInDistrict = o.IsInDistrict() - } - if o.IsNew != nil { - m.IsNew = o.IsNew() - } - if o.Notes != nil { - m.Notes = o.Notes() - } - if o.PropertyOwnerName != nil { - m.PropertyOwnerName = o.PropertyOwnerName() - } - if o.PropertyOwnerPhoneE164 != nil { - m.PropertyOwnerPhoneE164 = o.PropertyOwnerPhoneE164() - } - if o.ResidentOwned != nil { - m.ResidentOwned = o.ResidentOwned() - } - if o.ResidentPhoneE164 != nil { - m.ResidentPhoneE164 = o.ResidentPhoneE164() - } - if o.LineNumber != nil { - m.LineNumber = o.LineNumber() - } - if o.Tags != nil { - m.Tags = o.Tags() - } - if o.AddressNumber != nil { - m.AddressNumber = o.AddressNumber() - } - if o.AddressLocality != nil { - m.AddressLocality = o.AddressLocality() - } - if o.AddressRegion != nil { - m.AddressRegion = o.AddressRegion() - } - if o.Condition != nil { - m.Condition = o.Condition() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.FileuploadPoolSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use FileuploadPoolTemplate.CreateMany -func (o FileuploadPoolTemplate) BuildMany(number int) models.FileuploadPoolSlice { - m := make(models.FileuploadPoolSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableFileuploadPool(m *models.FileuploadPoolSetter) { - if !(m.AddressPostalCode.IsValue()) { - val := random_string(nil) - m.AddressPostalCode = omit.From(val) - } - if !(m.AddressStreet.IsValue()) { - val := random_string(nil) - m.AddressStreet = omit.From(val) - } - if !(m.Committed.IsValue()) { - val := random_bool(nil) - m.Committed = omit.From(val) - } - 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.CSVFile.IsValue()) { - val := random_int32(nil) - m.CSVFile = omit.From(val) - } - if !(m.IsInDistrict.IsValue()) { - val := random_bool(nil) - m.IsInDistrict = omit.From(val) - } - if !(m.IsNew.IsValue()) { - val := random_bool(nil) - m.IsNew = omit.From(val) - } - if !(m.Notes.IsValue()) { - val := random_string(nil) - m.Notes = omit.From(val) - } - if !(m.PropertyOwnerName.IsValue()) { - val := random_string(nil) - m.PropertyOwnerName = omit.From(val) - } - if !(m.LineNumber.IsValue()) { - val := random_int32(nil) - m.LineNumber = omit.From(val) - } - if !(m.Tags.IsValue()) { - val := random_pgtypes_HStore(nil) - m.Tags = omit.From(val) - } - if !(m.AddressNumber.IsValue()) { - val := random_string(nil) - m.AddressNumber = omit.From(val) - } - if !(m.AddressLocality.IsValue()) { - val := random_string(nil) - m.AddressLocality = omit.From(val) - } - if !(m.AddressRegion.IsValue()) { - val := random_string(nil) - m.AddressRegion = omit.From(val) - } - if !(m.Condition.IsValue()) { - val := random_enums_Poolconditiontype(nil) - m.Condition = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.FileuploadPool -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *FileuploadPoolTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FileuploadPool) error { - var err error - - isPropertyOwnerPhoneE164PhoneDone, _ := fileuploadPoolRelPropertyOwnerPhoneE164PhoneCtx.Value(ctx) - if !isPropertyOwnerPhoneE164PhoneDone && o.r.PropertyOwnerPhoneE164Phone != nil { - ctx = fileuploadPoolRelPropertyOwnerPhoneE164PhoneCtx.WithValue(ctx, true) - if o.r.PropertyOwnerPhoneE164Phone.o.alreadyPersisted { - m.R.PropertyOwnerPhoneE164Phone = o.r.PropertyOwnerPhoneE164Phone.o.Build() - } else { - var rel2 *models.CommsPhone - rel2, err = o.r.PropertyOwnerPhoneE164Phone.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachPropertyOwnerPhoneE164Phone(ctx, exec, rel2) - if err != nil { - return err - } - } - - } - - isResidentPhoneE164PhoneDone, _ := fileuploadPoolRelResidentPhoneE164PhoneCtx.Value(ctx) - if !isResidentPhoneE164PhoneDone && o.r.ResidentPhoneE164Phone != nil { - ctx = fileuploadPoolRelResidentPhoneE164PhoneCtx.WithValue(ctx, true) - if o.r.ResidentPhoneE164Phone.o.alreadyPersisted { - m.R.ResidentPhoneE164Phone = o.r.ResidentPhoneE164Phone.o.Build() - } else { - var rel3 *models.CommsPhone - rel3, err = o.r.ResidentPhoneE164Phone.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachResidentPhoneE164Phone(ctx, exec, rel3) - if err != nil { - return err - } - } - - } - - return err -} - -// Create builds a fileuploadPool and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *FileuploadPoolTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FileuploadPool, error) { - var err error - opt := o.BuildSetter() - ensureCreatableFileuploadPool(opt) - - if o.r.CreatorUser == nil { - FileuploadPoolMods.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.CSVFileCSV == nil { - FileuploadPoolMods.WithNewCSVFileCSV().Apply(ctx, o) - } - - var rel1 *models.FileuploadCSV - - if o.r.CSVFileCSV.o.alreadyPersisted { - rel1 = o.r.CSVFileCSV.o.Build() - } else { - rel1, err = o.r.CSVFileCSV.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.CSVFile = omit.From(rel1.FileID) - - m, err := models.FileuploadPools.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.CreatorUser = rel0 - m.R.CSVFileCSV = rel1 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a fileuploadPool and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *FileuploadPoolTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FileuploadPool { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a fileuploadPool 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 *FileuploadPoolTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FileuploadPool { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple fileuploadPools and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o FileuploadPoolTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FileuploadPoolSlice, error) { - var err error - m := make(models.FileuploadPoolSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple fileuploadPools and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o FileuploadPoolTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FileuploadPoolSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple fileuploadPools 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 FileuploadPoolTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FileuploadPoolSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// FileuploadPool has methods that act as mods for the FileuploadPoolTemplate -var FileuploadPoolMods fileuploadPoolMods - -type fileuploadPoolMods struct{} - -func (m fileuploadPoolMods) RandomizeAllColumns(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModSlice{ - FileuploadPoolMods.RandomAddressPostalCode(f), - FileuploadPoolMods.RandomAddressStreet(f), - FileuploadPoolMods.RandomCommitted(f), - FileuploadPoolMods.RandomCreated(f), - FileuploadPoolMods.RandomCreatorID(f), - FileuploadPoolMods.RandomCSVFile(f), - FileuploadPoolMods.RandomDeleted(f), - FileuploadPoolMods.RandomGeom(f), - FileuploadPoolMods.RandomH3cell(f), - FileuploadPoolMods.RandomID(f), - FileuploadPoolMods.RandomIsInDistrict(f), - FileuploadPoolMods.RandomIsNew(f), - FileuploadPoolMods.RandomNotes(f), - FileuploadPoolMods.RandomPropertyOwnerName(f), - FileuploadPoolMods.RandomPropertyOwnerPhoneE164(f), - FileuploadPoolMods.RandomResidentOwned(f), - FileuploadPoolMods.RandomResidentPhoneE164(f), - FileuploadPoolMods.RandomLineNumber(f), - FileuploadPoolMods.RandomTags(f), - FileuploadPoolMods.RandomAddressNumber(f), - FileuploadPoolMods.RandomAddressLocality(f), - FileuploadPoolMods.RandomAddressRegion(f), - FileuploadPoolMods.RandomCondition(f), - } -} - -// Set the model columns to this value -func (m fileuploadPoolMods) AddressPostalCode(val string) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.AddressPostalCode = func() string { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) AddressPostalCodeFunc(f func() string) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.AddressPostalCode = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetAddressPostalCode() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.AddressPostalCode = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadPoolMods) RandomAddressPostalCode(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.AddressPostalCode = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadPoolMods) AddressStreet(val string) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.AddressStreet = func() string { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) AddressStreetFunc(f func() string) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.AddressStreet = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetAddressStreet() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.AddressStreet = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadPoolMods) RandomAddressStreet(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.AddressStreet = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadPoolMods) Committed(val bool) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Committed = func() bool { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) CommittedFunc(f func() bool) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Committed = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetCommitted() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Committed = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadPoolMods) RandomCommitted(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Committed = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadPoolMods) Created(val time.Time) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) CreatedFunc(f func() time.Time) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetCreated() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - 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 fileuploadPoolMods) RandomCreated(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadPoolMods) CreatorID(val int32) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.CreatorID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) CreatorIDFunc(f func() int32) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.CreatorID = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetCreatorID() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - 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 fileuploadPoolMods) RandomCreatorID(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.CreatorID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadPoolMods) CSVFile(val int32) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.CSVFile = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) CSVFileFunc(f func() int32) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.CSVFile = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetCSVFile() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.CSVFile = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadPoolMods) RandomCSVFile(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.CSVFile = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadPoolMods) Deleted(val null.Val[time.Time]) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Deleted = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) DeletedFunc(f func() null.Val[time.Time]) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Deleted = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetDeleted() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - 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 fileuploadPoolMods) RandomDeleted(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - 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 fileuploadPoolMods) RandomDeletedNotNull(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - 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 fileuploadPoolMods) Geom(val null.Val[string]) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Geom = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) GeomFunc(f func() null.Val[string]) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Geom = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetGeom() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - 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 fileuploadPoolMods) RandomGeom(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - 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 fileuploadPoolMods) RandomGeomNotNull(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Geom = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fileuploadPoolMods) H3cell(val null.Val[string]) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.H3cell = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) H3cellFunc(f func() null.Val[string]) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.H3cell = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetH3cell() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.H3cell = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m fileuploadPoolMods) RandomH3cell(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.H3cell = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fileuploadPoolMods) RandomH3cellNotNull(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.H3cell = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fileuploadPoolMods) ID(val int32) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) IDFunc(f func() int32) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetID() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadPoolMods) RandomID(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadPoolMods) IsInDistrict(val bool) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.IsInDistrict = func() bool { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) IsInDistrictFunc(f func() bool) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.IsInDistrict = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetIsInDistrict() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.IsInDistrict = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadPoolMods) RandomIsInDistrict(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.IsInDistrict = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadPoolMods) IsNew(val bool) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.IsNew = func() bool { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) IsNewFunc(f func() bool) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.IsNew = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetIsNew() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.IsNew = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadPoolMods) RandomIsNew(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.IsNew = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadPoolMods) Notes(val string) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Notes = func() string { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) NotesFunc(f func() string) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Notes = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetNotes() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Notes = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadPoolMods) RandomNotes(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Notes = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadPoolMods) PropertyOwnerName(val string) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.PropertyOwnerName = func() string { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) PropertyOwnerNameFunc(f func() string) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.PropertyOwnerName = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetPropertyOwnerName() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.PropertyOwnerName = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadPoolMods) RandomPropertyOwnerName(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.PropertyOwnerName = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadPoolMods) PropertyOwnerPhoneE164(val null.Val[string]) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.PropertyOwnerPhoneE164 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) PropertyOwnerPhoneE164Func(f func() null.Val[string]) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.PropertyOwnerPhoneE164 = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetPropertyOwnerPhoneE164() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.PropertyOwnerPhoneE164 = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m fileuploadPoolMods) RandomPropertyOwnerPhoneE164(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.PropertyOwnerPhoneE164 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fileuploadPoolMods) RandomPropertyOwnerPhoneE164NotNull(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.PropertyOwnerPhoneE164 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fileuploadPoolMods) ResidentOwned(val null.Val[bool]) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.ResidentOwned = func() null.Val[bool] { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) ResidentOwnedFunc(f func() null.Val[bool]) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.ResidentOwned = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetResidentOwned() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.ResidentOwned = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m fileuploadPoolMods) RandomResidentOwned(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.ResidentOwned = func() null.Val[bool] { - if f == nil { - f = &defaultFaker - } - - val := random_bool(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fileuploadPoolMods) RandomResidentOwnedNotNull(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.ResidentOwned = func() null.Val[bool] { - if f == nil { - f = &defaultFaker - } - - val := random_bool(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fileuploadPoolMods) ResidentPhoneE164(val null.Val[string]) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.ResidentPhoneE164 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) ResidentPhoneE164Func(f func() null.Val[string]) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.ResidentPhoneE164 = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetResidentPhoneE164() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.ResidentPhoneE164 = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m fileuploadPoolMods) RandomResidentPhoneE164(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.ResidentPhoneE164 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m fileuploadPoolMods) RandomResidentPhoneE164NotNull(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.ResidentPhoneE164 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m fileuploadPoolMods) LineNumber(val int32) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.LineNumber = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) LineNumberFunc(f func() int32) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.LineNumber = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetLineNumber() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.LineNumber = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadPoolMods) RandomLineNumber(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.LineNumber = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadPoolMods) Tags(val pgtypes.HStore) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Tags = func() pgtypes.HStore { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) TagsFunc(f func() pgtypes.HStore) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Tags = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetTags() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Tags = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadPoolMods) RandomTags(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Tags = func() pgtypes.HStore { - return random_pgtypes_HStore(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadPoolMods) AddressNumber(val string) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.AddressNumber = func() string { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) AddressNumberFunc(f func() string) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.AddressNumber = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetAddressNumber() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.AddressNumber = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadPoolMods) RandomAddressNumber(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.AddressNumber = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadPoolMods) AddressLocality(val string) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.AddressLocality = func() string { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) AddressLocalityFunc(f func() string) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.AddressLocality = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetAddressLocality() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.AddressLocality = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadPoolMods) RandomAddressLocality(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.AddressLocality = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadPoolMods) AddressRegion(val string) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.AddressRegion = func() string { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) AddressRegionFunc(f func() string) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.AddressRegion = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetAddressRegion() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.AddressRegion = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadPoolMods) RandomAddressRegion(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.AddressRegion = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m fileuploadPoolMods) Condition(val enums.Poolconditiontype) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Condition = func() enums.Poolconditiontype { return val } - }) -} - -// Set the Column from the function -func (m fileuploadPoolMods) ConditionFunc(f func() enums.Poolconditiontype) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Condition = f - }) -} - -// Clear any values for the column -func (m fileuploadPoolMods) UnsetCondition() FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Condition = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m fileuploadPoolMods) RandomCondition(f *faker.Faker) FileuploadPoolMod { - return FileuploadPoolModFunc(func(_ context.Context, o *FileuploadPoolTemplate) { - o.Condition = func() enums.Poolconditiontype { - return random_enums_Poolconditiontype(f) - } - }) -} - -func (m fileuploadPoolMods) WithParentsCascading() FileuploadPoolMod { - return FileuploadPoolModFunc(func(ctx context.Context, o *FileuploadPoolTemplate) { - if isDone, _ := fileuploadPoolWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = fileuploadPoolWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewUserWithContext(ctx, UserMods.WithParentsCascading()) - m.WithCreatorUser(related).Apply(ctx, o) - } - { - - related := o.f.NewFileuploadCSVWithContext(ctx, FileuploadCSVMods.WithParentsCascading()) - m.WithCSVFileCSV(related).Apply(ctx, o) - } - { - - related := o.f.NewCommsPhoneWithContext(ctx, CommsPhoneMods.WithParentsCascading()) - m.WithPropertyOwnerPhoneE164Phone(related).Apply(ctx, o) - } - { - - related := o.f.NewCommsPhoneWithContext(ctx, CommsPhoneMods.WithParentsCascading()) - m.WithResidentPhoneE164Phone(related).Apply(ctx, o) - } - }) -} - -func (m fileuploadPoolMods) WithCreatorUser(rel *UserTemplate) FileuploadPoolMod { - return FileuploadPoolModFunc(func(ctx context.Context, o *FileuploadPoolTemplate) { - o.r.CreatorUser = &fileuploadPoolRCreatorUserR{ - o: rel, - } - }) -} - -func (m fileuploadPoolMods) WithNewCreatorUser(mods ...UserMod) FileuploadPoolMod { - return FileuploadPoolModFunc(func(ctx context.Context, o *FileuploadPoolTemplate) { - related := o.f.NewUserWithContext(ctx, mods...) - - m.WithCreatorUser(related).Apply(ctx, o) - }) -} - -func (m fileuploadPoolMods) WithExistingCreatorUser(em *models.User) FileuploadPoolMod { - return FileuploadPoolModFunc(func(ctx context.Context, o *FileuploadPoolTemplate) { - o.r.CreatorUser = &fileuploadPoolRCreatorUserR{ - o: o.f.FromExistingUser(em), - } - }) -} - -func (m fileuploadPoolMods) WithoutCreatorUser() FileuploadPoolMod { - return FileuploadPoolModFunc(func(ctx context.Context, o *FileuploadPoolTemplate) { - o.r.CreatorUser = nil - }) -} - -func (m fileuploadPoolMods) WithCSVFileCSV(rel *FileuploadCSVTemplate) FileuploadPoolMod { - return FileuploadPoolModFunc(func(ctx context.Context, o *FileuploadPoolTemplate) { - o.r.CSVFileCSV = &fileuploadPoolRCSVFileCSVR{ - o: rel, - } - }) -} - -func (m fileuploadPoolMods) WithNewCSVFileCSV(mods ...FileuploadCSVMod) FileuploadPoolMod { - return FileuploadPoolModFunc(func(ctx context.Context, o *FileuploadPoolTemplate) { - related := o.f.NewFileuploadCSVWithContext(ctx, mods...) - - m.WithCSVFileCSV(related).Apply(ctx, o) - }) -} - -func (m fileuploadPoolMods) WithExistingCSVFileCSV(em *models.FileuploadCSV) FileuploadPoolMod { - return FileuploadPoolModFunc(func(ctx context.Context, o *FileuploadPoolTemplate) { - o.r.CSVFileCSV = &fileuploadPoolRCSVFileCSVR{ - o: o.f.FromExistingFileuploadCSV(em), - } - }) -} - -func (m fileuploadPoolMods) WithoutCSVFileCSV() FileuploadPoolMod { - return FileuploadPoolModFunc(func(ctx context.Context, o *FileuploadPoolTemplate) { - o.r.CSVFileCSV = nil - }) -} - -func (m fileuploadPoolMods) WithPropertyOwnerPhoneE164Phone(rel *CommsPhoneTemplate) FileuploadPoolMod { - return FileuploadPoolModFunc(func(ctx context.Context, o *FileuploadPoolTemplate) { - o.r.PropertyOwnerPhoneE164Phone = &fileuploadPoolRPropertyOwnerPhoneE164PhoneR{ - o: rel, - } - }) -} - -func (m fileuploadPoolMods) WithNewPropertyOwnerPhoneE164Phone(mods ...CommsPhoneMod) FileuploadPoolMod { - return FileuploadPoolModFunc(func(ctx context.Context, o *FileuploadPoolTemplate) { - related := o.f.NewCommsPhoneWithContext(ctx, mods...) - - m.WithPropertyOwnerPhoneE164Phone(related).Apply(ctx, o) - }) -} - -func (m fileuploadPoolMods) WithExistingPropertyOwnerPhoneE164Phone(em *models.CommsPhone) FileuploadPoolMod { - return FileuploadPoolModFunc(func(ctx context.Context, o *FileuploadPoolTemplate) { - o.r.PropertyOwnerPhoneE164Phone = &fileuploadPoolRPropertyOwnerPhoneE164PhoneR{ - o: o.f.FromExistingCommsPhone(em), - } - }) -} - -func (m fileuploadPoolMods) WithoutPropertyOwnerPhoneE164Phone() FileuploadPoolMod { - return FileuploadPoolModFunc(func(ctx context.Context, o *FileuploadPoolTemplate) { - o.r.PropertyOwnerPhoneE164Phone = nil - }) -} - -func (m fileuploadPoolMods) WithResidentPhoneE164Phone(rel *CommsPhoneTemplate) FileuploadPoolMod { - return FileuploadPoolModFunc(func(ctx context.Context, o *FileuploadPoolTemplate) { - o.r.ResidentPhoneE164Phone = &fileuploadPoolRResidentPhoneE164PhoneR{ - o: rel, - } - }) -} - -func (m fileuploadPoolMods) WithNewResidentPhoneE164Phone(mods ...CommsPhoneMod) FileuploadPoolMod { - return FileuploadPoolModFunc(func(ctx context.Context, o *FileuploadPoolTemplate) { - related := o.f.NewCommsPhoneWithContext(ctx, mods...) - - m.WithResidentPhoneE164Phone(related).Apply(ctx, o) - }) -} - -func (m fileuploadPoolMods) WithExistingResidentPhoneE164Phone(em *models.CommsPhone) FileuploadPoolMod { - return FileuploadPoolModFunc(func(ctx context.Context, o *FileuploadPoolTemplate) { - o.r.ResidentPhoneE164Phone = &fileuploadPoolRResidentPhoneE164PhoneR{ - o: o.f.FromExistingCommsPhone(em), - } - }) -} - -func (m fileuploadPoolMods) WithoutResidentPhoneE164Phone() FileuploadPoolMod { - return FileuploadPoolModFunc(func(ctx context.Context, o *FileuploadPoolTemplate) { - o.r.ResidentPhoneE164Phone = nil - }) -} diff --git a/db/factory/geography_columns.bob.go b/db/factory/geography_columns.bob.go deleted file mode 100644 index 17469e4b..00000000 --- a/db/factory/geography_columns.bob.go +++ /dev/null @@ -1,500 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/jaswdr/faker/v2" -) - -type GeographyColumnMod interface { - Apply(context.Context, *GeographyColumnTemplate) -} - -type GeographyColumnModFunc func(context.Context, *GeographyColumnTemplate) - -func (f GeographyColumnModFunc) Apply(ctx context.Context, n *GeographyColumnTemplate) { - f(ctx, n) -} - -type GeographyColumnModSlice []GeographyColumnMod - -func (mods GeographyColumnModSlice) Apply(ctx context.Context, n *GeographyColumnTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// GeographyColumnTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type GeographyColumnTemplate struct { - FTableCatalog func() null.Val[string] - FTableSchema func() null.Val[string] - FTableName func() null.Val[string] - FGeographyColumn func() null.Val[string] - CoordDimension func() null.Val[int32] - Srid func() null.Val[int32] - Type func() null.Val[string] - - f *Factory - - alreadyPersisted bool -} - -// Apply mods to the GeographyColumnTemplate -func (o *GeographyColumnTemplate) Apply(ctx context.Context, mods ...GeographyColumnMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.GeographyColumn -// according to the relationships in the template. Nothing is inserted into the db -func (t GeographyColumnTemplate) setModelRels(o *models.GeographyColumn) {} - -// Build returns an *models.GeographyColumn -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use GeographyColumnTemplate.Create -func (o GeographyColumnTemplate) Build() *models.GeographyColumn { - m := &models.GeographyColumn{} - - if o.FTableCatalog != nil { - m.FTableCatalog = o.FTableCatalog() - } - if o.FTableSchema != nil { - m.FTableSchema = o.FTableSchema() - } - if o.FTableName != nil { - m.FTableName = o.FTableName() - } - if o.FGeographyColumn != nil { - m.FGeographyColumn = o.FGeographyColumn() - } - if o.CoordDimension != nil { - m.CoordDimension = o.CoordDimension() - } - if o.Srid != nil { - m.Srid = o.Srid() - } - if o.Type != nil { - m.Type = o.Type() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.GeographyColumnSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use GeographyColumnTemplate.CreateMany -func (o GeographyColumnTemplate) BuildMany(number int) models.GeographyColumnSlice { - m := make(models.GeographyColumnSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -// GeographyColumn has methods that act as mods for the GeographyColumnTemplate -var GeographyColumnMods geographyColumnMods - -type geographyColumnMods struct{} - -func (m geographyColumnMods) RandomizeAllColumns(f *faker.Faker) GeographyColumnMod { - return GeographyColumnModSlice{ - GeographyColumnMods.RandomFTableCatalog(f), - GeographyColumnMods.RandomFTableSchema(f), - GeographyColumnMods.RandomFTableName(f), - GeographyColumnMods.RandomFGeographyColumn(f), - GeographyColumnMods.RandomCoordDimension(f), - GeographyColumnMods.RandomSrid(f), - GeographyColumnMods.RandomType(f), - } -} - -// Set the model columns to this value -func (m geographyColumnMods) FTableCatalog(val null.Val[string]) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.FTableCatalog = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m geographyColumnMods) FTableCatalogFunc(f func() null.Val[string]) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.FTableCatalog = f - }) -} - -// Clear any values for the column -func (m geographyColumnMods) UnsetFTableCatalog() GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.FTableCatalog = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m geographyColumnMods) RandomFTableCatalog(f *faker.Faker) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.FTableCatalog = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m geographyColumnMods) RandomFTableCatalogNotNull(f *faker.Faker) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.FTableCatalog = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m geographyColumnMods) FTableSchema(val null.Val[string]) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.FTableSchema = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m geographyColumnMods) FTableSchemaFunc(f func() null.Val[string]) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.FTableSchema = f - }) -} - -// Clear any values for the column -func (m geographyColumnMods) UnsetFTableSchema() GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.FTableSchema = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m geographyColumnMods) RandomFTableSchema(f *faker.Faker) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.FTableSchema = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m geographyColumnMods) RandomFTableSchemaNotNull(f *faker.Faker) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.FTableSchema = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m geographyColumnMods) FTableName(val null.Val[string]) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.FTableName = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m geographyColumnMods) FTableNameFunc(f func() null.Val[string]) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.FTableName = f - }) -} - -// Clear any values for the column -func (m geographyColumnMods) UnsetFTableName() GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.FTableName = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m geographyColumnMods) RandomFTableName(f *faker.Faker) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.FTableName = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m geographyColumnMods) RandomFTableNameNotNull(f *faker.Faker) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.FTableName = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m geographyColumnMods) FGeographyColumn(val null.Val[string]) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.FGeographyColumn = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m geographyColumnMods) FGeographyColumnFunc(f func() null.Val[string]) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.FGeographyColumn = f - }) -} - -// Clear any values for the column -func (m geographyColumnMods) UnsetFGeographyColumn() GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.FGeographyColumn = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m geographyColumnMods) RandomFGeographyColumn(f *faker.Faker) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.FGeographyColumn = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m geographyColumnMods) RandomFGeographyColumnNotNull(f *faker.Faker) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.FGeographyColumn = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m geographyColumnMods) CoordDimension(val null.Val[int32]) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.CoordDimension = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m geographyColumnMods) CoordDimensionFunc(f func() null.Val[int32]) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.CoordDimension = f - }) -} - -// Clear any values for the column -func (m geographyColumnMods) UnsetCoordDimension() GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.CoordDimension = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m geographyColumnMods) RandomCoordDimension(f *faker.Faker) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.CoordDimension = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m geographyColumnMods) RandomCoordDimensionNotNull(f *faker.Faker) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.CoordDimension = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m geographyColumnMods) Srid(val null.Val[int32]) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.Srid = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m geographyColumnMods) SridFunc(f func() null.Val[int32]) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.Srid = f - }) -} - -// Clear any values for the column -func (m geographyColumnMods) UnsetSrid() GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.Srid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m geographyColumnMods) RandomSrid(f *faker.Faker) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.Srid = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m geographyColumnMods) RandomSridNotNull(f *faker.Faker) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.Srid = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m geographyColumnMods) Type(val null.Val[string]) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.Type = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m geographyColumnMods) TypeFunc(f func() null.Val[string]) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.Type = f - }) -} - -// Clear any values for the column -func (m geographyColumnMods) UnsetType() GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.Type = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m geographyColumnMods) RandomType(f *faker.Faker) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.Type = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m geographyColumnMods) RandomTypeNotNull(f *faker.Faker) GeographyColumnMod { - return GeographyColumnModFunc(func(_ context.Context, o *GeographyColumnTemplate) { - o.Type = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -func (m geographyColumnMods) WithParentsCascading() GeographyColumnMod { - return GeographyColumnModFunc(func(ctx context.Context, o *GeographyColumnTemplate) { - if isDone, _ := geographyColumnWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = geographyColumnWithParentsCascadingCtx.WithValue(ctx, true) - }) -} diff --git a/db/factory/geometry_columns.bob.go b/db/factory/geometry_columns.bob.go deleted file mode 100644 index 20c97753..00000000 --- a/db/factory/geometry_columns.bob.go +++ /dev/null @@ -1,500 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/jaswdr/faker/v2" -) - -type GeometryColumnMod interface { - Apply(context.Context, *GeometryColumnTemplate) -} - -type GeometryColumnModFunc func(context.Context, *GeometryColumnTemplate) - -func (f GeometryColumnModFunc) Apply(ctx context.Context, n *GeometryColumnTemplate) { - f(ctx, n) -} - -type GeometryColumnModSlice []GeometryColumnMod - -func (mods GeometryColumnModSlice) Apply(ctx context.Context, n *GeometryColumnTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// GeometryColumnTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type GeometryColumnTemplate struct { - FTableCatalog func() null.Val[string] - FTableSchema func() null.Val[string] - FTableName func() null.Val[string] - FGeometryColumn func() null.Val[string] - CoordDimension func() null.Val[int32] - Srid func() null.Val[int32] - Type func() null.Val[string] - - f *Factory - - alreadyPersisted bool -} - -// Apply mods to the GeometryColumnTemplate -func (o *GeometryColumnTemplate) Apply(ctx context.Context, mods ...GeometryColumnMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.GeometryColumn -// according to the relationships in the template. Nothing is inserted into the db -func (t GeometryColumnTemplate) setModelRels(o *models.GeometryColumn) {} - -// Build returns an *models.GeometryColumn -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use GeometryColumnTemplate.Create -func (o GeometryColumnTemplate) Build() *models.GeometryColumn { - m := &models.GeometryColumn{} - - if o.FTableCatalog != nil { - m.FTableCatalog = o.FTableCatalog() - } - if o.FTableSchema != nil { - m.FTableSchema = o.FTableSchema() - } - if o.FTableName != nil { - m.FTableName = o.FTableName() - } - if o.FGeometryColumn != nil { - m.FGeometryColumn = o.FGeometryColumn() - } - if o.CoordDimension != nil { - m.CoordDimension = o.CoordDimension() - } - if o.Srid != nil { - m.Srid = o.Srid() - } - if o.Type != nil { - m.Type = o.Type() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.GeometryColumnSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use GeometryColumnTemplate.CreateMany -func (o GeometryColumnTemplate) BuildMany(number int) models.GeometryColumnSlice { - m := make(models.GeometryColumnSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -// GeometryColumn has methods that act as mods for the GeometryColumnTemplate -var GeometryColumnMods geometryColumnMods - -type geometryColumnMods struct{} - -func (m geometryColumnMods) RandomizeAllColumns(f *faker.Faker) GeometryColumnMod { - return GeometryColumnModSlice{ - GeometryColumnMods.RandomFTableCatalog(f), - GeometryColumnMods.RandomFTableSchema(f), - GeometryColumnMods.RandomFTableName(f), - GeometryColumnMods.RandomFGeometryColumn(f), - GeometryColumnMods.RandomCoordDimension(f), - GeometryColumnMods.RandomSrid(f), - GeometryColumnMods.RandomType(f), - } -} - -// Set the model columns to this value -func (m geometryColumnMods) FTableCatalog(val null.Val[string]) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.FTableCatalog = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m geometryColumnMods) FTableCatalogFunc(f func() null.Val[string]) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.FTableCatalog = f - }) -} - -// Clear any values for the column -func (m geometryColumnMods) UnsetFTableCatalog() GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.FTableCatalog = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m geometryColumnMods) RandomFTableCatalog(f *faker.Faker) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.FTableCatalog = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "256") - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m geometryColumnMods) RandomFTableCatalogNotNull(f *faker.Faker) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.FTableCatalog = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "256") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m geometryColumnMods) FTableSchema(val null.Val[string]) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.FTableSchema = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m geometryColumnMods) FTableSchemaFunc(f func() null.Val[string]) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.FTableSchema = f - }) -} - -// Clear any values for the column -func (m geometryColumnMods) UnsetFTableSchema() GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.FTableSchema = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m geometryColumnMods) RandomFTableSchema(f *faker.Faker) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.FTableSchema = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m geometryColumnMods) RandomFTableSchemaNotNull(f *faker.Faker) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.FTableSchema = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m geometryColumnMods) FTableName(val null.Val[string]) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.FTableName = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m geometryColumnMods) FTableNameFunc(f func() null.Val[string]) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.FTableName = f - }) -} - -// Clear any values for the column -func (m geometryColumnMods) UnsetFTableName() GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.FTableName = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m geometryColumnMods) RandomFTableName(f *faker.Faker) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.FTableName = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m geometryColumnMods) RandomFTableNameNotNull(f *faker.Faker) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.FTableName = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m geometryColumnMods) FGeometryColumn(val null.Val[string]) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.FGeometryColumn = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m geometryColumnMods) FGeometryColumnFunc(f func() null.Val[string]) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.FGeometryColumn = f - }) -} - -// Clear any values for the column -func (m geometryColumnMods) UnsetFGeometryColumn() GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.FGeometryColumn = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m geometryColumnMods) RandomFGeometryColumn(f *faker.Faker) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.FGeometryColumn = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m geometryColumnMods) RandomFGeometryColumnNotNull(f *faker.Faker) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.FGeometryColumn = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m geometryColumnMods) CoordDimension(val null.Val[int32]) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.CoordDimension = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m geometryColumnMods) CoordDimensionFunc(f func() null.Val[int32]) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.CoordDimension = f - }) -} - -// Clear any values for the column -func (m geometryColumnMods) UnsetCoordDimension() GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.CoordDimension = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m geometryColumnMods) RandomCoordDimension(f *faker.Faker) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.CoordDimension = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m geometryColumnMods) RandomCoordDimensionNotNull(f *faker.Faker) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.CoordDimension = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m geometryColumnMods) Srid(val null.Val[int32]) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.Srid = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m geometryColumnMods) SridFunc(f func() null.Val[int32]) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.Srid = f - }) -} - -// Clear any values for the column -func (m geometryColumnMods) UnsetSrid() GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.Srid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m geometryColumnMods) RandomSrid(f *faker.Faker) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.Srid = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m geometryColumnMods) RandomSridNotNull(f *faker.Faker) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.Srid = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m geometryColumnMods) Type(val null.Val[string]) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.Type = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m geometryColumnMods) TypeFunc(f func() null.Val[string]) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.Type = f - }) -} - -// Clear any values for the column -func (m geometryColumnMods) UnsetType() GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.Type = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m geometryColumnMods) RandomType(f *faker.Faker) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.Type = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "30") - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m geometryColumnMods) RandomTypeNotNull(f *faker.Faker) GeometryColumnMod { - return GeometryColumnModFunc(func(_ context.Context, o *GeometryColumnTemplate) { - o.Type = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "30") - return null.From(val) - } - }) -} - -func (m geometryColumnMods) WithParentsCascading() GeometryColumnMod { - return GeometryColumnModFunc(func(ctx context.Context, o *GeometryColumnTemplate) { - if isDone, _ := geometryColumnWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = geometryColumnWithParentsCascadingCtx.WithValue(ctx, true) - }) -} diff --git a/db/factory/goose_db_version.bob.go b/db/factory/goose_db_version.bob.go deleted file mode 100644 index 01377c00..00000000 --- a/db/factory/goose_db_version.bob.go +++ /dev/null @@ -1,380 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/omit" - "github.com/jaswdr/faker/v2" -) - -type GooseDBVersionMod interface { - Apply(context.Context, *GooseDBVersionTemplate) -} - -type GooseDBVersionModFunc func(context.Context, *GooseDBVersionTemplate) - -func (f GooseDBVersionModFunc) Apply(ctx context.Context, n *GooseDBVersionTemplate) { - f(ctx, n) -} - -type GooseDBVersionModSlice []GooseDBVersionMod - -func (mods GooseDBVersionModSlice) Apply(ctx context.Context, n *GooseDBVersionTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// GooseDBVersionTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type GooseDBVersionTemplate struct { - ID func() int32 - VersionID func() int64 - IsApplied func() bool - Tstamp func() time.Time - - f *Factory - - alreadyPersisted bool -} - -// Apply mods to the GooseDBVersionTemplate -func (o *GooseDBVersionTemplate) Apply(ctx context.Context, mods ...GooseDBVersionMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.GooseDBVersion -// according to the relationships in the template. Nothing is inserted into the db -func (t GooseDBVersionTemplate) setModelRels(o *models.GooseDBVersion) {} - -// BuildSetter returns an *models.GooseDBVersionSetter -// this does nothing with the relationship templates -func (o GooseDBVersionTemplate) BuildSetter() *models.GooseDBVersionSetter { - m := &models.GooseDBVersionSetter{} - - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.VersionID != nil { - val := o.VersionID() - m.VersionID = omit.From(val) - } - if o.IsApplied != nil { - val := o.IsApplied() - m.IsApplied = omit.From(val) - } - if o.Tstamp != nil { - val := o.Tstamp() - m.Tstamp = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.GooseDBVersionSetter -// this does nothing with the relationship templates -func (o GooseDBVersionTemplate) BuildManySetter(number int) []*models.GooseDBVersionSetter { - m := make([]*models.GooseDBVersionSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.GooseDBVersion -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use GooseDBVersionTemplate.Create -func (o GooseDBVersionTemplate) Build() *models.GooseDBVersion { - m := &models.GooseDBVersion{} - - if o.ID != nil { - m.ID = o.ID() - } - if o.VersionID != nil { - m.VersionID = o.VersionID() - } - if o.IsApplied != nil { - m.IsApplied = o.IsApplied() - } - if o.Tstamp != nil { - m.Tstamp = o.Tstamp() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.GooseDBVersionSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use GooseDBVersionTemplate.CreateMany -func (o GooseDBVersionTemplate) BuildMany(number int) models.GooseDBVersionSlice { - m := make(models.GooseDBVersionSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableGooseDBVersion(m *models.GooseDBVersionSetter) { - if !(m.VersionID.IsValue()) { - val := random_int64(nil) - m.VersionID = omit.From(val) - } - if !(m.IsApplied.IsValue()) { - val := random_bool(nil) - m.IsApplied = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.GooseDBVersion -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *GooseDBVersionTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.GooseDBVersion) error { - var err error - - return err -} - -// Create builds a gooseDBVersion and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *GooseDBVersionTemplate) Create(ctx context.Context, exec bob.Executor) (*models.GooseDBVersion, error) { - var err error - opt := o.BuildSetter() - ensureCreatableGooseDBVersion(opt) - - m, err := models.GooseDBVersions.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a gooseDBVersion and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *GooseDBVersionTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.GooseDBVersion { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a gooseDBVersion 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 *GooseDBVersionTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.GooseDBVersion { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple gooseDBVersions and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o GooseDBVersionTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.GooseDBVersionSlice, error) { - var err error - m := make(models.GooseDBVersionSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple gooseDBVersions and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o GooseDBVersionTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.GooseDBVersionSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple gooseDBVersions 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 GooseDBVersionTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.GooseDBVersionSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// GooseDBVersion has methods that act as mods for the GooseDBVersionTemplate -var GooseDBVersionMods gooseDBVersionMods - -type gooseDBVersionMods struct{} - -func (m gooseDBVersionMods) RandomizeAllColumns(f *faker.Faker) GooseDBVersionMod { - return GooseDBVersionModSlice{ - GooseDBVersionMods.RandomID(f), - GooseDBVersionMods.RandomVersionID(f), - GooseDBVersionMods.RandomIsApplied(f), - GooseDBVersionMods.RandomTstamp(f), - } -} - -// Set the model columns to this value -func (m gooseDBVersionMods) ID(val int32) GooseDBVersionMod { - return GooseDBVersionModFunc(func(_ context.Context, o *GooseDBVersionTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m gooseDBVersionMods) IDFunc(f func() int32) GooseDBVersionMod { - return GooseDBVersionModFunc(func(_ context.Context, o *GooseDBVersionTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m gooseDBVersionMods) UnsetID() GooseDBVersionMod { - return GooseDBVersionModFunc(func(_ context.Context, o *GooseDBVersionTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m gooseDBVersionMods) RandomID(f *faker.Faker) GooseDBVersionMod { - return GooseDBVersionModFunc(func(_ context.Context, o *GooseDBVersionTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m gooseDBVersionMods) VersionID(val int64) GooseDBVersionMod { - return GooseDBVersionModFunc(func(_ context.Context, o *GooseDBVersionTemplate) { - o.VersionID = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m gooseDBVersionMods) VersionIDFunc(f func() int64) GooseDBVersionMod { - return GooseDBVersionModFunc(func(_ context.Context, o *GooseDBVersionTemplate) { - o.VersionID = f - }) -} - -// Clear any values for the column -func (m gooseDBVersionMods) UnsetVersionID() GooseDBVersionMod { - return GooseDBVersionModFunc(func(_ context.Context, o *GooseDBVersionTemplate) { - o.VersionID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m gooseDBVersionMods) RandomVersionID(f *faker.Faker) GooseDBVersionMod { - return GooseDBVersionModFunc(func(_ context.Context, o *GooseDBVersionTemplate) { - o.VersionID = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m gooseDBVersionMods) IsApplied(val bool) GooseDBVersionMod { - return GooseDBVersionModFunc(func(_ context.Context, o *GooseDBVersionTemplate) { - o.IsApplied = func() bool { return val } - }) -} - -// Set the Column from the function -func (m gooseDBVersionMods) IsAppliedFunc(f func() bool) GooseDBVersionMod { - return GooseDBVersionModFunc(func(_ context.Context, o *GooseDBVersionTemplate) { - o.IsApplied = f - }) -} - -// Clear any values for the column -func (m gooseDBVersionMods) UnsetIsApplied() GooseDBVersionMod { - return GooseDBVersionModFunc(func(_ context.Context, o *GooseDBVersionTemplate) { - o.IsApplied = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m gooseDBVersionMods) RandomIsApplied(f *faker.Faker) GooseDBVersionMod { - return GooseDBVersionModFunc(func(_ context.Context, o *GooseDBVersionTemplate) { - o.IsApplied = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m gooseDBVersionMods) Tstamp(val time.Time) GooseDBVersionMod { - return GooseDBVersionModFunc(func(_ context.Context, o *GooseDBVersionTemplate) { - o.Tstamp = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m gooseDBVersionMods) TstampFunc(f func() time.Time) GooseDBVersionMod { - return GooseDBVersionModFunc(func(_ context.Context, o *GooseDBVersionTemplate) { - o.Tstamp = f - }) -} - -// Clear any values for the column -func (m gooseDBVersionMods) UnsetTstamp() GooseDBVersionMod { - return GooseDBVersionModFunc(func(_ context.Context, o *GooseDBVersionTemplate) { - o.Tstamp = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m gooseDBVersionMods) RandomTstamp(f *faker.Faker) GooseDBVersionMod { - return GooseDBVersionModFunc(func(_ context.Context, o *GooseDBVersionTemplate) { - o.Tstamp = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m gooseDBVersionMods) WithParentsCascading() GooseDBVersionMod { - return GooseDBVersionModFunc(func(ctx context.Context, o *GooseDBVersionTemplate) { - if isDone, _ := gooseDBVersionWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = gooseDBVersionWithParentsCascadingCtx.WithValue(ctx, true) - }) -} diff --git a/db/factory/h3_aggregation.bob.go b/db/factory/h3_aggregation.bob.go deleted file mode 100644 index dc25bfa2..00000000 --- a/db/factory/h3_aggregation.bob.go +++ /dev/null @@ -1,606 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - 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/jaswdr/faker/v2" -) - -type H3AggregationMod interface { - Apply(context.Context, *H3AggregationTemplate) -} - -type H3AggregationModFunc func(context.Context, *H3AggregationTemplate) - -func (f H3AggregationModFunc) Apply(ctx context.Context, n *H3AggregationTemplate) { - f(ctx, n) -} - -type H3AggregationModSlice []H3AggregationMod - -func (mods H3AggregationModSlice) Apply(ctx context.Context, n *H3AggregationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// H3AggregationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type H3AggregationTemplate struct { - ID func() int32 - Cell func() string - Count func() int32 - Geometry func() null.Val[string] - OrganizationID func() int32 - Resolution func() int32 - Type func() enums.H3aggregationtype - - r h3AggregationR - f *Factory - - alreadyPersisted bool -} - -type h3AggregationR struct { - Organization *h3AggregationROrganizationR -} - -type h3AggregationROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the H3AggregationTemplate -func (o *H3AggregationTemplate) Apply(ctx context.Context, mods ...H3AggregationMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.H3Aggregation -// according to the relationships in the template. Nothing is inserted into the db -func (t H3AggregationTemplate) setModelRels(o *models.H3Aggregation) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.H3Aggregations = append(rel.R.H3Aggregations, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.H3AggregationSetter -// this does nothing with the relationship templates -func (o H3AggregationTemplate) BuildSetter() *models.H3AggregationSetter { - m := &models.H3AggregationSetter{} - - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.Cell != nil { - val := o.Cell() - m.Cell = omit.From(val) - } - if o.Count != nil { - val := o.Count() - m.Count = omit.From(val) - } - if o.Geometry != nil { - val := o.Geometry() - m.Geometry = omitnull.FromNull(val) - } - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Resolution != nil { - val := o.Resolution() - m.Resolution = omit.From(val) - } - if o.Type != nil { - val := o.Type() - m.Type = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.H3AggregationSetter -// this does nothing with the relationship templates -func (o H3AggregationTemplate) BuildManySetter(number int) []*models.H3AggregationSetter { - m := make([]*models.H3AggregationSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.H3Aggregation -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use H3AggregationTemplate.Create -func (o H3AggregationTemplate) Build() *models.H3Aggregation { - m := &models.H3Aggregation{} - - if o.ID != nil { - m.ID = o.ID() - } - if o.Cell != nil { - m.Cell = o.Cell() - } - if o.Count != nil { - m.Count = o.Count() - } - if o.Geometry != nil { - m.Geometry = o.Geometry() - } - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Resolution != nil { - m.Resolution = o.Resolution() - } - if o.Type != nil { - m.Type = o.Type() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.H3AggregationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use H3AggregationTemplate.CreateMany -func (o H3AggregationTemplate) BuildMany(number int) models.H3AggregationSlice { - m := make(models.H3AggregationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableH3Aggregation(m *models.H3AggregationSetter) { - if !(m.Cell.IsValue()) { - val := random_string(nil) - m.Cell = omit.From(val) - } - if !(m.Count.IsValue()) { - val := random_int32(nil) - m.Count = omit.From(val) - } - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Resolution.IsValue()) { - val := random_int32(nil) - m.Resolution = omit.From(val) - } - if !(m.Type.IsValue()) { - val := random_enums_H3aggregationtype(nil) - m.Type = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.H3Aggregation -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *H3AggregationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.H3Aggregation) error { - var err error - - return err -} - -// Create builds a h3Aggregation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *H3AggregationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.H3Aggregation, error) { - var err error - opt := o.BuildSetter() - ensureCreatableH3Aggregation(opt) - - if o.r.Organization == nil { - H3AggregationMods.WithNewOrganization().Apply(ctx, o) - } - - var rel0 *models.Organization - - if o.r.Organization.o.alreadyPersisted { - rel0 = o.r.Organization.o.Build() - } else { - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.OrganizationID = omit.From(rel0.ID) - - m, err := models.H3Aggregations.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.Organization = rel0 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a h3Aggregation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *H3AggregationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.H3Aggregation { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a h3Aggregation and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// It calls `tb.Fatal(err)` on the test/benchmark if an error occurs -func (o *H3AggregationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.H3Aggregation { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple h3Aggregations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o H3AggregationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.H3AggregationSlice, error) { - var err error - m := make(models.H3AggregationSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple h3Aggregations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o H3AggregationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.H3AggregationSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple h3Aggregations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// It calls `tb.Fatal(err)` on the test/benchmark if an error occurs -func (o H3AggregationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.H3AggregationSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// H3Aggregation has methods that act as mods for the H3AggregationTemplate -var H3AggregationMods h3AggregationMods - -type h3AggregationMods struct{} - -func (m h3AggregationMods) RandomizeAllColumns(f *faker.Faker) H3AggregationMod { - return H3AggregationModSlice{ - H3AggregationMods.RandomID(f), - H3AggregationMods.RandomCell(f), - H3AggregationMods.RandomCount(f), - H3AggregationMods.RandomGeometry(f), - H3AggregationMods.RandomOrganizationID(f), - H3AggregationMods.RandomResolution(f), - H3AggregationMods.RandomType(f), - } -} - -// Set the model columns to this value -func (m h3AggregationMods) ID(val int32) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m h3AggregationMods) IDFunc(f func() int32) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m h3AggregationMods) UnsetID() H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m h3AggregationMods) RandomID(f *faker.Faker) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m h3AggregationMods) Cell(val string) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.Cell = func() string { return val } - }) -} - -// Set the Column from the function -func (m h3AggregationMods) CellFunc(f func() string) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.Cell = f - }) -} - -// Clear any values for the column -func (m h3AggregationMods) UnsetCell() H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.Cell = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m h3AggregationMods) RandomCell(f *faker.Faker) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.Cell = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m h3AggregationMods) Count(val int32) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.Count = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m h3AggregationMods) CountFunc(f func() int32) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.Count = f - }) -} - -// Clear any values for the column -func (m h3AggregationMods) UnsetCount() H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.Count = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m h3AggregationMods) RandomCount(f *faker.Faker) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.Count = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m h3AggregationMods) Geometry(val null.Val[string]) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.Geometry = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m h3AggregationMods) GeometryFunc(f func() null.Val[string]) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.Geometry = f - }) -} - -// Clear any values for the column -func (m h3AggregationMods) UnsetGeometry() H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.Geometry = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m h3AggregationMods) RandomGeometry(f *faker.Faker) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.Geometry = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m h3AggregationMods) RandomGeometryNotNull(f *faker.Faker) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.Geometry = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m h3AggregationMods) OrganizationID(val int32) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m h3AggregationMods) OrganizationIDFunc(f func() int32) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m h3AggregationMods) UnsetOrganizationID() H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.OrganizationID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m h3AggregationMods) RandomOrganizationID(f *faker.Faker) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m h3AggregationMods) Resolution(val int32) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.Resolution = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m h3AggregationMods) ResolutionFunc(f func() int32) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.Resolution = f - }) -} - -// Clear any values for the column -func (m h3AggregationMods) UnsetResolution() H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.Resolution = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m h3AggregationMods) RandomResolution(f *faker.Faker) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.Resolution = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m h3AggregationMods) Type(val enums.H3aggregationtype) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.Type = func() enums.H3aggregationtype { return val } - }) -} - -// Set the Column from the function -func (m h3AggregationMods) TypeFunc(f func() enums.H3aggregationtype) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.Type = f - }) -} - -// Clear any values for the column -func (m h3AggregationMods) UnsetType() H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.Type = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m h3AggregationMods) RandomType(f *faker.Faker) H3AggregationMod { - return H3AggregationModFunc(func(_ context.Context, o *H3AggregationTemplate) { - o.Type = func() enums.H3aggregationtype { - return random_enums_H3aggregationtype(f) - } - }) -} - -func (m h3AggregationMods) WithParentsCascading() H3AggregationMod { - return H3AggregationModFunc(func(ctx context.Context, o *H3AggregationTemplate) { - if isDone, _ := h3AggregationWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = h3AggregationWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m h3AggregationMods) WithOrganization(rel *OrganizationTemplate) H3AggregationMod { - return H3AggregationModFunc(func(ctx context.Context, o *H3AggregationTemplate) { - o.r.Organization = &h3AggregationROrganizationR{ - o: rel, - } - }) -} - -func (m h3AggregationMods) WithNewOrganization(mods ...OrganizationMod) H3AggregationMod { - return H3AggregationModFunc(func(ctx context.Context, o *H3AggregationTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m h3AggregationMods) WithExistingOrganization(em *models.Organization) H3AggregationMod { - return H3AggregationModFunc(func(ctx context.Context, o *H3AggregationTemplate) { - o.r.Organization = &h3AggregationROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m h3AggregationMods) WithoutOrganization() H3AggregationMod { - return H3AggregationModFunc(func(ctx context.Context, o *H3AggregationTemplate) { - o.r.Organization = nil - }) -} diff --git a/db/factory/lead.bob.go b/db/factory/lead.bob.go deleted file mode 100644 index 79877f9b..00000000 --- a/db/factory/lead.bob.go +++ /dev/null @@ -1,841 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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/jaswdr/faker/v2" -) - -type LeadMod interface { - Apply(context.Context, *LeadTemplate) -} - -type LeadModFunc func(context.Context, *LeadTemplate) - -func (f LeadModFunc) Apply(ctx context.Context, n *LeadTemplate) { - f(ctx, n) -} - -type LeadModSlice []LeadMod - -func (mods LeadModSlice) Apply(ctx context.Context, n *LeadTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// LeadTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type LeadTemplate struct { - Created func() time.Time - Creator func() int32 - ID func() int32 - OrganizationID func() int32 - SiteID func() null.Val[int32] - SiteVersion func() null.Val[int32] - Type func() enums.Leadtype - - r leadR - f *Factory - - alreadyPersisted bool -} - -type leadR struct { - ComplianceReportRequests []*leadRComplianceReportRequestsR - CreatorUser *leadRCreatorUserR - Organization *leadROrganizationR - Site *leadRSiteR -} - -type leadRComplianceReportRequestsR struct { - number int - o *ComplianceReportRequestTemplate -} -type leadRCreatorUserR struct { - o *UserTemplate -} -type leadROrganizationR struct { - o *OrganizationTemplate -} -type leadRSiteR struct { - o *SiteTemplate -} - -// Apply mods to the LeadTemplate -func (o *LeadTemplate) Apply(ctx context.Context, mods ...LeadMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.Lead -// according to the relationships in the template. Nothing is inserted into the db -func (t LeadTemplate) setModelRels(o *models.Lead) { - if t.r.ComplianceReportRequests != nil { - rel := models.ComplianceReportRequestSlice{} - for _, r := range t.r.ComplianceReportRequests { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.LeadID = null.From(o.ID) // h2 - rel.R.Lead = o - } - rel = append(rel, related...) - } - o.R.ComplianceReportRequests = rel - } - - if t.r.CreatorUser != nil { - rel := t.r.CreatorUser.o.Build() - rel.R.CreatorLeads = append(rel.R.CreatorLeads, o) - o.Creator = rel.ID // h2 - o.R.CreatorUser = rel - } - - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.Leads = append(rel.R.Leads, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } - - if t.r.Site != nil { - rel := t.r.Site.o.Build() - rel.R.Leads = append(rel.R.Leads, o) - o.SiteID = null.From(rel.ID) // h2 - o.SiteVersion = null.From(rel.Version) // h2 - o.R.Site = rel - } -} - -// BuildSetter returns an *models.LeadSetter -// this does nothing with the relationship templates -func (o LeadTemplate) BuildSetter() *models.LeadSetter { - m := &models.LeadSetter{} - - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omit.From(val) - } - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.SiteID != nil { - val := o.SiteID() - m.SiteID = omitnull.FromNull(val) - } - if o.SiteVersion != nil { - val := o.SiteVersion() - m.SiteVersion = omitnull.FromNull(val) - } - if o.Type != nil { - val := o.Type() - m.Type = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.LeadSetter -// this does nothing with the relationship templates -func (o LeadTemplate) BuildManySetter(number int) []*models.LeadSetter { - m := make([]*models.LeadSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.Lead -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use LeadTemplate.Create -func (o LeadTemplate) Build() *models.Lead { - m := &models.Lead{} - - if o.Created != nil { - m.Created = o.Created() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.ID != nil { - m.ID = o.ID() - } - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.SiteID != nil { - m.SiteID = o.SiteID() - } - if o.SiteVersion != nil { - m.SiteVersion = o.SiteVersion() - } - if o.Type != nil { - m.Type = o.Type() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.LeadSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use LeadTemplate.CreateMany -func (o LeadTemplate) BuildMany(number int) models.LeadSlice { - m := make(models.LeadSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableLead(m *models.LeadSetter) { - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.Creator.IsValue()) { - val := random_int32(nil) - m.Creator = omit.From(val) - } - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Type.IsValue()) { - val := random_enums_Leadtype(nil) - m.Type = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.Lead -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *LeadTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.Lead) error { - var err error - - isComplianceReportRequestsDone, _ := leadRelComplianceReportRequestsCtx.Value(ctx) - if !isComplianceReportRequestsDone && o.r.ComplianceReportRequests != nil { - ctx = leadRelComplianceReportRequestsCtx.WithValue(ctx, true) - for _, r := range o.r.ComplianceReportRequests { - if r.o.alreadyPersisted { - m.R.ComplianceReportRequests = append(m.R.ComplianceReportRequests, r.o.Build()) - } else { - rel0, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachComplianceReportRequests(ctx, exec, rel0...) - if err != nil { - return err - } - } - } - } - - isSiteDone, _ := leadRelSiteCtx.Value(ctx) - if !isSiteDone && o.r.Site != nil { - ctx = leadRelSiteCtx.WithValue(ctx, true) - if o.r.Site.o.alreadyPersisted { - m.R.Site = o.r.Site.o.Build() - } else { - var rel3 *models.Site - rel3, err = o.r.Site.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachSite(ctx, exec, rel3) - if err != nil { - return err - } - } - - } - - return err -} - -// Create builds a lead and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *LeadTemplate) Create(ctx context.Context, exec bob.Executor) (*models.Lead, error) { - var err error - opt := o.BuildSetter() - ensureCreatableLead(opt) - - if o.r.CreatorUser == nil { - LeadMods.WithNewCreatorUser().Apply(ctx, o) - } - - var rel1 *models.User - - if o.r.CreatorUser.o.alreadyPersisted { - rel1 = o.r.CreatorUser.o.Build() - } else { - rel1, err = o.r.CreatorUser.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.Creator = omit.From(rel1.ID) - - if o.r.Organization == nil { - LeadMods.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.Leads.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.CreatorUser = rel1 - m.R.Organization = rel2 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a lead and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *LeadTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.Lead { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a lead 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 *LeadTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.Lead { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple leads and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o LeadTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.LeadSlice, error) { - var err error - m := make(models.LeadSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple leads and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o LeadTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.LeadSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple leads 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 LeadTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.LeadSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// Lead has methods that act as mods for the LeadTemplate -var LeadMods leadMods - -type leadMods struct{} - -func (m leadMods) RandomizeAllColumns(f *faker.Faker) LeadMod { - return LeadModSlice{ - LeadMods.RandomCreated(f), - LeadMods.RandomCreator(f), - LeadMods.RandomID(f), - LeadMods.RandomOrganizationID(f), - LeadMods.RandomSiteID(f), - LeadMods.RandomSiteVersion(f), - LeadMods.RandomType(f), - } -} - -// Set the model columns to this value -func (m leadMods) Created(val time.Time) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m leadMods) CreatedFunc(f func() time.Time) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m leadMods) UnsetCreated() LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - 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 leadMods) RandomCreated(f *faker.Faker) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m leadMods) Creator(val int32) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.Creator = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m leadMods) CreatorFunc(f func() int32) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m leadMods) UnsetCreator() LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.Creator = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m leadMods) RandomCreator(f *faker.Faker) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.Creator = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m leadMods) ID(val int32) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m leadMods) IDFunc(f func() int32) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m leadMods) UnsetID() LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m leadMods) RandomID(f *faker.Faker) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m leadMods) OrganizationID(val int32) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m leadMods) OrganizationIDFunc(f func() int32) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m leadMods) UnsetOrganizationID() LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - 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 leadMods) RandomOrganizationID(f *faker.Faker) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m leadMods) SiteID(val null.Val[int32]) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.SiteID = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m leadMods) SiteIDFunc(f func() null.Val[int32]) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.SiteID = f - }) -} - -// Clear any values for the column -func (m leadMods) UnsetSiteID() LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.SiteID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m leadMods) RandomSiteID(f *faker.Faker) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.SiteID = 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 leadMods) RandomSiteIDNotNull(f *faker.Faker) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.SiteID = 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 leadMods) SiteVersion(val null.Val[int32]) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.SiteVersion = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m leadMods) SiteVersionFunc(f func() null.Val[int32]) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.SiteVersion = f - }) -} - -// Clear any values for the column -func (m leadMods) UnsetSiteVersion() LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.SiteVersion = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m leadMods) RandomSiteVersion(f *faker.Faker) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.SiteVersion = 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 leadMods) RandomSiteVersionNotNull(f *faker.Faker) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.SiteVersion = 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 leadMods) Type(val enums.Leadtype) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.Type = func() enums.Leadtype { return val } - }) -} - -// Set the Column from the function -func (m leadMods) TypeFunc(f func() enums.Leadtype) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.Type = f - }) -} - -// Clear any values for the column -func (m leadMods) UnsetType() LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - 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 leadMods) RandomType(f *faker.Faker) LeadMod { - return LeadModFunc(func(_ context.Context, o *LeadTemplate) { - o.Type = func() enums.Leadtype { - return random_enums_Leadtype(f) - } - }) -} - -func (m leadMods) WithParentsCascading() LeadMod { - return LeadModFunc(func(ctx context.Context, o *LeadTemplate) { - if isDone, _ := leadWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = leadWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewUserWithContext(ctx, UserMods.WithParentsCascading()) - m.WithCreatorUser(related).Apply(ctx, o) - } - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - { - - related := o.f.NewSiteWithContext(ctx, SiteMods.WithParentsCascading()) - m.WithSite(related).Apply(ctx, o) - } - }) -} - -func (m leadMods) WithCreatorUser(rel *UserTemplate) LeadMod { - return LeadModFunc(func(ctx context.Context, o *LeadTemplate) { - o.r.CreatorUser = &leadRCreatorUserR{ - o: rel, - } - }) -} - -func (m leadMods) WithNewCreatorUser(mods ...UserMod) LeadMod { - return LeadModFunc(func(ctx context.Context, o *LeadTemplate) { - related := o.f.NewUserWithContext(ctx, mods...) - - m.WithCreatorUser(related).Apply(ctx, o) - }) -} - -func (m leadMods) WithExistingCreatorUser(em *models.User) LeadMod { - return LeadModFunc(func(ctx context.Context, o *LeadTemplate) { - o.r.CreatorUser = &leadRCreatorUserR{ - o: o.f.FromExistingUser(em), - } - }) -} - -func (m leadMods) WithoutCreatorUser() LeadMod { - return LeadModFunc(func(ctx context.Context, o *LeadTemplate) { - o.r.CreatorUser = nil - }) -} - -func (m leadMods) WithOrganization(rel *OrganizationTemplate) LeadMod { - return LeadModFunc(func(ctx context.Context, o *LeadTemplate) { - o.r.Organization = &leadROrganizationR{ - o: rel, - } - }) -} - -func (m leadMods) WithNewOrganization(mods ...OrganizationMod) LeadMod { - return LeadModFunc(func(ctx context.Context, o *LeadTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m leadMods) WithExistingOrganization(em *models.Organization) LeadMod { - return LeadModFunc(func(ctx context.Context, o *LeadTemplate) { - o.r.Organization = &leadROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m leadMods) WithoutOrganization() LeadMod { - return LeadModFunc(func(ctx context.Context, o *LeadTemplate) { - o.r.Organization = nil - }) -} - -func (m leadMods) WithSite(rel *SiteTemplate) LeadMod { - return LeadModFunc(func(ctx context.Context, o *LeadTemplate) { - o.r.Site = &leadRSiteR{ - o: rel, - } - }) -} - -func (m leadMods) WithNewSite(mods ...SiteMod) LeadMod { - return LeadModFunc(func(ctx context.Context, o *LeadTemplate) { - related := o.f.NewSiteWithContext(ctx, mods...) - - m.WithSite(related).Apply(ctx, o) - }) -} - -func (m leadMods) WithExistingSite(em *models.Site) LeadMod { - return LeadModFunc(func(ctx context.Context, o *LeadTemplate) { - o.r.Site = &leadRSiteR{ - o: o.f.FromExistingSite(em), - } - }) -} - -func (m leadMods) WithoutSite() LeadMod { - return LeadModFunc(func(ctx context.Context, o *LeadTemplate) { - o.r.Site = nil - }) -} - -func (m leadMods) WithComplianceReportRequests(number int, related *ComplianceReportRequestTemplate) LeadMod { - return LeadModFunc(func(ctx context.Context, o *LeadTemplate) { - o.r.ComplianceReportRequests = []*leadRComplianceReportRequestsR{{ - number: number, - o: related, - }} - }) -} - -func (m leadMods) WithNewComplianceReportRequests(number int, mods ...ComplianceReportRequestMod) LeadMod { - return LeadModFunc(func(ctx context.Context, o *LeadTemplate) { - related := o.f.NewComplianceReportRequestWithContext(ctx, mods...) - m.WithComplianceReportRequests(number, related).Apply(ctx, o) - }) -} - -func (m leadMods) AddComplianceReportRequests(number int, related *ComplianceReportRequestTemplate) LeadMod { - return LeadModFunc(func(ctx context.Context, o *LeadTemplate) { - o.r.ComplianceReportRequests = append(o.r.ComplianceReportRequests, &leadRComplianceReportRequestsR{ - number: number, - o: related, - }) - }) -} - -func (m leadMods) AddNewComplianceReportRequests(number int, mods ...ComplianceReportRequestMod) LeadMod { - return LeadModFunc(func(ctx context.Context, o *LeadTemplate) { - related := o.f.NewComplianceReportRequestWithContext(ctx, mods...) - m.AddComplianceReportRequests(number, related).Apply(ctx, o) - }) -} - -func (m leadMods) AddExistingComplianceReportRequests(existingModels ...*models.ComplianceReportRequest) LeadMod { - return LeadModFunc(func(ctx context.Context, o *LeadTemplate) { - for _, em := range existingModels { - o.r.ComplianceReportRequests = append(o.r.ComplianceReportRequests, &leadRComplianceReportRequestsR{ - o: o.f.FromExistingComplianceReportRequest(em), - }) - } - }) -} - -func (m leadMods) WithoutComplianceReportRequests() LeadMod { - return LeadModFunc(func(ctx context.Context, o *LeadTemplate) { - o.r.ComplianceReportRequests = nil - }) -} diff --git a/db/factory/note_audio.bob.go b/db/factory/note_audio.bob.go deleted file mode 100644 index 5876c708..00000000 --- a/db/factory/note_audio.bob.go +++ /dev/null @@ -1,1082 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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" -) - -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 deleted file mode 100644 index b339b800..00000000 --- a/db/factory/note_audio_breadcrumb.bob.go +++ /dev/null @@ -1,549 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/omit" - "github.com/google/uuid" - "github.com/jaswdr/faker/v2" -) - -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 deleted file mode 100644 index 70983493..00000000 --- a/db/factory/note_audio_data.bob.go +++ /dev/null @@ -1,462 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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" -) - -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 deleted file mode 100644 index db3cecb7..00000000 --- a/db/factory/note_image.bob.go +++ /dev/null @@ -1,932 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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" -) - -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 deleted file mode 100644 index b51fe9f9..00000000 --- a/db/factory/note_image_breadcrumb.bob.go +++ /dev/null @@ -1,549 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/omit" - "github.com/google/uuid" - "github.com/jaswdr/faker/v2" -) - -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 deleted file mode 100644 index caf0b1e9..00000000 --- a/db/factory/note_image_data.bob.go +++ /dev/null @@ -1,462 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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" -) - -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 deleted file mode 100644 index 874649ec..00000000 --- a/db/factory/notification.bob.go +++ /dev/null @@ -1,607 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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/jaswdr/faker/v2" -) - -type NotificationMod interface { - Apply(context.Context, *NotificationTemplate) -} - -type NotificationModFunc func(context.Context, *NotificationTemplate) - -func (f NotificationModFunc) Apply(ctx context.Context, n *NotificationTemplate) { - f(ctx, n) -} - -type NotificationModSlice []NotificationMod - -func (mods NotificationModSlice) Apply(ctx context.Context, n *NotificationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// NotificationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type NotificationTemplate struct { - ID func() int32 - Created func() time.Time - Link func() string - Message func() string - Type func() enums.Notificationtype - UserID func() int32 - ResolvedAt func() null.Val[time.Time] - - r notificationR - f *Factory - - alreadyPersisted bool -} - -type notificationR struct { - UserUser *notificationRUserUserR -} - -type notificationRUserUserR struct { - o *UserTemplate -} - -// Apply mods to the NotificationTemplate -func (o *NotificationTemplate) Apply(ctx context.Context, mods ...NotificationMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.Notification -// according to the relationships in the template. Nothing is inserted into the db -func (t NotificationTemplate) setModelRels(o *models.Notification) { - if t.r.UserUser != nil { - rel := t.r.UserUser.o.Build() - rel.R.UserNotifications = append(rel.R.UserNotifications, o) - o.UserID = rel.ID // h2 - o.R.UserUser = rel - } -} - -// BuildSetter returns an *models.NotificationSetter -// this does nothing with the relationship templates -func (o NotificationTemplate) BuildSetter() *models.NotificationSetter { - m := &models.NotificationSetter{} - - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.Link != nil { - val := o.Link() - m.Link = omit.From(val) - } - if o.Message != nil { - val := o.Message() - m.Message = omit.From(val) - } - if o.Type != nil { - val := o.Type() - m.Type = omit.From(val) - } - if o.UserID != nil { - val := o.UserID() - m.UserID = omit.From(val) - } - if o.ResolvedAt != nil { - val := o.ResolvedAt() - m.ResolvedAt = omitnull.FromNull(val) - } - - return m -} - -// BuildManySetter returns an []*models.NotificationSetter -// this does nothing with the relationship templates -func (o NotificationTemplate) BuildManySetter(number int) []*models.NotificationSetter { - m := make([]*models.NotificationSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.Notification -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use NotificationTemplate.Create -func (o NotificationTemplate) Build() *models.Notification { - m := &models.Notification{} - - if o.ID != nil { - m.ID = o.ID() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.Link != nil { - m.Link = o.Link() - } - if o.Message != nil { - m.Message = o.Message() - } - if o.Type != nil { - m.Type = o.Type() - } - if o.UserID != nil { - m.UserID = o.UserID() - } - if o.ResolvedAt != nil { - m.ResolvedAt = o.ResolvedAt() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.NotificationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use NotificationTemplate.CreateMany -func (o NotificationTemplate) BuildMany(number int) models.NotificationSlice { - m := make(models.NotificationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableNotification(m *models.NotificationSetter) { - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.Link.IsValue()) { - val := random_string(nil) - m.Link = omit.From(val) - } - if !(m.Message.IsValue()) { - val := random_string(nil) - m.Message = omit.From(val) - } - if !(m.Type.IsValue()) { - val := random_enums_Notificationtype(nil) - m.Type = omit.From(val) - } - if !(m.UserID.IsValue()) { - val := random_int32(nil) - m.UserID = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.Notification -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *NotificationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.Notification) error { - var err error - - return err -} - -// Create builds a notification and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *NotificationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.Notification, error) { - var err error - opt := o.BuildSetter() - ensureCreatableNotification(opt) - - if o.r.UserUser == nil { - NotificationMods.WithNewUserUser().Apply(ctx, o) - } - - var rel0 *models.User - - if o.r.UserUser.o.alreadyPersisted { - rel0 = o.r.UserUser.o.Build() - } else { - rel0, err = o.r.UserUser.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.UserID = omit.From(rel0.ID) - - m, err := models.Notifications.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.UserUser = rel0 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a notification and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *NotificationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.Notification { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a notification 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 *NotificationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.Notification { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple notifications and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o NotificationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.NotificationSlice, error) { - var err error - m := make(models.NotificationSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple notifications and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o NotificationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.NotificationSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple notifications 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 NotificationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.NotificationSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// Notification has methods that act as mods for the NotificationTemplate -var NotificationMods notificationMods - -type notificationMods struct{} - -func (m notificationMods) RandomizeAllColumns(f *faker.Faker) NotificationMod { - return NotificationModSlice{ - NotificationMods.RandomID(f), - NotificationMods.RandomCreated(f), - NotificationMods.RandomLink(f), - NotificationMods.RandomMessage(f), - NotificationMods.RandomType(f), - NotificationMods.RandomUserID(f), - NotificationMods.RandomResolvedAt(f), - } -} - -// Set the model columns to this value -func (m notificationMods) ID(val int32) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m notificationMods) IDFunc(f func() int32) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m notificationMods) UnsetID() NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m notificationMods) RandomID(f *faker.Faker) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m notificationMods) Created(val time.Time) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m notificationMods) CreatedFunc(f func() time.Time) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m notificationMods) UnsetCreated() NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - 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 notificationMods) RandomCreated(f *faker.Faker) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m notificationMods) Link(val string) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.Link = func() string { return val } - }) -} - -// Set the Column from the function -func (m notificationMods) LinkFunc(f func() string) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.Link = f - }) -} - -// Clear any values for the column -func (m notificationMods) UnsetLink() NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.Link = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m notificationMods) RandomLink(f *faker.Faker) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.Link = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m notificationMods) Message(val string) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.Message = func() string { return val } - }) -} - -// Set the Column from the function -func (m notificationMods) MessageFunc(f func() string) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.Message = f - }) -} - -// Clear any values for the column -func (m notificationMods) UnsetMessage() NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.Message = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m notificationMods) RandomMessage(f *faker.Faker) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.Message = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m notificationMods) Type(val enums.Notificationtype) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.Type = func() enums.Notificationtype { return val } - }) -} - -// Set the Column from the function -func (m notificationMods) TypeFunc(f func() enums.Notificationtype) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.Type = f - }) -} - -// Clear any values for the column -func (m notificationMods) UnsetType() NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - 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 notificationMods) RandomType(f *faker.Faker) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.Type = func() enums.Notificationtype { - return random_enums_Notificationtype(f) - } - }) -} - -// Set the model columns to this value -func (m notificationMods) UserID(val int32) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.UserID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m notificationMods) UserIDFunc(f func() int32) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.UserID = f - }) -} - -// Clear any values for the column -func (m notificationMods) UnsetUserID() NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.UserID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m notificationMods) RandomUserID(f *faker.Faker) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.UserID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m notificationMods) ResolvedAt(val null.Val[time.Time]) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.ResolvedAt = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m notificationMods) ResolvedAtFunc(f func() null.Val[time.Time]) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.ResolvedAt = f - }) -} - -// Clear any values for the column -func (m notificationMods) UnsetResolvedAt() NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.ResolvedAt = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m notificationMods) RandomResolvedAt(f *faker.Faker) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.ResolvedAt = 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 notificationMods) RandomResolvedAtNotNull(f *faker.Faker) NotificationMod { - return NotificationModFunc(func(_ context.Context, o *NotificationTemplate) { - o.ResolvedAt = func() null.Val[time.Time] { - if f == nil { - f = &defaultFaker - } - - val := random_time_Time(f) - return null.From(val) - } - }) -} - -func (m notificationMods) WithParentsCascading() NotificationMod { - return NotificationModFunc(func(ctx context.Context, o *NotificationTemplate) { - if isDone, _ := notificationWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = notificationWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewUserWithContext(ctx, UserMods.WithParentsCascading()) - m.WithUserUser(related).Apply(ctx, o) - } - }) -} - -func (m notificationMods) WithUserUser(rel *UserTemplate) NotificationMod { - return NotificationModFunc(func(ctx context.Context, o *NotificationTemplate) { - o.r.UserUser = ¬ificationRUserUserR{ - o: rel, - } - }) -} - -func (m notificationMods) WithNewUserUser(mods ...UserMod) NotificationMod { - return NotificationModFunc(func(ctx context.Context, o *NotificationTemplate) { - related := o.f.NewUserWithContext(ctx, mods...) - - m.WithUserUser(related).Apply(ctx, o) - }) -} - -func (m notificationMods) WithExistingUserUser(em *models.User) NotificationMod { - return NotificationModFunc(func(ctx context.Context, o *NotificationTemplate) { - o.r.UserUser = ¬ificationRUserUserR{ - o: o.f.FromExistingUser(em), - } - }) -} - -func (m notificationMods) WithoutUserUser() NotificationMod { - return NotificationModFunc(func(ctx context.Context, o *NotificationTemplate) { - o.r.UserUser = nil - }) -} diff --git a/db/factory/organization.bob.go b/db/factory/organization.bob.go deleted file mode 100644 index b18da577..00000000 --- a/db/factory/organization.bob.go +++ /dev/null @@ -1,5950 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - 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/shopspring/decimal" -) - -type OrganizationMod interface { - Apply(context.Context, *OrganizationTemplate) -} - -type OrganizationModFunc func(context.Context, *OrganizationTemplate) - -func (f OrganizationModFunc) Apply(ctx context.Context, n *OrganizationTemplate) { - f(ctx, n) -} - -type OrganizationModSlice []OrganizationMod - -func (mods OrganizationModSlice) Apply(ctx context.Context, n *OrganizationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// OrganizationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type OrganizationTemplate struct { - ID func() int32 - Name func() string - ImportDistrictGid func() null.Val[int32] - Website func() null.Val[string] - LogoUUID func() null.Val[uuid.UUID] - Slug func() null.Val[string] - GeneralManagerName func() null.Val[string] - MailingAddressCity func() null.Val[string] - MailingAddressPostalCode func() null.Val[string] - MailingAddressStreet func() null.Val[string] - OfficeAddressCity func() null.Val[string] - OfficeAddressPostalCode func() null.Val[string] - OfficeAddressStreet func() null.Val[string] - ServiceAreaGeometry func() null.Val[string] - ServiceAreaSquareMeters func() null.Val[decimal.Decimal] - ServiceAreaCentroid func() null.Val[string] - ServiceAreaExtent func() null.Val[string] - OfficeFax func() null.Val[string] - OfficePhone func() null.Val[string] - ServiceAreaXmin func() null.Val[float64] - ServiceAreaYmin func() null.Val[float64] - ServiceAreaXmax func() null.Val[float64] - ServiceAreaYmax func() null.Val[float64] - ServiceAreaCentroidGeojson func() null.Val[string] - ServiceAreaCentroidX func() null.Val[float64] - ServiceAreaCentroidY func() null.Val[float64] - MailingAddressCountry func() null.Val[string] - MailingAddressState func() null.Val[string] - OfficeAddressCountry func() null.Val[string] - OfficeAddressState func() null.Val[string] - ArcgisAccountID func() null.Val[string] - FieldseekerServiceFeatureItemID func() null.Val[string] - - r organizationR - f *Factory - - alreadyPersisted bool -} - -type organizationR struct { - Accounts []*organizationRAccountsR - AddressMappings []*organizationRAddressMappingsR - ParcelMappings []*organizationRParcelMappingsR - EmailContacts []*organizationREmailContactsR - Phones []*organizationRPhonesR - Containerrelates []*organizationRContainerrelatesR - Fieldscoutinglogs []*organizationRFieldscoutinglogsR - Habitatrelates []*organizationRHabitatrelatesR - Inspectionsamples []*organizationRInspectionsamplesR - Inspectionsampledetails []*organizationRInspectionsampledetailsR - Linelocations []*organizationRLinelocationsR - Locationtrackings []*organizationRLocationtrackingsR - Mosquitoinspections []*organizationRMosquitoinspectionsR - Pointlocations []*organizationRPointlocationsR - Polygonlocations []*organizationRPolygonlocationsR - FieldseekerPool []*organizationRFieldseekerPoolR - 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 - Files []*organizationRFilesR - H3Aggregations []*organizationRH3AggregationsR - Leads []*organizationRLeadsR - NoteAudios []*organizationRNoteAudiosR - NoteImages []*organizationRNoteImagesR - ArcgisAccountAccount *organizationRArcgisAccountAccountR - FieldseekerServiceFeatureItemServiceFeature *organizationRFieldseekerServiceFeatureItemServiceFeatureR - Nuisances []*organizationRNuisancesR - PublicreportPool []*organizationRPublicreportPoolR - Quicks []*organizationRQuicksR - Signals []*organizationRSignalsR - User []*organizationRUserR -} - -type organizationRAccountsR struct { - number int - o *ArcgisAccountTemplate -} -type organizationRAddressMappingsR struct { - number int - o *ArcgisAddressMappingTemplate -} -type organizationRParcelMappingsR struct { - number int - o *ArcgisParcelMappingTemplate -} -type organizationREmailContactsR struct { - number int - o *CommsEmailContactTemplate -} -type organizationRPhonesR struct { - number int - o *CommsPhoneTemplate -} -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 organizationRFieldseekerPoolR 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 organizationRFilesR struct { - number int - o *FileuploadFileTemplate -} -type organizationRH3AggregationsR struct { - number int - o *H3AggregationTemplate -} -type organizationRLeadsR struct { - number int - o *LeadTemplate -} -type organizationRNoteAudiosR struct { - number int - o *NoteAudioTemplate -} -type organizationRNoteImagesR struct { - number int - o *NoteImageTemplate -} -type organizationRArcgisAccountAccountR struct { - o *ArcgisAccountTemplate -} -type organizationRFieldseekerServiceFeatureItemServiceFeatureR struct { - o *ArcgisServiceFeatureTemplate -} -type organizationRNuisancesR struct { - number int - o *PublicreportNuisanceTemplate -} -type organizationRPublicreportPoolR struct { - number int - o *PublicreportPoolTemplate -} -type organizationRQuicksR struct { - number int - o *PublicreportQuickTemplate -} -type organizationRSignalsR struct { - number int - o *SignalTemplate -} -type organizationRUserR struct { - number int - o *UserTemplate -} - -// Apply mods to the OrganizationTemplate -func (o *OrganizationTemplate) Apply(ctx context.Context, mods ...OrganizationMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// 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.Accounts != nil { - rel := models.ArcgisAccountSlice{} - for _, r := range t.r.Accounts { - 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.Accounts = rel - } - - if t.r.AddressMappings != nil { - rel := models.ArcgisAddressMappingSlice{} - for _, r := range t.r.AddressMappings { - 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.AddressMappings = rel - } - - if t.r.ParcelMappings != nil { - rel := models.ArcgisParcelMappingSlice{} - for _, r := range t.r.ParcelMappings { - 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.ParcelMappings = rel - } - - if t.r.EmailContacts != nil { - rel := models.CommsEmailContactSlice{} - for _, r := range t.r.EmailContacts { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.R.Organizations = append(rel.R.Organizations, o) - } - rel = append(rel, related...) - } - o.R.EmailContacts = rel - } - - if t.r.Phones != nil { - rel := models.CommsPhoneSlice{} - for _, r := range t.r.Phones { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.R.Organizations = append(rel.R.Organizations, o) - } - rel = append(rel, related...) - } - o.R.Phones = rel - } - - 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.FieldseekerPool != nil { - rel := models.FieldseekerPoolSlice{} - for _, r := range t.r.FieldseekerPool { - 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.FieldseekerPool = 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 { - 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.FieldseekerSyncs = rel - } - - if t.r.Files != nil { - rel := models.FileuploadFileSlice{} - for _, r := range t.r.Files { - 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.Files = rel - } - - if t.r.H3Aggregations != nil { - rel := models.H3AggregationSlice{} - for _, r := range t.r.H3Aggregations { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.OrganizationID = o.ID // h2 - rel.R.Organization = o - } - rel = append(rel, related...) - } - o.R.H3Aggregations = rel - } - - if t.r.Leads != nil { - rel := models.LeadSlice{} - for _, r := range t.r.Leads { - 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.Leads = rel - } - - 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 - rel.R.Organization = o - } - rel = append(rel, related...) - } - o.R.NoteAudios = rel - } - - 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 - rel.R.Organization = o - } - rel = append(rel, related...) - } - o.R.NoteImages = rel - } - - if t.r.ArcgisAccountAccount != nil { - rel := t.r.ArcgisAccountAccount.o.Build() - rel.R.ArcgisAccountOrganizations = append(rel.R.ArcgisAccountOrganizations, o) - o.ArcgisAccountID = null.From(rel.ID) // h2 - o.R.ArcgisAccountAccount = rel - } - - if t.r.FieldseekerServiceFeatureItemServiceFeature != nil { - rel := t.r.FieldseekerServiceFeatureItemServiceFeature.o.Build() - rel.R.FieldseekerServiceFeatureItemOrganizations = append(rel.R.FieldseekerServiceFeatureItemOrganizations, o) - o.FieldseekerServiceFeatureItemID = null.From(rel.ItemID) // h2 - o.R.FieldseekerServiceFeatureItemServiceFeature = rel - } - - if t.r.Nuisances != nil { - rel := models.PublicreportNuisanceSlice{} - for _, r := range t.r.Nuisances { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 - rel.R.Organization = o - } - rel = append(rel, related...) - } - o.R.Nuisances = rel - } - - if t.r.PublicreportPool != nil { - rel := models.PublicreportPoolSlice{} - for _, r := range t.r.PublicreportPool { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 - rel.R.Organization = o - } - rel = append(rel, related...) - } - o.R.PublicreportPool = rel - } - - if t.r.Quicks != nil { - rel := models.PublicreportQuickSlice{} - for _, r := range t.r.Quicks { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.OrganizationID = null.From(o.ID) // h2 - rel.R.Organization = o - } - rel = append(rel, related...) - } - o.R.Quicks = rel - } - - if t.r.Signals != nil { - rel := models.SignalSlice{} - for _, r := range t.r.Signals { - 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.Signals = rel - } - - if t.r.User != nil { - rel := models.UserSlice{} - for _, r := range t.r.User { - 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.User = rel - } -} - -// BuildSetter returns an *models.OrganizationSetter -// this does nothing with the relationship templates -func (o OrganizationTemplate) BuildSetter() *models.OrganizationSetter { - m := &models.OrganizationSetter{} - - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omit.From(val) - } - if o.ImportDistrictGid != nil { - val := o.ImportDistrictGid() - m.ImportDistrictGid = omitnull.FromNull(val) - } - if o.Website != nil { - val := o.Website() - m.Website = omitnull.FromNull(val) - } - if o.LogoUUID != nil { - val := o.LogoUUID() - m.LogoUUID = omitnull.FromNull(val) - } - if o.Slug != nil { - val := o.Slug() - m.Slug = omitnull.FromNull(val) - } - if o.GeneralManagerName != nil { - val := o.GeneralManagerName() - m.GeneralManagerName = omitnull.FromNull(val) - } - if o.MailingAddressCity != nil { - val := o.MailingAddressCity() - m.MailingAddressCity = omitnull.FromNull(val) - } - if o.MailingAddressPostalCode != nil { - val := o.MailingAddressPostalCode() - m.MailingAddressPostalCode = omitnull.FromNull(val) - } - if o.MailingAddressStreet != nil { - val := o.MailingAddressStreet() - m.MailingAddressStreet = omitnull.FromNull(val) - } - if o.OfficeAddressCity != nil { - val := o.OfficeAddressCity() - m.OfficeAddressCity = omitnull.FromNull(val) - } - if o.OfficeAddressPostalCode != nil { - val := o.OfficeAddressPostalCode() - m.OfficeAddressPostalCode = omitnull.FromNull(val) - } - if o.OfficeAddressStreet != nil { - val := o.OfficeAddressStreet() - m.OfficeAddressStreet = omitnull.FromNull(val) - } - if o.ServiceAreaGeometry != nil { - val := o.ServiceAreaGeometry() - m.ServiceAreaGeometry = omitnull.FromNull(val) - } - if o.OfficeFax != nil { - val := o.OfficeFax() - m.OfficeFax = omitnull.FromNull(val) - } - if o.OfficePhone != nil { - val := o.OfficePhone() - m.OfficePhone = omitnull.FromNull(val) - } - if o.MailingAddressCountry != nil { - val := o.MailingAddressCountry() - m.MailingAddressCountry = omitnull.FromNull(val) - } - if o.MailingAddressState != nil { - val := o.MailingAddressState() - m.MailingAddressState = omitnull.FromNull(val) - } - if o.OfficeAddressCountry != nil { - val := o.OfficeAddressCountry() - m.OfficeAddressCountry = omitnull.FromNull(val) - } - if o.OfficeAddressState != nil { - val := o.OfficeAddressState() - m.OfficeAddressState = omitnull.FromNull(val) - } - if o.ArcgisAccountID != nil { - val := o.ArcgisAccountID() - m.ArcgisAccountID = omitnull.FromNull(val) - } - if o.FieldseekerServiceFeatureItemID != nil { - val := o.FieldseekerServiceFeatureItemID() - m.FieldseekerServiceFeatureItemID = omitnull.FromNull(val) - } - - return m -} - -// BuildManySetter returns an []*models.OrganizationSetter -// this does nothing with the relationship templates -func (o OrganizationTemplate) BuildManySetter(number int) []*models.OrganizationSetter { - m := make([]*models.OrganizationSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.Organization -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use OrganizationTemplate.Create -func (o OrganizationTemplate) Build() *models.Organization { - m := &models.Organization{} - - if o.ID != nil { - m.ID = o.ID() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.ImportDistrictGid != nil { - m.ImportDistrictGid = o.ImportDistrictGid() - } - if o.Website != nil { - m.Website = o.Website() - } - if o.LogoUUID != nil { - m.LogoUUID = o.LogoUUID() - } - if o.Slug != nil { - m.Slug = o.Slug() - } - if o.GeneralManagerName != nil { - m.GeneralManagerName = o.GeneralManagerName() - } - if o.MailingAddressCity != nil { - m.MailingAddressCity = o.MailingAddressCity() - } - if o.MailingAddressPostalCode != nil { - m.MailingAddressPostalCode = o.MailingAddressPostalCode() - } - if o.MailingAddressStreet != nil { - m.MailingAddressStreet = o.MailingAddressStreet() - } - if o.OfficeAddressCity != nil { - m.OfficeAddressCity = o.OfficeAddressCity() - } - if o.OfficeAddressPostalCode != nil { - m.OfficeAddressPostalCode = o.OfficeAddressPostalCode() - } - if o.OfficeAddressStreet != nil { - m.OfficeAddressStreet = o.OfficeAddressStreet() - } - if o.ServiceAreaGeometry != nil { - m.ServiceAreaGeometry = o.ServiceAreaGeometry() - } - if o.ServiceAreaSquareMeters != nil { - m.ServiceAreaSquareMeters = o.ServiceAreaSquareMeters() - } - if o.ServiceAreaCentroid != nil { - m.ServiceAreaCentroid = o.ServiceAreaCentroid() - } - if o.ServiceAreaExtent != nil { - m.ServiceAreaExtent = o.ServiceAreaExtent() - } - if o.OfficeFax != nil { - m.OfficeFax = o.OfficeFax() - } - if o.OfficePhone != nil { - m.OfficePhone = o.OfficePhone() - } - if o.ServiceAreaXmin != nil { - m.ServiceAreaXmin = o.ServiceAreaXmin() - } - if o.ServiceAreaYmin != nil { - m.ServiceAreaYmin = o.ServiceAreaYmin() - } - if o.ServiceAreaXmax != nil { - m.ServiceAreaXmax = o.ServiceAreaXmax() - } - if o.ServiceAreaYmax != nil { - m.ServiceAreaYmax = o.ServiceAreaYmax() - } - if o.ServiceAreaCentroidGeojson != nil { - m.ServiceAreaCentroidGeojson = o.ServiceAreaCentroidGeojson() - } - if o.ServiceAreaCentroidX != nil { - m.ServiceAreaCentroidX = o.ServiceAreaCentroidX() - } - if o.ServiceAreaCentroidY != nil { - m.ServiceAreaCentroidY = o.ServiceAreaCentroidY() - } - if o.MailingAddressCountry != nil { - m.MailingAddressCountry = o.MailingAddressCountry() - } - if o.MailingAddressState != nil { - m.MailingAddressState = o.MailingAddressState() - } - if o.OfficeAddressCountry != nil { - m.OfficeAddressCountry = o.OfficeAddressCountry() - } - if o.OfficeAddressState != nil { - m.OfficeAddressState = o.OfficeAddressState() - } - if o.ArcgisAccountID != nil { - m.ArcgisAccountID = o.ArcgisAccountID() - } - if o.FieldseekerServiceFeatureItemID != nil { - m.FieldseekerServiceFeatureItemID = o.FieldseekerServiceFeatureItemID() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.OrganizationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use OrganizationTemplate.CreateMany -func (o OrganizationTemplate) BuildMany(number int) models.OrganizationSlice { - m := make(models.OrganizationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableOrganization(m *models.OrganizationSetter) { - if !(m.Name.IsValue()) { - val := random_string(nil) - m.Name = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.Organization -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.Organization) error { - var err error - - isAccountsDone, _ := organizationRelAccountsCtx.Value(ctx) - if !isAccountsDone && o.r.Accounts != nil { - ctx = organizationRelAccountsCtx.WithValue(ctx, true) - for _, r := range o.r.Accounts { - if r.o.alreadyPersisted { - m.R.Accounts = append(m.R.Accounts, r.o.Build()) - } else { - rel0, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachAccounts(ctx, exec, rel0...) - if err != nil { - return err - } - } - } - } - - isAddressMappingsDone, _ := organizationRelAddressMappingsCtx.Value(ctx) - if !isAddressMappingsDone && o.r.AddressMappings != nil { - ctx = organizationRelAddressMappingsCtx.WithValue(ctx, true) - for _, r := range o.r.AddressMappings { - if r.o.alreadyPersisted { - m.R.AddressMappings = append(m.R.AddressMappings, r.o.Build()) - } else { - rel1, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachAddressMappings(ctx, exec, rel1...) - if err != nil { - return err - } - } - } - } - - isParcelMappingsDone, _ := organizationRelParcelMappingsCtx.Value(ctx) - if !isParcelMappingsDone && o.r.ParcelMappings != nil { - ctx = organizationRelParcelMappingsCtx.WithValue(ctx, true) - for _, r := range o.r.ParcelMappings { - if r.o.alreadyPersisted { - m.R.ParcelMappings = append(m.R.ParcelMappings, r.o.Build()) - } else { - rel2, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachParcelMappings(ctx, exec, rel2...) - if err != nil { - return err - } - } - } - } - - isEmailContactsDone, _ := organizationRelEmailContactsCtx.Value(ctx) - if !isEmailContactsDone && o.r.EmailContacts != nil { - ctx = organizationRelEmailContactsCtx.WithValue(ctx, true) - for _, r := range o.r.EmailContacts { - if r.o.alreadyPersisted { - m.R.EmailContacts = append(m.R.EmailContacts, r.o.Build()) - } else { - rel3, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachEmailContacts(ctx, exec, rel3...) - if err != nil { - return err - } - } - } - } - - isPhonesDone, _ := organizationRelPhonesCtx.Value(ctx) - if !isPhonesDone && o.r.Phones != nil { - ctx = organizationRelPhonesCtx.WithValue(ctx, true) - for _, r := range o.r.Phones { - if r.o.alreadyPersisted { - m.R.Phones = append(m.R.Phones, r.o.Build()) - } else { - rel4, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachPhones(ctx, exec, rel4...) - if err != nil { - return err - } - } - } - } - - 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 { - rel5, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachContainerrelates(ctx, exec, rel5...) - 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 { - rel6, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFieldscoutinglogs(ctx, exec, rel6...) - 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 { - rel7, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachHabitatrelates(ctx, exec, rel7...) - 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 { - rel8, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachInspectionsamples(ctx, exec, rel8...) - 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 { - rel9, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachInspectionsampledetails(ctx, exec, rel9...) - 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 { - rel10, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachLinelocations(ctx, exec, rel10...) - 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 { - rel11, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachLocationtrackings(ctx, exec, rel11...) - 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 { - rel12, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachMosquitoinspections(ctx, exec, rel12...) - 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 { - rel13, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachPointlocations(ctx, exec, rel13...) - 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 { - rel14, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachPolygonlocations(ctx, exec, rel14...) - if err != nil { - return err - } - } - } - } - - isFieldseekerPoolDone, _ := organizationRelFieldseekerPoolCtx.Value(ctx) - if !isFieldseekerPoolDone && o.r.FieldseekerPool != nil { - ctx = organizationRelFieldseekerPoolCtx.WithValue(ctx, true) - for _, r := range o.r.FieldseekerPool { - if r.o.alreadyPersisted { - m.R.FieldseekerPool = append(m.R.FieldseekerPool, r.o.Build()) - } else { - rel15, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFieldseekerPool(ctx, exec, rel15...) - 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 { - rel16, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachPooldetails(ctx, exec, rel16...) - 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 { - rel17, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachProposedtreatmentareas(ctx, exec, rel17...) - 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 { - rel18, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachQamosquitoinspections(ctx, exec, rel18...) - 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 { - rel19, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachRodentlocations(ctx, exec, rel19...) - 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 { - rel20, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachSamplecollections(ctx, exec, rel20...) - 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 { - rel21, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachSamplelocations(ctx, exec, rel21...) - 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 { - rel22, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachServicerequests(ctx, exec, rel22...) - 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 { - rel23, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachSpeciesabundances(ctx, exec, rel23...) - 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 { - rel24, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachStormdrains(ctx, exec, rel24...) - 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 { - rel25, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachTimecards(ctx, exec, rel25...) - 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 { - rel26, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachTrapdata(ctx, exec, rel26...) - 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 { - rel27, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachTraplocations(ctx, exec, rel27...) - 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 { - rel28, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachTreatments(ctx, exec, rel28...) - 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 { - rel29, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachTreatmentareas(ctx, exec, rel29...) - 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 { - rel30, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachZones(ctx, exec, rel30...) - 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 { - rel31, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachZones2s(ctx, exec, rel31...) - 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 { - rel32, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFieldseekerSyncs(ctx, exec, rel32...) - if err != nil { - return err - } - } - } - } - - isFilesDone, _ := organizationRelFilesCtx.Value(ctx) - if !isFilesDone && o.r.Files != nil { - ctx = organizationRelFilesCtx.WithValue(ctx, true) - for _, r := range o.r.Files { - if r.o.alreadyPersisted { - m.R.Files = append(m.R.Files, r.o.Build()) - } else { - rel33, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFiles(ctx, exec, rel33...) - if err != nil { - return err - } - } - } - } - - isH3AggregationsDone, _ := organizationRelH3AggregationsCtx.Value(ctx) - if !isH3AggregationsDone && o.r.H3Aggregations != nil { - ctx = organizationRelH3AggregationsCtx.WithValue(ctx, true) - for _, r := range o.r.H3Aggregations { - if r.o.alreadyPersisted { - m.R.H3Aggregations = append(m.R.H3Aggregations, r.o.Build()) - } else { - rel34, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachH3Aggregations(ctx, exec, rel34...) - if err != nil { - return err - } - } - } - } - - isLeadsDone, _ := organizationRelLeadsCtx.Value(ctx) - if !isLeadsDone && o.r.Leads != nil { - ctx = organizationRelLeadsCtx.WithValue(ctx, true) - for _, r := range o.r.Leads { - if r.o.alreadyPersisted { - m.R.Leads = append(m.R.Leads, r.o.Build()) - } else { - rel35, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachLeads(ctx, exec, rel35...) - if err != nil { - return err - } - } - } - } - - 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.NoteAudios = append(m.R.NoteAudios, r.o.Build()) - } else { - rel36, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachNoteAudios(ctx, exec, rel36...) - if err != nil { - return err - } - } - } - } - - 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.NoteImages = append(m.R.NoteImages, r.o.Build()) - } else { - rel37, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachNoteImages(ctx, exec, rel37...) - if err != nil { - return err - } - } - } - } - - isArcgisAccountAccountDone, _ := organizationRelArcgisAccountAccountCtx.Value(ctx) - if !isArcgisAccountAccountDone && o.r.ArcgisAccountAccount != nil { - ctx = organizationRelArcgisAccountAccountCtx.WithValue(ctx, true) - if o.r.ArcgisAccountAccount.o.alreadyPersisted { - m.R.ArcgisAccountAccount = o.r.ArcgisAccountAccount.o.Build() - } else { - var rel38 *models.ArcgisAccount - rel38, err = o.r.ArcgisAccountAccount.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachArcgisAccountAccount(ctx, exec, rel38) - if err != nil { - return err - } - } - - } - - isFieldseekerServiceFeatureItemServiceFeatureDone, _ := organizationRelFieldseekerServiceFeatureItemServiceFeatureCtx.Value(ctx) - if !isFieldseekerServiceFeatureItemServiceFeatureDone && o.r.FieldseekerServiceFeatureItemServiceFeature != nil { - ctx = organizationRelFieldseekerServiceFeatureItemServiceFeatureCtx.WithValue(ctx, true) - if o.r.FieldseekerServiceFeatureItemServiceFeature.o.alreadyPersisted { - m.R.FieldseekerServiceFeatureItemServiceFeature = o.r.FieldseekerServiceFeatureItemServiceFeature.o.Build() - } else { - var rel39 *models.ArcgisServiceFeature - rel39, err = o.r.FieldseekerServiceFeatureItemServiceFeature.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachFieldseekerServiceFeatureItemServiceFeature(ctx, exec, rel39) - if err != nil { - return err - } - } - - } - - isNuisancesDone, _ := organizationRelNuisancesCtx.Value(ctx) - if !isNuisancesDone && o.r.Nuisances != nil { - ctx = organizationRelNuisancesCtx.WithValue(ctx, true) - for _, r := range o.r.Nuisances { - if r.o.alreadyPersisted { - m.R.Nuisances = append(m.R.Nuisances, r.o.Build()) - } else { - rel40, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachNuisances(ctx, exec, rel40...) - if err != nil { - return err - } - } - } - } - - isPublicreportPoolDone, _ := organizationRelPublicreportPoolCtx.Value(ctx) - if !isPublicreportPoolDone && o.r.PublicreportPool != nil { - ctx = organizationRelPublicreportPoolCtx.WithValue(ctx, true) - for _, r := range o.r.PublicreportPool { - if r.o.alreadyPersisted { - m.R.PublicreportPool = append(m.R.PublicreportPool, r.o.Build()) - } else { - rel41, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachPublicreportPool(ctx, exec, rel41...) - if err != nil { - return err - } - } - } - } - - isQuicksDone, _ := organizationRelQuicksCtx.Value(ctx) - if !isQuicksDone && o.r.Quicks != nil { - ctx = organizationRelQuicksCtx.WithValue(ctx, true) - for _, r := range o.r.Quicks { - if r.o.alreadyPersisted { - m.R.Quicks = append(m.R.Quicks, r.o.Build()) - } else { - rel42, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachQuicks(ctx, exec, rel42...) - if err != nil { - return err - } - } - } - } - - isSignalsDone, _ := organizationRelSignalsCtx.Value(ctx) - if !isSignalsDone && o.r.Signals != nil { - ctx = organizationRelSignalsCtx.WithValue(ctx, true) - for _, r := range o.r.Signals { - if r.o.alreadyPersisted { - m.R.Signals = append(m.R.Signals, r.o.Build()) - } else { - rel43, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachSignals(ctx, exec, rel43...) - if err != nil { - return err - } - } - } - } - - isUserDone, _ := organizationRelUserCtx.Value(ctx) - if !isUserDone && o.r.User != nil { - ctx = organizationRelUserCtx.WithValue(ctx, true) - for _, r := range o.r.User { - if r.o.alreadyPersisted { - m.R.User = append(m.R.User, r.o.Build()) - } else { - rel44, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachUser(ctx, exec, rel44...) - if err != nil { - return err - } - } - } - } - - return err -} - -// Create builds a organization and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *OrganizationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.Organization, error) { - var err error - opt := o.BuildSetter() - ensureCreatableOrganization(opt) - - m, err := models.Organizations.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a organization and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *OrganizationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.Organization { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a organization 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 *OrganizationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.Organization { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple organizations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o OrganizationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.OrganizationSlice, error) { - var err error - m := make(models.OrganizationSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple organizations and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o OrganizationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.OrganizationSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple organizations 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 OrganizationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.OrganizationSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// Organization has methods that act as mods for the OrganizationTemplate -var OrganizationMods organizationMods - -type organizationMods struct{} - -func (m organizationMods) RandomizeAllColumns(f *faker.Faker) OrganizationMod { - return OrganizationModSlice{ - OrganizationMods.RandomID(f), - OrganizationMods.RandomName(f), - OrganizationMods.RandomImportDistrictGid(f), - OrganizationMods.RandomWebsite(f), - OrganizationMods.RandomLogoUUID(f), - OrganizationMods.RandomSlug(f), - OrganizationMods.RandomGeneralManagerName(f), - OrganizationMods.RandomMailingAddressCity(f), - OrganizationMods.RandomMailingAddressPostalCode(f), - OrganizationMods.RandomMailingAddressStreet(f), - OrganizationMods.RandomOfficeAddressCity(f), - OrganizationMods.RandomOfficeAddressPostalCode(f), - OrganizationMods.RandomOfficeAddressStreet(f), - OrganizationMods.RandomServiceAreaGeometry(f), - OrganizationMods.RandomServiceAreaSquareMeters(f), - OrganizationMods.RandomServiceAreaCentroid(f), - OrganizationMods.RandomServiceAreaExtent(f), - OrganizationMods.RandomOfficeFax(f), - OrganizationMods.RandomOfficePhone(f), - OrganizationMods.RandomServiceAreaXmin(f), - OrganizationMods.RandomServiceAreaYmin(f), - OrganizationMods.RandomServiceAreaXmax(f), - OrganizationMods.RandomServiceAreaYmax(f), - OrganizationMods.RandomServiceAreaCentroidGeojson(f), - OrganizationMods.RandomServiceAreaCentroidX(f), - OrganizationMods.RandomServiceAreaCentroidY(f), - OrganizationMods.RandomMailingAddressCountry(f), - OrganizationMods.RandomMailingAddressState(f), - OrganizationMods.RandomOfficeAddressCountry(f), - OrganizationMods.RandomOfficeAddressState(f), - OrganizationMods.RandomArcgisAccountID(f), - OrganizationMods.RandomFieldseekerServiceFeatureItemID(f), - } -} - -// Set the model columns to this value -func (m organizationMods) ID(val int32) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) IDFunc(f func() int32) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetID() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m organizationMods) RandomID(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) Name(val string) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.Name = func() string { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) NameFunc(f func() string) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetName() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.Name = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m organizationMods) RandomName(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.Name = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) ImportDistrictGid(val null.Val[int32]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ImportDistrictGid = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) ImportDistrictGidFunc(f func() null.Val[int32]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ImportDistrictGid = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetImportDistrictGid() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ImportDistrictGid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomImportDistrictGid(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ImportDistrictGid = 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 organizationMods) RandomImportDistrictGidNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ImportDistrictGid = 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 organizationMods) Website(val null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.Website = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) WebsiteFunc(f func() null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.Website = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetWebsite() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.Website = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomWebsite(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.Website = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomWebsiteNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.Website = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) LogoUUID(val null.Val[uuid.UUID]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.LogoUUID = func() null.Val[uuid.UUID] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) LogoUUIDFunc(f func() null.Val[uuid.UUID]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.LogoUUID = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetLogoUUID() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.LogoUUID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomLogoUUID(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.LogoUUID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomLogoUUIDNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.LogoUUID = func() null.Val[uuid.UUID] { - if f == nil { - f = &defaultFaker - } - - val := random_uuid_UUID(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) Slug(val null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.Slug = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) SlugFunc(f func() null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.Slug = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetSlug() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.Slug = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomSlug(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.Slug = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "24") - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomSlugNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.Slug = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "24") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) GeneralManagerName(val null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.GeneralManagerName = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) GeneralManagerNameFunc(f func() null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.GeneralManagerName = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetGeneralManagerName() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.GeneralManagerName = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomGeneralManagerName(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.GeneralManagerName = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomGeneralManagerNameNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.GeneralManagerName = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) MailingAddressCity(val null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressCity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) MailingAddressCityFunc(f func() null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressCity = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetMailingAddressCity() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressCity = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomMailingAddressCity(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressCity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomMailingAddressCityNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressCity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) MailingAddressPostalCode(val null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressPostalCode = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) MailingAddressPostalCodeFunc(f func() null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressPostalCode = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetMailingAddressPostalCode() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressPostalCode = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomMailingAddressPostalCode(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressPostalCode = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomMailingAddressPostalCodeNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressPostalCode = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) MailingAddressStreet(val null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressStreet = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) MailingAddressStreetFunc(f func() null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressStreet = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetMailingAddressStreet() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressStreet = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomMailingAddressStreet(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressStreet = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomMailingAddressStreetNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressStreet = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) OfficeAddressCity(val null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressCity = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) OfficeAddressCityFunc(f func() null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressCity = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetOfficeAddressCity() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressCity = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomOfficeAddressCity(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressCity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomOfficeAddressCityNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressCity = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) OfficeAddressPostalCode(val null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressPostalCode = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) OfficeAddressPostalCodeFunc(f func() null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressPostalCode = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetOfficeAddressPostalCode() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressPostalCode = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomOfficeAddressPostalCode(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressPostalCode = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomOfficeAddressPostalCodeNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressPostalCode = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) OfficeAddressStreet(val null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressStreet = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) OfficeAddressStreetFunc(f func() null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressStreet = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetOfficeAddressStreet() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressStreet = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomOfficeAddressStreet(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressStreet = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomOfficeAddressStreetNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressStreet = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) ServiceAreaGeometry(val null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaGeometry = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) ServiceAreaGeometryFunc(f func() null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaGeometry = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetServiceAreaGeometry() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaGeometry = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomServiceAreaGeometry(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaGeometry = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomServiceAreaGeometryNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaGeometry = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) ServiceAreaSquareMeters(val null.Val[decimal.Decimal]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaSquareMeters = func() null.Val[decimal.Decimal] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) ServiceAreaSquareMetersFunc(f func() null.Val[decimal.Decimal]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaSquareMeters = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetServiceAreaSquareMeters() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaSquareMeters = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomServiceAreaSquareMeters(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaSquareMeters = func() null.Val[decimal.Decimal] { - if f == nil { - f = &defaultFaker - } - - val := random_decimal_Decimal(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomServiceAreaSquareMetersNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaSquareMeters = func() null.Val[decimal.Decimal] { - if f == nil { - f = &defaultFaker - } - - val := random_decimal_Decimal(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) ServiceAreaCentroid(val null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaCentroid = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) ServiceAreaCentroidFunc(f func() null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaCentroid = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetServiceAreaCentroid() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaCentroid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomServiceAreaCentroid(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaCentroid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomServiceAreaCentroidNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaCentroid = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) ServiceAreaExtent(val null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaExtent = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) ServiceAreaExtentFunc(f func() null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaExtent = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetServiceAreaExtent() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaExtent = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomServiceAreaExtent(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaExtent = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomServiceAreaExtentNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaExtent = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) OfficeFax(val null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeFax = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) OfficeFaxFunc(f func() null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeFax = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetOfficeFax() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeFax = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomOfficeFax(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeFax = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomOfficeFaxNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeFax = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) OfficePhone(val null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficePhone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) OfficePhoneFunc(f func() null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficePhone = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetOfficePhone() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficePhone = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomOfficePhone(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficePhone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomOfficePhoneNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficePhone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) ServiceAreaXmin(val null.Val[float64]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaXmin = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) ServiceAreaXminFunc(f func() null.Val[float64]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaXmin = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetServiceAreaXmin() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaXmin = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomServiceAreaXmin(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaXmin = 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 organizationMods) RandomServiceAreaXminNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaXmin = 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 organizationMods) ServiceAreaYmin(val null.Val[float64]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaYmin = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) ServiceAreaYminFunc(f func() null.Val[float64]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaYmin = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetServiceAreaYmin() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaYmin = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomServiceAreaYmin(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaYmin = 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 organizationMods) RandomServiceAreaYminNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaYmin = 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 organizationMods) ServiceAreaXmax(val null.Val[float64]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaXmax = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) ServiceAreaXmaxFunc(f func() null.Val[float64]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaXmax = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetServiceAreaXmax() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaXmax = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomServiceAreaXmax(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaXmax = 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 organizationMods) RandomServiceAreaXmaxNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaXmax = 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 organizationMods) ServiceAreaYmax(val null.Val[float64]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaYmax = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) ServiceAreaYmaxFunc(f func() null.Val[float64]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaYmax = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetServiceAreaYmax() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaYmax = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomServiceAreaYmax(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaYmax = 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 organizationMods) RandomServiceAreaYmaxNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaYmax = 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 organizationMods) ServiceAreaCentroidGeojson(val null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaCentroidGeojson = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) ServiceAreaCentroidGeojsonFunc(f func() null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaCentroidGeojson = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetServiceAreaCentroidGeojson() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaCentroidGeojson = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomServiceAreaCentroidGeojson(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaCentroidGeojson = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomServiceAreaCentroidGeojsonNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaCentroidGeojson = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) ServiceAreaCentroidX(val null.Val[float64]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaCentroidX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) ServiceAreaCentroidXFunc(f func() null.Val[float64]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaCentroidX = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetServiceAreaCentroidX() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaCentroidX = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomServiceAreaCentroidX(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaCentroidX = 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 organizationMods) RandomServiceAreaCentroidXNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaCentroidX = 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 organizationMods) ServiceAreaCentroidY(val null.Val[float64]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaCentroidY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) ServiceAreaCentroidYFunc(f func() null.Val[float64]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaCentroidY = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetServiceAreaCentroidY() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaCentroidY = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomServiceAreaCentroidY(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaCentroidY = 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 organizationMods) RandomServiceAreaCentroidYNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ServiceAreaCentroidY = 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 organizationMods) MailingAddressCountry(val null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressCountry = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) MailingAddressCountryFunc(f func() null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressCountry = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetMailingAddressCountry() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressCountry = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomMailingAddressCountry(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressCountry = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomMailingAddressCountryNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressCountry = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) MailingAddressState(val null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressState = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) MailingAddressStateFunc(f func() null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressState = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetMailingAddressState() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressState = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomMailingAddressState(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressState = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomMailingAddressStateNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.MailingAddressState = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) OfficeAddressCountry(val null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressCountry = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) OfficeAddressCountryFunc(f func() null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressCountry = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetOfficeAddressCountry() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressCountry = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomOfficeAddressCountry(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressCountry = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomOfficeAddressCountryNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressCountry = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) OfficeAddressState(val null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressState = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) OfficeAddressStateFunc(f func() null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressState = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetOfficeAddressState() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressState = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomOfficeAddressState(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressState = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomOfficeAddressStateNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.OfficeAddressState = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) ArcgisAccountID(val null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ArcgisAccountID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) ArcgisAccountIDFunc(f func() null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ArcgisAccountID = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetArcgisAccountID() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ArcgisAccountID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomArcgisAccountID(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ArcgisAccountID = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomArcgisAccountIDNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.ArcgisAccountID = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m organizationMods) FieldseekerServiceFeatureItemID(val null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.FieldseekerServiceFeatureItemID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m organizationMods) FieldseekerServiceFeatureItemIDFunc(f func() null.Val[string]) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.FieldseekerServiceFeatureItemID = f - }) -} - -// Clear any values for the column -func (m organizationMods) UnsetFieldseekerServiceFeatureItemID() OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.FieldseekerServiceFeatureItemID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m organizationMods) RandomFieldseekerServiceFeatureItemID(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.FieldseekerServiceFeatureItemID = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m organizationMods) RandomFieldseekerServiceFeatureItemIDNotNull(f *faker.Faker) OrganizationMod { - return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) { - o.FieldseekerServiceFeatureItemID = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -func (m organizationMods) WithParentsCascading() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - if isDone, _ := organizationWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = organizationWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewArcgisAccountWithContext(ctx, ArcgisAccountMods.WithParentsCascading()) - m.WithArcgisAccountAccount(related).Apply(ctx, o) - } - { - - related := o.f.NewArcgisServiceFeatureWithContext(ctx, ArcgisServiceFeatureMods.WithParentsCascading()) - m.WithFieldseekerServiceFeatureItemServiceFeature(related).Apply(ctx, o) - } - }) -} - -func (m organizationMods) WithArcgisAccountAccount(rel *ArcgisAccountTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.ArcgisAccountAccount = &organizationRArcgisAccountAccountR{ - o: rel, - } - }) -} - -func (m organizationMods) WithNewArcgisAccountAccount(mods ...ArcgisAccountMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewArcgisAccountWithContext(ctx, mods...) - - m.WithArcgisAccountAccount(related).Apply(ctx, o) - }) -} - -func (m organizationMods) WithExistingArcgisAccountAccount(em *models.ArcgisAccount) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.ArcgisAccountAccount = &organizationRArcgisAccountAccountR{ - o: o.f.FromExistingArcgisAccount(em), - } - }) -} - -func (m organizationMods) WithoutArcgisAccountAccount() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.ArcgisAccountAccount = nil - }) -} - -func (m organizationMods) WithFieldseekerServiceFeatureItemServiceFeature(rel *ArcgisServiceFeatureTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FieldseekerServiceFeatureItemServiceFeature = &organizationRFieldseekerServiceFeatureItemServiceFeatureR{ - o: rel, - } - }) -} - -func (m organizationMods) WithNewFieldseekerServiceFeatureItemServiceFeature(mods ...ArcgisServiceFeatureMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewArcgisServiceFeatureWithContext(ctx, mods...) - - m.WithFieldseekerServiceFeatureItemServiceFeature(related).Apply(ctx, o) - }) -} - -func (m organizationMods) WithExistingFieldseekerServiceFeatureItemServiceFeature(em *models.ArcgisServiceFeature) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FieldseekerServiceFeatureItemServiceFeature = &organizationRFieldseekerServiceFeatureItemServiceFeatureR{ - o: o.f.FromExistingArcgisServiceFeature(em), - } - }) -} - -func (m organizationMods) WithoutFieldseekerServiceFeatureItemServiceFeature() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FieldseekerServiceFeatureItemServiceFeature = nil - }) -} - -func (m organizationMods) WithAccounts(number int, related *ArcgisAccountTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.Accounts = []*organizationRAccountsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewAccounts(number int, mods ...ArcgisAccountMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewArcgisAccountWithContext(ctx, mods...) - m.WithAccounts(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddAccounts(number int, related *ArcgisAccountTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.Accounts = append(o.r.Accounts, &organizationRAccountsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewAccounts(number int, mods ...ArcgisAccountMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewArcgisAccountWithContext(ctx, mods...) - m.AddAccounts(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingAccounts(existingModels ...*models.ArcgisAccount) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.Accounts = append(o.r.Accounts, &organizationRAccountsR{ - o: o.f.FromExistingArcgisAccount(em), - }) - } - }) -} - -func (m organizationMods) WithoutAccounts() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.Accounts = nil - }) -} - -func (m organizationMods) WithAddressMappings(number int, related *ArcgisAddressMappingTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.AddressMappings = []*organizationRAddressMappingsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewAddressMappings(number int, mods ...ArcgisAddressMappingMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewArcgisAddressMappingWithContext(ctx, mods...) - m.WithAddressMappings(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddAddressMappings(number int, related *ArcgisAddressMappingTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.AddressMappings = append(o.r.AddressMappings, &organizationRAddressMappingsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewAddressMappings(number int, mods ...ArcgisAddressMappingMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewArcgisAddressMappingWithContext(ctx, mods...) - m.AddAddressMappings(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingAddressMappings(existingModels ...*models.ArcgisAddressMapping) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.AddressMappings = append(o.r.AddressMappings, &organizationRAddressMappingsR{ - o: o.f.FromExistingArcgisAddressMapping(em), - }) - } - }) -} - -func (m organizationMods) WithoutAddressMappings() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.AddressMappings = nil - }) -} - -func (m organizationMods) WithParcelMappings(number int, related *ArcgisParcelMappingTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.ParcelMappings = []*organizationRParcelMappingsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewParcelMappings(number int, mods ...ArcgisParcelMappingMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewArcgisParcelMappingWithContext(ctx, mods...) - m.WithParcelMappings(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddParcelMappings(number int, related *ArcgisParcelMappingTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.ParcelMappings = append(o.r.ParcelMappings, &organizationRParcelMappingsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewParcelMappings(number int, mods ...ArcgisParcelMappingMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewArcgisParcelMappingWithContext(ctx, mods...) - m.AddParcelMappings(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingParcelMappings(existingModels ...*models.ArcgisParcelMapping) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.ParcelMappings = append(o.r.ParcelMappings, &organizationRParcelMappingsR{ - o: o.f.FromExistingArcgisParcelMapping(em), - }) - } - }) -} - -func (m organizationMods) WithoutParcelMappings() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.ParcelMappings = nil - }) -} - -func (m organizationMods) WithEmailContacts(number int, related *CommsEmailContactTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.EmailContacts = []*organizationREmailContactsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewEmailContacts(number int, mods ...CommsEmailContactMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewCommsEmailContactWithContext(ctx, mods...) - m.WithEmailContacts(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddEmailContacts(number int, related *CommsEmailContactTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.EmailContacts = append(o.r.EmailContacts, &organizationREmailContactsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewEmailContacts(number int, mods ...CommsEmailContactMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewCommsEmailContactWithContext(ctx, mods...) - m.AddEmailContacts(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingEmailContacts(existingModels ...*models.CommsEmailContact) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.EmailContacts = append(o.r.EmailContacts, &organizationREmailContactsR{ - o: o.f.FromExistingCommsEmailContact(em), - }) - } - }) -} - -func (m organizationMods) WithoutEmailContacts() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.EmailContacts = nil - }) -} - -func (m organizationMods) WithPhones(number int, related *CommsPhoneTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.Phones = []*organizationRPhonesR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewPhones(number int, mods ...CommsPhoneMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewCommsPhoneWithContext(ctx, mods...) - m.WithPhones(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddPhones(number int, related *CommsPhoneTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.Phones = append(o.r.Phones, &organizationRPhonesR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewPhones(number int, mods ...CommsPhoneMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewCommsPhoneWithContext(ctx, mods...) - m.AddPhones(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingPhones(existingModels ...*models.CommsPhone) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.Phones = append(o.r.Phones, &organizationRPhonesR{ - o: o.f.FromExistingCommsPhone(em), - }) - } - }) -} - -func (m organizationMods) WithoutPhones() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.Phones = nil - }) -} - -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) WithFieldseekerPool(number int, related *FieldseekerPoolTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FieldseekerPool = []*organizationRFieldseekerPoolR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFieldseekerPool(number int, mods ...FieldseekerPoolMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFieldseekerPoolWithContext(ctx, mods...) - m.WithFieldseekerPool(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFieldseekerPool(number int, related *FieldseekerPoolTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FieldseekerPool = append(o.r.FieldseekerPool, &organizationRFieldseekerPoolR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFieldseekerPool(number int, mods ...FieldseekerPoolMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFieldseekerPoolWithContext(ctx, mods...) - m.AddFieldseekerPool(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFieldseekerPool(existingModels ...*models.FieldseekerPool) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FieldseekerPool = append(o.r.FieldseekerPool, &organizationRFieldseekerPoolR{ - o: o.f.FromExistingFieldseekerPool(em), - }) - } - }) -} - -func (m organizationMods) WithoutFieldseekerPool() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FieldseekerPool = 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{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFieldseekerSyncs(number int, mods ...FieldseekerSyncMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFieldseekerSyncWithContext(ctx, mods...) - m.WithFieldseekerSyncs(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFieldseekerSyncs(number int, related *FieldseekerSyncTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FieldseekerSyncs = append(o.r.FieldseekerSyncs, &organizationRFieldseekerSyncsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFieldseekerSyncs(number int, mods ...FieldseekerSyncMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFieldseekerSyncWithContext(ctx, mods...) - m.AddFieldseekerSyncs(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFieldseekerSyncs(existingModels ...*models.FieldseekerSync) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.FieldseekerSyncs = append(o.r.FieldseekerSyncs, &organizationRFieldseekerSyncsR{ - o: o.f.FromExistingFieldseekerSync(em), - }) - } - }) -} - -func (m organizationMods) WithoutFieldseekerSyncs() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.FieldseekerSyncs = nil - }) -} - -func (m organizationMods) WithFiles(number int, related *FileuploadFileTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.Files = []*organizationRFilesR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewFiles(number int, mods ...FileuploadFileMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFileuploadFileWithContext(ctx, mods...) - m.WithFiles(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddFiles(number int, related *FileuploadFileTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.Files = append(o.r.Files, &organizationRFilesR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewFiles(number int, mods ...FileuploadFileMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewFileuploadFileWithContext(ctx, mods...) - m.AddFiles(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingFiles(existingModels ...*models.FileuploadFile) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.Files = append(o.r.Files, &organizationRFilesR{ - o: o.f.FromExistingFileuploadFile(em), - }) - } - }) -} - -func (m organizationMods) WithoutFiles() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.Files = nil - }) -} - -func (m organizationMods) WithH3Aggregations(number int, related *H3AggregationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.H3Aggregations = []*organizationRH3AggregationsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewH3Aggregations(number int, mods ...H3AggregationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewH3AggregationWithContext(ctx, mods...) - m.WithH3Aggregations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddH3Aggregations(number int, related *H3AggregationTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.H3Aggregations = append(o.r.H3Aggregations, &organizationRH3AggregationsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewH3Aggregations(number int, mods ...H3AggregationMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewH3AggregationWithContext(ctx, mods...) - m.AddH3Aggregations(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingH3Aggregations(existingModels ...*models.H3Aggregation) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.H3Aggregations = append(o.r.H3Aggregations, &organizationRH3AggregationsR{ - o: o.f.FromExistingH3Aggregation(em), - }) - } - }) -} - -func (m organizationMods) WithoutH3Aggregations() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.H3Aggregations = nil - }) -} - -func (m organizationMods) WithLeads(number int, related *LeadTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.Leads = []*organizationRLeadsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewLeads(number int, mods ...LeadMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewLeadWithContext(ctx, mods...) - m.WithLeads(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddLeads(number int, related *LeadTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.Leads = append(o.r.Leads, &organizationRLeadsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewLeads(number int, mods ...LeadMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewLeadWithContext(ctx, mods...) - m.AddLeads(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingLeads(existingModels ...*models.Lead) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.Leads = append(o.r.Leads, &organizationRLeadsR{ - o: o.f.FromExistingLead(em), - }) - } - }) -} - -func (m organizationMods) WithoutLeads() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.Leads = nil - }) -} - -func (m organizationMods) WithNoteAudios(number int, related *NoteAudioTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.NoteAudios = []*organizationRNoteAudiosR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewNoteAudios(number int, mods ...NoteAudioMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewNoteAudioWithContext(ctx, mods...) - m.WithNoteAudios(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddNoteAudios(number int, related *NoteAudioTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.NoteAudios = append(o.r.NoteAudios, &organizationRNoteAudiosR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewNoteAudios(number int, mods ...NoteAudioMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewNoteAudioWithContext(ctx, mods...) - m.AddNoteAudios(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingNoteAudios(existingModels ...*models.NoteAudio) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.NoteAudios = append(o.r.NoteAudios, &organizationRNoteAudiosR{ - o: o.f.FromExistingNoteAudio(em), - }) - } - }) -} - -func (m organizationMods) WithoutNoteAudios() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.NoteAudios = nil - }) -} - -func (m organizationMods) WithNoteImages(number int, related *NoteImageTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.NoteImages = []*organizationRNoteImagesR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewNoteImages(number int, mods ...NoteImageMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewNoteImageWithContext(ctx, mods...) - m.WithNoteImages(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddNoteImages(number int, related *NoteImageTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.NoteImages = append(o.r.NoteImages, &organizationRNoteImagesR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewNoteImages(number int, mods ...NoteImageMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewNoteImageWithContext(ctx, mods...) - m.AddNoteImages(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingNoteImages(existingModels ...*models.NoteImage) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.NoteImages = append(o.r.NoteImages, &organizationRNoteImagesR{ - o: o.f.FromExistingNoteImage(em), - }) - } - }) -} - -func (m organizationMods) WithoutNoteImages() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.NoteImages = nil - }) -} - -func (m organizationMods) WithNuisances(number int, related *PublicreportNuisanceTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.Nuisances = []*organizationRNuisancesR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewNuisances(number int, mods ...PublicreportNuisanceMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewPublicreportNuisanceWithContext(ctx, mods...) - m.WithNuisances(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddNuisances(number int, related *PublicreportNuisanceTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.Nuisances = append(o.r.Nuisances, &organizationRNuisancesR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewNuisances(number int, mods ...PublicreportNuisanceMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewPublicreportNuisanceWithContext(ctx, mods...) - m.AddNuisances(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingNuisances(existingModels ...*models.PublicreportNuisance) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.Nuisances = append(o.r.Nuisances, &organizationRNuisancesR{ - o: o.f.FromExistingPublicreportNuisance(em), - }) - } - }) -} - -func (m organizationMods) WithoutNuisances() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.Nuisances = nil - }) -} - -func (m organizationMods) WithPublicreportPool(number int, related *PublicreportPoolTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.PublicreportPool = []*organizationRPublicreportPoolR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewPublicreportPool(number int, mods ...PublicreportPoolMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewPublicreportPoolWithContext(ctx, mods...) - m.WithPublicreportPool(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddPublicreportPool(number int, related *PublicreportPoolTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.PublicreportPool = append(o.r.PublicreportPool, &organizationRPublicreportPoolR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewPublicreportPool(number int, mods ...PublicreportPoolMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewPublicreportPoolWithContext(ctx, mods...) - m.AddPublicreportPool(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingPublicreportPool(existingModels ...*models.PublicreportPool) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.PublicreportPool = append(o.r.PublicreportPool, &organizationRPublicreportPoolR{ - o: o.f.FromExistingPublicreportPool(em), - }) - } - }) -} - -func (m organizationMods) WithoutPublicreportPool() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.PublicreportPool = nil - }) -} - -func (m organizationMods) WithQuicks(number int, related *PublicreportQuickTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.Quicks = []*organizationRQuicksR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewQuicks(number int, mods ...PublicreportQuickMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewPublicreportQuickWithContext(ctx, mods...) - m.WithQuicks(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddQuicks(number int, related *PublicreportQuickTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.Quicks = append(o.r.Quicks, &organizationRQuicksR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewQuicks(number int, mods ...PublicreportQuickMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewPublicreportQuickWithContext(ctx, mods...) - m.AddQuicks(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingQuicks(existingModels ...*models.PublicreportQuick) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.Quicks = append(o.r.Quicks, &organizationRQuicksR{ - o: o.f.FromExistingPublicreportQuick(em), - }) - } - }) -} - -func (m organizationMods) WithoutQuicks() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.Quicks = nil - }) -} - -func (m organizationMods) WithSignals(number int, related *SignalTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.Signals = []*organizationRSignalsR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewSignals(number int, mods ...SignalMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewSignalWithContext(ctx, mods...) - m.WithSignals(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddSignals(number int, related *SignalTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.Signals = append(o.r.Signals, &organizationRSignalsR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewSignals(number int, mods ...SignalMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewSignalWithContext(ctx, mods...) - m.AddSignals(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingSignals(existingModels ...*models.Signal) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.Signals = append(o.r.Signals, &organizationRSignalsR{ - o: o.f.FromExistingSignal(em), - }) - } - }) -} - -func (m organizationMods) WithoutSignals() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.Signals = nil - }) -} - -func (m organizationMods) WithUser(number int, related *UserTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.User = []*organizationRUserR{{ - number: number, - o: related, - }} - }) -} - -func (m organizationMods) WithNewUser(number int, mods ...UserMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewUserWithContext(ctx, mods...) - m.WithUser(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddUser(number int, related *UserTemplate) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.User = append(o.r.User, &organizationRUserR{ - number: number, - o: related, - }) - }) -} - -func (m organizationMods) AddNewUser(number int, mods ...UserMod) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - related := o.f.NewUserWithContext(ctx, mods...) - m.AddUser(number, related).Apply(ctx, o) - }) -} - -func (m organizationMods) AddExistingUser(existingModels ...*models.User) OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - for _, em := range existingModels { - o.r.User = append(o.r.User, &organizationRUserR{ - o: o.f.FromExistingUser(em), - }) - } - }) -} - -func (m organizationMods) WithoutUser() OrganizationMod { - return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) { - o.r.User = nil - }) -} diff --git a/db/factory/parcel.bob.go b/db/factory/parcel.bob.go deleted file mode 100644 index 03019eea..00000000 --- a/db/factory/parcel.bob.go +++ /dev/null @@ -1,512 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - 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" -) - -type ParcelMod interface { - Apply(context.Context, *ParcelTemplate) -} - -type ParcelModFunc func(context.Context, *ParcelTemplate) - -func (f ParcelModFunc) Apply(ctx context.Context, n *ParcelTemplate) { - f(ctx, n) -} - -type ParcelModSlice []ParcelMod - -func (mods ParcelModSlice) Apply(ctx context.Context, n *ParcelTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// ParcelTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type ParcelTemplate struct { - Apn func() null.Val[string] - Description func() null.Val[string] - ID func() int32 - Geometry func() string - - r parcelR - f *Factory - - alreadyPersisted bool -} - -type parcelR struct { - Sites []*parcelRSitesR -} - -type parcelRSitesR struct { - number int - o *SiteTemplate -} - -// Apply mods to the ParcelTemplate -func (o *ParcelTemplate) Apply(ctx context.Context, mods ...ParcelMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.Parcel -// according to the relationships in the template. Nothing is inserted into the db -func (t ParcelTemplate) setModelRels(o *models.Parcel) { - if t.r.Sites != nil { - rel := models.SiteSlice{} - for _, r := range t.r.Sites { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.ParcelID = null.From(o.ID) // h2 - rel.R.Parcel = o - } - rel = append(rel, related...) - } - o.R.Sites = rel - } -} - -// BuildSetter returns an *models.ParcelSetter -// this does nothing with the relationship templates -func (o ParcelTemplate) BuildSetter() *models.ParcelSetter { - m := &models.ParcelSetter{} - - if o.Apn != nil { - val := o.Apn() - m.Apn = omitnull.FromNull(val) - } - if o.Description != nil { - val := o.Description() - m.Description = omitnull.FromNull(val) - } - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.Geometry != nil { - val := o.Geometry() - m.Geometry = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.ParcelSetter -// this does nothing with the relationship templates -func (o ParcelTemplate) BuildManySetter(number int) []*models.ParcelSetter { - m := make([]*models.ParcelSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.Parcel -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ParcelTemplate.Create -func (o ParcelTemplate) Build() *models.Parcel { - m := &models.Parcel{} - - if o.Apn != nil { - m.Apn = o.Apn() - } - if o.Description != nil { - m.Description = o.Description() - } - if o.ID != nil { - m.ID = o.ID() - } - if o.Geometry != nil { - m.Geometry = o.Geometry() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.ParcelSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ParcelTemplate.CreateMany -func (o ParcelTemplate) BuildMany(number int) models.ParcelSlice { - m := make(models.ParcelSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableParcel(m *models.ParcelSetter) { - if !(m.Geometry.IsValue()) { - val := random_string(nil) - m.Geometry = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.Parcel -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *ParcelTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.Parcel) error { - var err error - - isSitesDone, _ := parcelRelSitesCtx.Value(ctx) - if !isSitesDone && o.r.Sites != nil { - ctx = parcelRelSitesCtx.WithValue(ctx, true) - for _, r := range o.r.Sites { - if r.o.alreadyPersisted { - m.R.Sites = append(m.R.Sites, r.o.Build()) - } else { - rel0, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachSites(ctx, exec, rel0...) - if err != nil { - return err - } - } - } - } - - return err -} - -// Create builds a parcel and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *ParcelTemplate) Create(ctx context.Context, exec bob.Executor) (*models.Parcel, error) { - var err error - opt := o.BuildSetter() - ensureCreatableParcel(opt) - - m, err := models.Parcels.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a parcel and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *ParcelTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.Parcel { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a parcel 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 *ParcelTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.Parcel { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple parcels and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o ParcelTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.ParcelSlice, error) { - var err error - m := make(models.ParcelSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple parcels and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o ParcelTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.ParcelSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple parcels 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 ParcelTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.ParcelSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// Parcel has methods that act as mods for the ParcelTemplate -var ParcelMods parcelMods - -type parcelMods struct{} - -func (m parcelMods) RandomizeAllColumns(f *faker.Faker) ParcelMod { - return ParcelModSlice{ - ParcelMods.RandomApn(f), - ParcelMods.RandomDescription(f), - ParcelMods.RandomID(f), - ParcelMods.RandomGeometry(f), - } -} - -// Set the model columns to this value -func (m parcelMods) Apn(val null.Val[string]) ParcelMod { - return ParcelModFunc(func(_ context.Context, o *ParcelTemplate) { - o.Apn = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m parcelMods) ApnFunc(f func() null.Val[string]) ParcelMod { - return ParcelModFunc(func(_ context.Context, o *ParcelTemplate) { - o.Apn = f - }) -} - -// Clear any values for the column -func (m parcelMods) UnsetApn() ParcelMod { - return ParcelModFunc(func(_ context.Context, o *ParcelTemplate) { - o.Apn = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m parcelMods) RandomApn(f *faker.Faker) ParcelMod { - return ParcelModFunc(func(_ context.Context, o *ParcelTemplate) { - o.Apn = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m parcelMods) RandomApnNotNull(f *faker.Faker) ParcelMod { - return ParcelModFunc(func(_ context.Context, o *ParcelTemplate) { - o.Apn = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m parcelMods) Description(val null.Val[string]) ParcelMod { - return ParcelModFunc(func(_ context.Context, o *ParcelTemplate) { - o.Description = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m parcelMods) DescriptionFunc(f func() null.Val[string]) ParcelMod { - return ParcelModFunc(func(_ context.Context, o *ParcelTemplate) { - o.Description = f - }) -} - -// Clear any values for the column -func (m parcelMods) UnsetDescription() ParcelMod { - return ParcelModFunc(func(_ context.Context, o *ParcelTemplate) { - 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 parcelMods) RandomDescription(f *faker.Faker) ParcelMod { - return ParcelModFunc(func(_ context.Context, o *ParcelTemplate) { - 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 parcelMods) RandomDescriptionNotNull(f *faker.Faker) ParcelMod { - return ParcelModFunc(func(_ context.Context, o *ParcelTemplate) { - 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 parcelMods) ID(val int32) ParcelMod { - return ParcelModFunc(func(_ context.Context, o *ParcelTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m parcelMods) IDFunc(f func() int32) ParcelMod { - return ParcelModFunc(func(_ context.Context, o *ParcelTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m parcelMods) UnsetID() ParcelMod { - return ParcelModFunc(func(_ context.Context, o *ParcelTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m parcelMods) RandomID(f *faker.Faker) ParcelMod { - return ParcelModFunc(func(_ context.Context, o *ParcelTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m parcelMods) Geometry(val string) ParcelMod { - return ParcelModFunc(func(_ context.Context, o *ParcelTemplate) { - o.Geometry = func() string { return val } - }) -} - -// Set the Column from the function -func (m parcelMods) GeometryFunc(f func() string) ParcelMod { - return ParcelModFunc(func(_ context.Context, o *ParcelTemplate) { - o.Geometry = f - }) -} - -// Clear any values for the column -func (m parcelMods) UnsetGeometry() ParcelMod { - return ParcelModFunc(func(_ context.Context, o *ParcelTemplate) { - 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 parcelMods) RandomGeometry(f *faker.Faker) ParcelMod { - return ParcelModFunc(func(_ context.Context, o *ParcelTemplate) { - o.Geometry = func() string { - return random_string(f) - } - }) -} - -func (m parcelMods) WithParentsCascading() ParcelMod { - return ParcelModFunc(func(ctx context.Context, o *ParcelTemplate) { - if isDone, _ := parcelWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = parcelWithParentsCascadingCtx.WithValue(ctx, true) - }) -} - -func (m parcelMods) WithSites(number int, related *SiteTemplate) ParcelMod { - return ParcelModFunc(func(ctx context.Context, o *ParcelTemplate) { - o.r.Sites = []*parcelRSitesR{{ - number: number, - o: related, - }} - }) -} - -func (m parcelMods) WithNewSites(number int, mods ...SiteMod) ParcelMod { - return ParcelModFunc(func(ctx context.Context, o *ParcelTemplate) { - related := o.f.NewSiteWithContext(ctx, mods...) - m.WithSites(number, related).Apply(ctx, o) - }) -} - -func (m parcelMods) AddSites(number int, related *SiteTemplate) ParcelMod { - return ParcelModFunc(func(ctx context.Context, o *ParcelTemplate) { - o.r.Sites = append(o.r.Sites, &parcelRSitesR{ - number: number, - o: related, - }) - }) -} - -func (m parcelMods) AddNewSites(number int, mods ...SiteMod) ParcelMod { - return ParcelModFunc(func(ctx context.Context, o *ParcelTemplate) { - related := o.f.NewSiteWithContext(ctx, mods...) - m.AddSites(number, related).Apply(ctx, o) - }) -} - -func (m parcelMods) AddExistingSites(existingModels ...*models.Site) ParcelMod { - return ParcelModFunc(func(ctx context.Context, o *ParcelTemplate) { - for _, em := range existingModels { - o.r.Sites = append(o.r.Sites, &parcelRSitesR{ - o: o.f.FromExistingSite(em), - }) - } - }) -} - -func (m parcelMods) WithoutSites() ParcelMod { - return ParcelModFunc(func(ctx context.Context, o *ParcelTemplate) { - o.r.Sites = nil - }) -} diff --git a/db/factory/pool.bob.go b/db/factory/pool.bob.go deleted file mode 100644 index f9332d09..00000000 --- a/db/factory/pool.bob.go +++ /dev/null @@ -1,739 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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/jaswdr/faker/v2" -) - -type PoolMod interface { - Apply(context.Context, *PoolTemplate) -} - -type PoolModFunc func(context.Context, *PoolTemplate) - -func (f PoolModFunc) Apply(ctx context.Context, n *PoolTemplate) { - f(ctx, n) -} - -type PoolModSlice []PoolMod - -func (mods PoolModSlice) Apply(ctx context.Context, n *PoolTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// PoolTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type PoolTemplate struct { - Condition func() enums.Poolconditiontype - Created func() time.Time - CreatorID func() int32 - ID func() int32 - SiteID func() int32 - SiteVersion func() int32 - Geometry func() null.Val[string] - - r poolR - f *Factory - - alreadyPersisted bool -} - -type poolR struct { - CreatorUser *poolRCreatorUserR - Site *poolRSiteR - SignalPools []*poolRSignalPoolsR -} - -type poolRCreatorUserR struct { - o *UserTemplate -} -type poolRSiteR struct { - o *SiteTemplate -} -type poolRSignalPoolsR struct { - number int - o *SignalPoolTemplate -} - -// Apply mods to the PoolTemplate -func (o *PoolTemplate) Apply(ctx context.Context, mods ...PoolMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.Pool -// according to the relationships in the template. Nothing is inserted into the db -func (t PoolTemplate) setModelRels(o *models.Pool) { - if t.r.CreatorUser != nil { - rel := t.r.CreatorUser.o.Build() - rel.R.CreatorPools = append(rel.R.CreatorPools, o) - o.CreatorID = rel.ID // h2 - o.R.CreatorUser = rel - } - - if t.r.Site != nil { - rel := t.r.Site.o.Build() - rel.R.Pools = append(rel.R.Pools, o) - o.SiteID = rel.ID // h2 - o.SiteVersion = rel.Version // h2 - o.R.Site = rel - } - - if t.r.SignalPools != nil { - rel := models.SignalPoolSlice{} - for _, r := range t.r.SignalPools { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.PoolID = o.ID // h2 - rel.R.Pool = o - } - rel = append(rel, related...) - } - o.R.SignalPools = rel - } -} - -// BuildSetter returns an *models.PoolSetter -// this does nothing with the relationship templates -func (o PoolTemplate) BuildSetter() *models.PoolSetter { - m := &models.PoolSetter{} - - if o.Condition != nil { - val := o.Condition() - m.Condition = omit.From(val) - } - 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.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.SiteID != nil { - val := o.SiteID() - m.SiteID = omit.From(val) - } - if o.SiteVersion != nil { - val := o.SiteVersion() - m.SiteVersion = omit.From(val) - } - if o.Geometry != nil { - val := o.Geometry() - m.Geometry = omitnull.FromNull(val) - } - - return m -} - -// BuildManySetter returns an []*models.PoolSetter -// this does nothing with the relationship templates -func (o PoolTemplate) BuildManySetter(number int) []*models.PoolSetter { - m := make([]*models.PoolSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.Pool -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PoolTemplate.Create -func (o PoolTemplate) Build() *models.Pool { - m := &models.Pool{} - - if o.Condition != nil { - m.Condition = o.Condition() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatorID != nil { - m.CreatorID = o.CreatorID() - } - if o.ID != nil { - m.ID = o.ID() - } - if o.SiteID != nil { - m.SiteID = o.SiteID() - } - if o.SiteVersion != nil { - m.SiteVersion = o.SiteVersion() - } - if o.Geometry != nil { - m.Geometry = o.Geometry() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.PoolSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PoolTemplate.CreateMany -func (o PoolTemplate) BuildMany(number int) models.PoolSlice { - m := make(models.PoolSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatablePool(m *models.PoolSetter) { - if !(m.Condition.IsValue()) { - val := random_enums_Poolconditiontype(nil) - m.Condition = omit.From(val) - } - 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.SiteID.IsValue()) { - val := random_int32(nil) - m.SiteID = omit.From(val) - } - if !(m.SiteVersion.IsValue()) { - val := random_int32(nil) - m.SiteVersion = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.Pool -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *PoolTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.Pool) error { - var err error - - return err -} - -// Create builds a pool and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *PoolTemplate) Create(ctx context.Context, exec bob.Executor) (*models.Pool, error) { - var err error - opt := o.BuildSetter() - ensureCreatablePool(opt) - - if o.r.CreatorUser == nil { - PoolMods.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.Site == nil { - PoolMods.WithNewSite().Apply(ctx, o) - } - - var rel1 *models.Site - - if o.r.Site.o.alreadyPersisted { - rel1 = o.r.Site.o.Build() - } else { - rel1, err = o.r.Site.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.SiteID = omit.From(rel1.ID) - opt.SiteVersion = omit.From(rel1.Version) - - m, err := models.Pools.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.CreatorUser = rel0 - m.R.Site = rel1 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a pool and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *PoolTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.Pool { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a pool 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 *PoolTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.Pool { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple pools and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o PoolTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.PoolSlice, error) { - var err error - m := make(models.PoolSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple pools and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o PoolTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.PoolSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple pools 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 PoolTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.PoolSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// Pool has methods that act as mods for the PoolTemplate -var PoolMods poolMods - -type poolMods struct{} - -func (m poolMods) RandomizeAllColumns(f *faker.Faker) PoolMod { - return PoolModSlice{ - PoolMods.RandomCondition(f), - PoolMods.RandomCreated(f), - PoolMods.RandomCreatorID(f), - PoolMods.RandomID(f), - PoolMods.RandomSiteID(f), - PoolMods.RandomSiteVersion(f), - PoolMods.RandomGeometry(f), - } -} - -// Set the model columns to this value -func (m poolMods) Condition(val enums.Poolconditiontype) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.Condition = func() enums.Poolconditiontype { return val } - }) -} - -// Set the Column from the function -func (m poolMods) ConditionFunc(f func() enums.Poolconditiontype) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.Condition = f - }) -} - -// Clear any values for the column -func (m poolMods) UnsetCondition() PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.Condition = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m poolMods) RandomCondition(f *faker.Faker) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.Condition = func() enums.Poolconditiontype { - return random_enums_Poolconditiontype(f) - } - }) -} - -// Set the model columns to this value -func (m poolMods) Created(val time.Time) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m poolMods) CreatedFunc(f func() time.Time) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m poolMods) UnsetCreated() PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - 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 poolMods) RandomCreated(f *faker.Faker) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m poolMods) CreatorID(val int32) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.CreatorID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m poolMods) CreatorIDFunc(f func() int32) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.CreatorID = f - }) -} - -// Clear any values for the column -func (m poolMods) UnsetCreatorID() PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - 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 poolMods) RandomCreatorID(f *faker.Faker) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.CreatorID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m poolMods) ID(val int32) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m poolMods) IDFunc(f func() int32) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m poolMods) UnsetID() PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m poolMods) RandomID(f *faker.Faker) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m poolMods) SiteID(val int32) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.SiteID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m poolMods) SiteIDFunc(f func() int32) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.SiteID = f - }) -} - -// Clear any values for the column -func (m poolMods) UnsetSiteID() PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.SiteID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m poolMods) RandomSiteID(f *faker.Faker) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.SiteID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m poolMods) SiteVersion(val int32) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.SiteVersion = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m poolMods) SiteVersionFunc(f func() int32) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.SiteVersion = f - }) -} - -// Clear any values for the column -func (m poolMods) UnsetSiteVersion() PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.SiteVersion = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m poolMods) RandomSiteVersion(f *faker.Faker) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.SiteVersion = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m poolMods) Geometry(val null.Val[string]) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.Geometry = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m poolMods) GeometryFunc(f func() null.Val[string]) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.Geometry = f - }) -} - -// Clear any values for the column -func (m poolMods) UnsetGeometry() PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.Geometry = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m poolMods) RandomGeometry(f *faker.Faker) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.Geometry = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m poolMods) RandomGeometryNotNull(f *faker.Faker) PoolMod { - return PoolModFunc(func(_ context.Context, o *PoolTemplate) { - o.Geometry = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -func (m poolMods) WithParentsCascading() PoolMod { - return PoolModFunc(func(ctx context.Context, o *PoolTemplate) { - if isDone, _ := poolWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = poolWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewUserWithContext(ctx, UserMods.WithParentsCascading()) - m.WithCreatorUser(related).Apply(ctx, o) - } - { - - related := o.f.NewSiteWithContext(ctx, SiteMods.WithParentsCascading()) - m.WithSite(related).Apply(ctx, o) - } - }) -} - -func (m poolMods) WithCreatorUser(rel *UserTemplate) PoolMod { - return PoolModFunc(func(ctx context.Context, o *PoolTemplate) { - o.r.CreatorUser = &poolRCreatorUserR{ - o: rel, - } - }) -} - -func (m poolMods) WithNewCreatorUser(mods ...UserMod) PoolMod { - return PoolModFunc(func(ctx context.Context, o *PoolTemplate) { - related := o.f.NewUserWithContext(ctx, mods...) - - m.WithCreatorUser(related).Apply(ctx, o) - }) -} - -func (m poolMods) WithExistingCreatorUser(em *models.User) PoolMod { - return PoolModFunc(func(ctx context.Context, o *PoolTemplate) { - o.r.CreatorUser = &poolRCreatorUserR{ - o: o.f.FromExistingUser(em), - } - }) -} - -func (m poolMods) WithoutCreatorUser() PoolMod { - return PoolModFunc(func(ctx context.Context, o *PoolTemplate) { - o.r.CreatorUser = nil - }) -} - -func (m poolMods) WithSite(rel *SiteTemplate) PoolMod { - return PoolModFunc(func(ctx context.Context, o *PoolTemplate) { - o.r.Site = &poolRSiteR{ - o: rel, - } - }) -} - -func (m poolMods) WithNewSite(mods ...SiteMod) PoolMod { - return PoolModFunc(func(ctx context.Context, o *PoolTemplate) { - related := o.f.NewSiteWithContext(ctx, mods...) - - m.WithSite(related).Apply(ctx, o) - }) -} - -func (m poolMods) WithExistingSite(em *models.Site) PoolMod { - return PoolModFunc(func(ctx context.Context, o *PoolTemplate) { - o.r.Site = &poolRSiteR{ - o: o.f.FromExistingSite(em), - } - }) -} - -func (m poolMods) WithoutSite() PoolMod { - return PoolModFunc(func(ctx context.Context, o *PoolTemplate) { - o.r.Site = nil - }) -} - -func (m poolMods) WithSignalPools(number int, related *SignalPoolTemplate) PoolMod { - return PoolModFunc(func(ctx context.Context, o *PoolTemplate) { - o.r.SignalPools = []*poolRSignalPoolsR{{ - number: number, - o: related, - }} - }) -} - -func (m poolMods) WithNewSignalPools(number int, mods ...SignalPoolMod) PoolMod { - return PoolModFunc(func(ctx context.Context, o *PoolTemplate) { - related := o.f.NewSignalPoolWithContext(ctx, mods...) - m.WithSignalPools(number, related).Apply(ctx, o) - }) -} - -func (m poolMods) AddSignalPools(number int, related *SignalPoolTemplate) PoolMod { - return PoolModFunc(func(ctx context.Context, o *PoolTemplate) { - o.r.SignalPools = append(o.r.SignalPools, &poolRSignalPoolsR{ - number: number, - o: related, - }) - }) -} - -func (m poolMods) AddNewSignalPools(number int, mods ...SignalPoolMod) PoolMod { - return PoolModFunc(func(ctx context.Context, o *PoolTemplate) { - related := o.f.NewSignalPoolWithContext(ctx, mods...) - m.AddSignalPools(number, related).Apply(ctx, o) - }) -} - -func (m poolMods) AddExistingSignalPools(existingModels ...*models.SignalPool) PoolMod { - return PoolModFunc(func(ctx context.Context, o *PoolTemplate) { - for _, em := range existingModels { - o.r.SignalPools = append(o.r.SignalPools, &poolRSignalPoolsR{ - o: o.f.FromExistingSignalPool(em), - }) - } - }) -} - -func (m poolMods) WithoutSignalPools() PoolMod { - return PoolModFunc(func(ctx context.Context, o *PoolTemplate) { - o.r.SignalPools = nil - }) -} diff --git a/db/factory/publicreport.image.bob.go b/db/factory/publicreport.image.bob.go deleted file mode 100644 index beaf1b5f..00000000 --- a/db/factory/publicreport.image.bob.go +++ /dev/null @@ -1,971 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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" -) - -type PublicreportImageMod interface { - Apply(context.Context, *PublicreportImageTemplate) -} - -type PublicreportImageModFunc func(context.Context, *PublicreportImageTemplate) - -func (f PublicreportImageModFunc) Apply(ctx context.Context, n *PublicreportImageTemplate) { - f(ctx, n) -} - -type PublicreportImageModSlice []PublicreportImageMod - -func (mods PublicreportImageModSlice) Apply(ctx context.Context, n *PublicreportImageTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// PublicreportImageTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type PublicreportImageTemplate struct { - ID func() int32 - ContentType func() string - Created func() time.Time - Location func() null.Val[string] - ResolutionX func() int32 - ResolutionY func() int32 - StorageUUID func() uuid.UUID - StorageSize func() int64 - UploadedFilename func() string - - r publicreportImageR - f *Factory - - alreadyPersisted bool -} - -type publicreportImageR struct { - ImageExifs []*publicreportImageRImageExifsR - Nuisances []*publicreportImageRNuisancesR - Pools []*publicreportImageRPoolsR - Quicks []*publicreportImageRQuicksR -} - -type publicreportImageRImageExifsR struct { - number int - o *PublicreportImageExifTemplate -} -type publicreportImageRNuisancesR struct { - number int - o *PublicreportNuisanceTemplate -} -type publicreportImageRPoolsR struct { - number int - o *PublicreportPoolTemplate -} -type publicreportImageRQuicksR struct { - number int - o *PublicreportQuickTemplate -} - -// Apply mods to the PublicreportImageTemplate -func (o *PublicreportImageTemplate) Apply(ctx context.Context, mods ...PublicreportImageMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.PublicreportImage -// according to the relationships in the template. Nothing is inserted into the db -func (t PublicreportImageTemplate) setModelRels(o *models.PublicreportImage) { - if t.r.ImageExifs != nil { - rel := models.PublicreportImageExifSlice{} - for _, r := range t.r.ImageExifs { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.ImageID = o.ID // h2 - rel.R.Image = o - } - rel = append(rel, related...) - } - o.R.ImageExifs = rel - } - - if t.r.Nuisances != nil { - rel := models.PublicreportNuisanceSlice{} - for _, r := range t.r.Nuisances { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.R.Images = append(rel.R.Images, o) - } - rel = append(rel, related...) - } - o.R.Nuisances = rel - } - - if t.r.Pools != nil { - rel := models.PublicreportPoolSlice{} - for _, r := range t.r.Pools { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.R.Images = append(rel.R.Images, o) - } - rel = append(rel, related...) - } - o.R.Pools = rel - } - - if t.r.Quicks != nil { - rel := models.PublicreportQuickSlice{} - for _, r := range t.r.Quicks { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.R.Images = append(rel.R.Images, o) - } - rel = append(rel, related...) - } - o.R.Quicks = rel - } -} - -// BuildSetter returns an *models.PublicreportImageSetter -// this does nothing with the relationship templates -func (o PublicreportImageTemplate) BuildSetter() *models.PublicreportImageSetter { - m := &models.PublicreportImageSetter{} - - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.ContentType != nil { - val := o.ContentType() - m.ContentType = omit.From(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.Location != nil { - val := o.Location() - m.Location = omitnull.FromNull(val) - } - if o.ResolutionX != nil { - val := o.ResolutionX() - m.ResolutionX = omit.From(val) - } - if o.ResolutionY != nil { - val := o.ResolutionY() - m.ResolutionY = omit.From(val) - } - if o.StorageUUID != nil { - val := o.StorageUUID() - m.StorageUUID = omit.From(val) - } - if o.StorageSize != nil { - val := o.StorageSize() - m.StorageSize = omit.From(val) - } - if o.UploadedFilename != nil { - val := o.UploadedFilename() - m.UploadedFilename = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.PublicreportImageSetter -// this does nothing with the relationship templates -func (o PublicreportImageTemplate) BuildManySetter(number int) []*models.PublicreportImageSetter { - m := make([]*models.PublicreportImageSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.PublicreportImage -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportImageTemplate.Create -func (o PublicreportImageTemplate) Build() *models.PublicreportImage { - m := &models.PublicreportImage{} - - if o.ID != nil { - m.ID = o.ID() - } - if o.ContentType != nil { - m.ContentType = o.ContentType() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.Location != nil { - m.Location = o.Location() - } - if o.ResolutionX != nil { - m.ResolutionX = o.ResolutionX() - } - if o.ResolutionY != nil { - m.ResolutionY = o.ResolutionY() - } - if o.StorageUUID != nil { - m.StorageUUID = o.StorageUUID() - } - if o.StorageSize != nil { - m.StorageSize = o.StorageSize() - } - if o.UploadedFilename != nil { - m.UploadedFilename = o.UploadedFilename() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.PublicreportImageSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportImageTemplate.CreateMany -func (o PublicreportImageTemplate) BuildMany(number int) models.PublicreportImageSlice { - m := make(models.PublicreportImageSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatablePublicreportImage(m *models.PublicreportImageSetter) { - if !(m.ContentType.IsValue()) { - val := random_string(nil) - m.ContentType = omit.From(val) - } - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.ResolutionX.IsValue()) { - val := random_int32(nil) - m.ResolutionX = omit.From(val) - } - if !(m.ResolutionY.IsValue()) { - val := random_int32(nil) - m.ResolutionY = omit.From(val) - } - if !(m.StorageUUID.IsValue()) { - val := random_uuid_UUID(nil) - m.StorageUUID = omit.From(val) - } - if !(m.StorageSize.IsValue()) { - val := random_int64(nil) - m.StorageSize = omit.From(val) - } - if !(m.UploadedFilename.IsValue()) { - val := random_string(nil) - m.UploadedFilename = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.PublicreportImage -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *PublicreportImageTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.PublicreportImage) error { - var err error - - isImageExifsDone, _ := publicreportImageRelImageExifsCtx.Value(ctx) - if !isImageExifsDone && o.r.ImageExifs != nil { - ctx = publicreportImageRelImageExifsCtx.WithValue(ctx, true) - for _, r := range o.r.ImageExifs { - if r.o.alreadyPersisted { - m.R.ImageExifs = append(m.R.ImageExifs, r.o.Build()) - } else { - rel0, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachImageExifs(ctx, exec, rel0...) - if err != nil { - return err - } - } - } - } - - isNuisancesDone, _ := publicreportImageRelNuisancesCtx.Value(ctx) - if !isNuisancesDone && o.r.Nuisances != nil { - ctx = publicreportImageRelNuisancesCtx.WithValue(ctx, true) - for _, r := range o.r.Nuisances { - if r.o.alreadyPersisted { - m.R.Nuisances = append(m.R.Nuisances, r.o.Build()) - } else { - rel1, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachNuisances(ctx, exec, rel1...) - if err != nil { - return err - } - } - } - } - - isPoolsDone, _ := publicreportImageRelPoolsCtx.Value(ctx) - if !isPoolsDone && o.r.Pools != nil { - ctx = publicreportImageRelPoolsCtx.WithValue(ctx, true) - for _, r := range o.r.Pools { - if r.o.alreadyPersisted { - m.R.Pools = append(m.R.Pools, r.o.Build()) - } else { - rel2, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachPools(ctx, exec, rel2...) - if err != nil { - return err - } - } - } - } - - isQuicksDone, _ := publicreportImageRelQuicksCtx.Value(ctx) - if !isQuicksDone && o.r.Quicks != nil { - ctx = publicreportImageRelQuicksCtx.WithValue(ctx, true) - for _, r := range o.r.Quicks { - if r.o.alreadyPersisted { - m.R.Quicks = append(m.R.Quicks, r.o.Build()) - } else { - rel3, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachQuicks(ctx, exec, rel3...) - if err != nil { - return err - } - } - } - } - - return err -} - -// Create builds a publicreportImage and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *PublicreportImageTemplate) Create(ctx context.Context, exec bob.Executor) (*models.PublicreportImage, error) { - var err error - opt := o.BuildSetter() - ensureCreatablePublicreportImage(opt) - - m, err := models.PublicreportImages.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a publicreportImage and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *PublicreportImageTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.PublicreportImage { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a publicreportImage 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 *PublicreportImageTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.PublicreportImage { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple publicreportImages and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o PublicreportImageTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.PublicreportImageSlice, error) { - var err error - m := make(models.PublicreportImageSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple publicreportImages and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o PublicreportImageTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.PublicreportImageSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple publicreportImages 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 PublicreportImageTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.PublicreportImageSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// PublicreportImage has methods that act as mods for the PublicreportImageTemplate -var PublicreportImageMods publicreportImageMods - -type publicreportImageMods struct{} - -func (m publicreportImageMods) RandomizeAllColumns(f *faker.Faker) PublicreportImageMod { - return PublicreportImageModSlice{ - PublicreportImageMods.RandomID(f), - PublicreportImageMods.RandomContentType(f), - PublicreportImageMods.RandomCreated(f), - PublicreportImageMods.RandomLocation(f), - PublicreportImageMods.RandomResolutionX(f), - PublicreportImageMods.RandomResolutionY(f), - PublicreportImageMods.RandomStorageUUID(f), - PublicreportImageMods.RandomStorageSize(f), - PublicreportImageMods.RandomUploadedFilename(f), - } -} - -// Set the model columns to this value -func (m publicreportImageMods) ID(val int32) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportImageMods) IDFunc(f func() int32) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m publicreportImageMods) UnsetID() PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportImageMods) RandomID(f *faker.Faker) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportImageMods) ContentType(val string) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.ContentType = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportImageMods) ContentTypeFunc(f func() string) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.ContentType = f - }) -} - -// Clear any values for the column -func (m publicreportImageMods) UnsetContentType() PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.ContentType = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportImageMods) RandomContentType(f *faker.Faker) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.ContentType = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportImageMods) Created(val time.Time) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m publicreportImageMods) CreatedFunc(f func() time.Time) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m publicreportImageMods) UnsetCreated() PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - 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 publicreportImageMods) RandomCreated(f *faker.Faker) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportImageMods) Location(val null.Val[string]) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.Location = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m publicreportImageMods) LocationFunc(f func() null.Val[string]) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.Location = f - }) -} - -// Clear any values for the column -func (m publicreportImageMods) UnsetLocation() PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.Location = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m publicreportImageMods) RandomLocation(f *faker.Faker) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.Location = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m publicreportImageMods) RandomLocationNotNull(f *faker.Faker) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.Location = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m publicreportImageMods) ResolutionX(val int32) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.ResolutionX = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportImageMods) ResolutionXFunc(f func() int32) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.ResolutionX = f - }) -} - -// Clear any values for the column -func (m publicreportImageMods) UnsetResolutionX() PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.ResolutionX = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportImageMods) RandomResolutionX(f *faker.Faker) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.ResolutionX = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportImageMods) ResolutionY(val int32) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.ResolutionY = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportImageMods) ResolutionYFunc(f func() int32) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.ResolutionY = f - }) -} - -// Clear any values for the column -func (m publicreportImageMods) UnsetResolutionY() PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.ResolutionY = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportImageMods) RandomResolutionY(f *faker.Faker) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.ResolutionY = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportImageMods) StorageUUID(val uuid.UUID) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.StorageUUID = func() uuid.UUID { return val } - }) -} - -// Set the Column from the function -func (m publicreportImageMods) StorageUUIDFunc(f func() uuid.UUID) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.StorageUUID = f - }) -} - -// Clear any values for the column -func (m publicreportImageMods) UnsetStorageUUID() PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.StorageUUID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportImageMods) RandomStorageUUID(f *faker.Faker) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.StorageUUID = func() uuid.UUID { - return random_uuid_UUID(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportImageMods) StorageSize(val int64) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.StorageSize = func() int64 { return val } - }) -} - -// Set the Column from the function -func (m publicreportImageMods) StorageSizeFunc(f func() int64) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.StorageSize = f - }) -} - -// Clear any values for the column -func (m publicreportImageMods) UnsetStorageSize() PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.StorageSize = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportImageMods) RandomStorageSize(f *faker.Faker) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.StorageSize = func() int64 { - return random_int64(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportImageMods) UploadedFilename(val string) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.UploadedFilename = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportImageMods) UploadedFilenameFunc(f func() string) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.UploadedFilename = f - }) -} - -// Clear any values for the column -func (m publicreportImageMods) UnsetUploadedFilename() PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.UploadedFilename = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportImageMods) RandomUploadedFilename(f *faker.Faker) PublicreportImageMod { - return PublicreportImageModFunc(func(_ context.Context, o *PublicreportImageTemplate) { - o.UploadedFilename = func() string { - return random_string(f) - } - }) -} - -func (m publicreportImageMods) WithParentsCascading() PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - if isDone, _ := publicreportImageWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = publicreportImageWithParentsCascadingCtx.WithValue(ctx, true) - }) -} - -func (m publicreportImageMods) WithImageExifs(number int, related *PublicreportImageExifTemplate) PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - o.r.ImageExifs = []*publicreportImageRImageExifsR{{ - number: number, - o: related, - }} - }) -} - -func (m publicreportImageMods) WithNewImageExifs(number int, mods ...PublicreportImageExifMod) PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - related := o.f.NewPublicreportImageExifWithContext(ctx, mods...) - m.WithImageExifs(number, related).Apply(ctx, o) - }) -} - -func (m publicreportImageMods) AddImageExifs(number int, related *PublicreportImageExifTemplate) PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - o.r.ImageExifs = append(o.r.ImageExifs, &publicreportImageRImageExifsR{ - number: number, - o: related, - }) - }) -} - -func (m publicreportImageMods) AddNewImageExifs(number int, mods ...PublicreportImageExifMod) PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - related := o.f.NewPublicreportImageExifWithContext(ctx, mods...) - m.AddImageExifs(number, related).Apply(ctx, o) - }) -} - -func (m publicreportImageMods) AddExistingImageExifs(existingModels ...*models.PublicreportImageExif) PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - for _, em := range existingModels { - o.r.ImageExifs = append(o.r.ImageExifs, &publicreportImageRImageExifsR{ - o: o.f.FromExistingPublicreportImageExif(em), - }) - } - }) -} - -func (m publicreportImageMods) WithoutImageExifs() PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - o.r.ImageExifs = nil - }) -} - -func (m publicreportImageMods) WithNuisances(number int, related *PublicreportNuisanceTemplate) PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - o.r.Nuisances = []*publicreportImageRNuisancesR{{ - number: number, - o: related, - }} - }) -} - -func (m publicreportImageMods) WithNewNuisances(number int, mods ...PublicreportNuisanceMod) PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - related := o.f.NewPublicreportNuisanceWithContext(ctx, mods...) - m.WithNuisances(number, related).Apply(ctx, o) - }) -} - -func (m publicreportImageMods) AddNuisances(number int, related *PublicreportNuisanceTemplate) PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - o.r.Nuisances = append(o.r.Nuisances, &publicreportImageRNuisancesR{ - number: number, - o: related, - }) - }) -} - -func (m publicreportImageMods) AddNewNuisances(number int, mods ...PublicreportNuisanceMod) PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - related := o.f.NewPublicreportNuisanceWithContext(ctx, mods...) - m.AddNuisances(number, related).Apply(ctx, o) - }) -} - -func (m publicreportImageMods) AddExistingNuisances(existingModels ...*models.PublicreportNuisance) PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - for _, em := range existingModels { - o.r.Nuisances = append(o.r.Nuisances, &publicreportImageRNuisancesR{ - o: o.f.FromExistingPublicreportNuisance(em), - }) - } - }) -} - -func (m publicreportImageMods) WithoutNuisances() PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - o.r.Nuisances = nil - }) -} - -func (m publicreportImageMods) WithPools(number int, related *PublicreportPoolTemplate) PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - o.r.Pools = []*publicreportImageRPoolsR{{ - number: number, - o: related, - }} - }) -} - -func (m publicreportImageMods) WithNewPools(number int, mods ...PublicreportPoolMod) PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - related := o.f.NewPublicreportPoolWithContext(ctx, mods...) - m.WithPools(number, related).Apply(ctx, o) - }) -} - -func (m publicreportImageMods) AddPools(number int, related *PublicreportPoolTemplate) PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - o.r.Pools = append(o.r.Pools, &publicreportImageRPoolsR{ - number: number, - o: related, - }) - }) -} - -func (m publicreportImageMods) AddNewPools(number int, mods ...PublicreportPoolMod) PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - related := o.f.NewPublicreportPoolWithContext(ctx, mods...) - m.AddPools(number, related).Apply(ctx, o) - }) -} - -func (m publicreportImageMods) AddExistingPools(existingModels ...*models.PublicreportPool) PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - for _, em := range existingModels { - o.r.Pools = append(o.r.Pools, &publicreportImageRPoolsR{ - o: o.f.FromExistingPublicreportPool(em), - }) - } - }) -} - -func (m publicreportImageMods) WithoutPools() PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - o.r.Pools = nil - }) -} - -func (m publicreportImageMods) WithQuicks(number int, related *PublicreportQuickTemplate) PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - o.r.Quicks = []*publicreportImageRQuicksR{{ - number: number, - o: related, - }} - }) -} - -func (m publicreportImageMods) WithNewQuicks(number int, mods ...PublicreportQuickMod) PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - related := o.f.NewPublicreportQuickWithContext(ctx, mods...) - m.WithQuicks(number, related).Apply(ctx, o) - }) -} - -func (m publicreportImageMods) AddQuicks(number int, related *PublicreportQuickTemplate) PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - o.r.Quicks = append(o.r.Quicks, &publicreportImageRQuicksR{ - number: number, - o: related, - }) - }) -} - -func (m publicreportImageMods) AddNewQuicks(number int, mods ...PublicreportQuickMod) PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - related := o.f.NewPublicreportQuickWithContext(ctx, mods...) - m.AddQuicks(number, related).Apply(ctx, o) - }) -} - -func (m publicreportImageMods) AddExistingQuicks(existingModels ...*models.PublicreportQuick) PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - for _, em := range existingModels { - o.r.Quicks = append(o.r.Quicks, &publicreportImageRQuicksR{ - o: o.f.FromExistingPublicreportQuick(em), - }) - } - }) -} - -func (m publicreportImageMods) WithoutQuicks() PublicreportImageMod { - return PublicreportImageModFunc(func(ctx context.Context, o *PublicreportImageTemplate) { - o.r.Quicks = nil - }) -} diff --git a/db/factory/publicreport.image_exif.bob.go b/db/factory/publicreport.image_exif.bob.go deleted file mode 100644 index 1726c82a..00000000 --- a/db/factory/publicreport.image_exif.bob.go +++ /dev/null @@ -1,413 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/omit" - "github.com/jaswdr/faker/v2" -) - -type PublicreportImageExifMod interface { - Apply(context.Context, *PublicreportImageExifTemplate) -} - -type PublicreportImageExifModFunc func(context.Context, *PublicreportImageExifTemplate) - -func (f PublicreportImageExifModFunc) Apply(ctx context.Context, n *PublicreportImageExifTemplate) { - f(ctx, n) -} - -type PublicreportImageExifModSlice []PublicreportImageExifMod - -func (mods PublicreportImageExifModSlice) Apply(ctx context.Context, n *PublicreportImageExifTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// PublicreportImageExifTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type PublicreportImageExifTemplate struct { - ImageID func() int32 - Name func() string - Value func() string - - r publicreportImageExifR - f *Factory - - alreadyPersisted bool -} - -type publicreportImageExifR struct { - Image *publicreportImageExifRImageR -} - -type publicreportImageExifRImageR struct { - o *PublicreportImageTemplate -} - -// Apply mods to the PublicreportImageExifTemplate -func (o *PublicreportImageExifTemplate) Apply(ctx context.Context, mods ...PublicreportImageExifMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.PublicreportImageExif -// according to the relationships in the template. Nothing is inserted into the db -func (t PublicreportImageExifTemplate) setModelRels(o *models.PublicreportImageExif) { - if t.r.Image != nil { - rel := t.r.Image.o.Build() - rel.R.ImageExifs = append(rel.R.ImageExifs, o) - o.ImageID = rel.ID // h2 - o.R.Image = rel - } -} - -// BuildSetter returns an *models.PublicreportImageExifSetter -// this does nothing with the relationship templates -func (o PublicreportImageExifTemplate) BuildSetter() *models.PublicreportImageExifSetter { - m := &models.PublicreportImageExifSetter{} - - if o.ImageID != nil { - val := o.ImageID() - m.ImageID = omit.From(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omit.From(val) - } - if o.Value != nil { - val := o.Value() - m.Value = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.PublicreportImageExifSetter -// this does nothing with the relationship templates -func (o PublicreportImageExifTemplate) BuildManySetter(number int) []*models.PublicreportImageExifSetter { - m := make([]*models.PublicreportImageExifSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.PublicreportImageExif -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportImageExifTemplate.Create -func (o PublicreportImageExifTemplate) Build() *models.PublicreportImageExif { - m := &models.PublicreportImageExif{} - - if o.ImageID != nil { - m.ImageID = o.ImageID() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.Value != nil { - m.Value = o.Value() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.PublicreportImageExifSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportImageExifTemplate.CreateMany -func (o PublicreportImageExifTemplate) BuildMany(number int) models.PublicreportImageExifSlice { - m := make(models.PublicreportImageExifSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatablePublicreportImageExif(m *models.PublicreportImageExifSetter) { - if !(m.ImageID.IsValue()) { - val := random_int32(nil) - m.ImageID = omit.From(val) - } - if !(m.Name.IsValue()) { - val := random_string(nil) - m.Name = omit.From(val) - } - if !(m.Value.IsValue()) { - val := random_string(nil) - m.Value = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.PublicreportImageExif -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *PublicreportImageExifTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.PublicreportImageExif) error { - var err error - - return err -} - -// Create builds a publicreportImageExif and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *PublicreportImageExifTemplate) Create(ctx context.Context, exec bob.Executor) (*models.PublicreportImageExif, error) { - var err error - opt := o.BuildSetter() - ensureCreatablePublicreportImageExif(opt) - - if o.r.Image == nil { - PublicreportImageExifMods.WithNewImage().Apply(ctx, o) - } - - var rel0 *models.PublicreportImage - - if o.r.Image.o.alreadyPersisted { - rel0 = o.r.Image.o.Build() - } else { - rel0, err = o.r.Image.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.ImageID = omit.From(rel0.ID) - - m, err := models.PublicreportImageExifs.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.Image = rel0 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a publicreportImageExif and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *PublicreportImageExifTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.PublicreportImageExif { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a publicreportImageExif 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 *PublicreportImageExifTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.PublicreportImageExif { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple publicreportImageExifs and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o PublicreportImageExifTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.PublicreportImageExifSlice, error) { - var err error - m := make(models.PublicreportImageExifSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple publicreportImageExifs and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o PublicreportImageExifTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.PublicreportImageExifSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple publicreportImageExifs 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 PublicreportImageExifTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.PublicreportImageExifSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// PublicreportImageExif has methods that act as mods for the PublicreportImageExifTemplate -var PublicreportImageExifMods publicreportImageExifMods - -type publicreportImageExifMods struct{} - -func (m publicreportImageExifMods) RandomizeAllColumns(f *faker.Faker) PublicreportImageExifMod { - return PublicreportImageExifModSlice{ - PublicreportImageExifMods.RandomImageID(f), - PublicreportImageExifMods.RandomName(f), - PublicreportImageExifMods.RandomValue(f), - } -} - -// Set the model columns to this value -func (m publicreportImageExifMods) ImageID(val int32) PublicreportImageExifMod { - return PublicreportImageExifModFunc(func(_ context.Context, o *PublicreportImageExifTemplate) { - o.ImageID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportImageExifMods) ImageIDFunc(f func() int32) PublicreportImageExifMod { - return PublicreportImageExifModFunc(func(_ context.Context, o *PublicreportImageExifTemplate) { - o.ImageID = f - }) -} - -// Clear any values for the column -func (m publicreportImageExifMods) UnsetImageID() PublicreportImageExifMod { - return PublicreportImageExifModFunc(func(_ context.Context, o *PublicreportImageExifTemplate) { - o.ImageID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportImageExifMods) RandomImageID(f *faker.Faker) PublicreportImageExifMod { - return PublicreportImageExifModFunc(func(_ context.Context, o *PublicreportImageExifTemplate) { - o.ImageID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportImageExifMods) Name(val string) PublicreportImageExifMod { - return PublicreportImageExifModFunc(func(_ context.Context, o *PublicreportImageExifTemplate) { - o.Name = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportImageExifMods) NameFunc(f func() string) PublicreportImageExifMod { - return PublicreportImageExifModFunc(func(_ context.Context, o *PublicreportImageExifTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m publicreportImageExifMods) UnsetName() PublicreportImageExifMod { - return PublicreportImageExifModFunc(func(_ context.Context, o *PublicreportImageExifTemplate) { - o.Name = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportImageExifMods) RandomName(f *faker.Faker) PublicreportImageExifMod { - return PublicreportImageExifModFunc(func(_ context.Context, o *PublicreportImageExifTemplate) { - o.Name = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportImageExifMods) Value(val string) PublicreportImageExifMod { - return PublicreportImageExifModFunc(func(_ context.Context, o *PublicreportImageExifTemplate) { - o.Value = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportImageExifMods) ValueFunc(f func() string) PublicreportImageExifMod { - return PublicreportImageExifModFunc(func(_ context.Context, o *PublicreportImageExifTemplate) { - o.Value = f - }) -} - -// Clear any values for the column -func (m publicreportImageExifMods) UnsetValue() PublicreportImageExifMod { - return PublicreportImageExifModFunc(func(_ context.Context, o *PublicreportImageExifTemplate) { - o.Value = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportImageExifMods) RandomValue(f *faker.Faker) PublicreportImageExifMod { - return PublicreportImageExifModFunc(func(_ context.Context, o *PublicreportImageExifTemplate) { - o.Value = func() string { - return random_string(f) - } - }) -} - -func (m publicreportImageExifMods) WithParentsCascading() PublicreportImageExifMod { - return PublicreportImageExifModFunc(func(ctx context.Context, o *PublicreportImageExifTemplate) { - if isDone, _ := publicreportImageExifWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = publicreportImageExifWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewPublicreportImageWithContext(ctx, PublicreportImageMods.WithParentsCascading()) - m.WithImage(related).Apply(ctx, o) - } - }) -} - -func (m publicreportImageExifMods) WithImage(rel *PublicreportImageTemplate) PublicreportImageExifMod { - return PublicreportImageExifModFunc(func(ctx context.Context, o *PublicreportImageExifTemplate) { - o.r.Image = &publicreportImageExifRImageR{ - o: rel, - } - }) -} - -func (m publicreportImageExifMods) WithNewImage(mods ...PublicreportImageMod) PublicreportImageExifMod { - return PublicreportImageExifModFunc(func(ctx context.Context, o *PublicreportImageExifTemplate) { - related := o.f.NewPublicreportImageWithContext(ctx, mods...) - - m.WithImage(related).Apply(ctx, o) - }) -} - -func (m publicreportImageExifMods) WithExistingImage(em *models.PublicreportImage) PublicreportImageExifMod { - return PublicreportImageExifModFunc(func(ctx context.Context, o *PublicreportImageExifTemplate) { - o.r.Image = &publicreportImageExifRImageR{ - o: o.f.FromExistingPublicreportImage(em), - } - }) -} - -func (m publicreportImageExifMods) WithoutImage() PublicreportImageExifMod { - return PublicreportImageExifModFunc(func(ctx context.Context, o *PublicreportImageExifTemplate) { - o.r.Image = nil - }) -} diff --git a/db/factory/publicreport.notify_email_nuisance.bob.go b/db/factory/publicreport.notify_email_nuisance.bob.go deleted file mode 100644 index b5fc2d76..00000000 --- a/db/factory/publicreport.notify_email_nuisance.bob.go +++ /dev/null @@ -1,542 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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" -) - -type PublicreportNotifyEmailNuisanceMod interface { - Apply(context.Context, *PublicreportNotifyEmailNuisanceTemplate) -} - -type PublicreportNotifyEmailNuisanceModFunc func(context.Context, *PublicreportNotifyEmailNuisanceTemplate) - -func (f PublicreportNotifyEmailNuisanceModFunc) Apply(ctx context.Context, n *PublicreportNotifyEmailNuisanceTemplate) { - f(ctx, n) -} - -type PublicreportNotifyEmailNuisanceModSlice []PublicreportNotifyEmailNuisanceMod - -func (mods PublicreportNotifyEmailNuisanceModSlice) Apply(ctx context.Context, n *PublicreportNotifyEmailNuisanceTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// PublicreportNotifyEmailNuisanceTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type PublicreportNotifyEmailNuisanceTemplate struct { - Created func() time.Time - Deleted func() null.Val[time.Time] - NuisanceID func() int32 - EmailAddress func() string - - r publicreportNotifyEmailNuisanceR - f *Factory - - alreadyPersisted bool -} - -type publicreportNotifyEmailNuisanceR struct { - EmailAddressEmailContact *publicreportNotifyEmailNuisanceREmailAddressEmailContactR - Nuisance *publicreportNotifyEmailNuisanceRNuisanceR -} - -type publicreportNotifyEmailNuisanceREmailAddressEmailContactR struct { - o *CommsEmailContactTemplate -} -type publicreportNotifyEmailNuisanceRNuisanceR struct { - o *PublicreportNuisanceTemplate -} - -// Apply mods to the PublicreportNotifyEmailNuisanceTemplate -func (o *PublicreportNotifyEmailNuisanceTemplate) Apply(ctx context.Context, mods ...PublicreportNotifyEmailNuisanceMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.PublicreportNotifyEmailNuisance -// according to the relationships in the template. Nothing is inserted into the db -func (t PublicreportNotifyEmailNuisanceTemplate) setModelRels(o *models.PublicreportNotifyEmailNuisance) { - if t.r.EmailAddressEmailContact != nil { - rel := t.r.EmailAddressEmailContact.o.Build() - rel.R.EmailAddressNotifyEmailNuisances = append(rel.R.EmailAddressNotifyEmailNuisances, o) - o.EmailAddress = rel.Address // h2 - o.R.EmailAddressEmailContact = rel - } - - if t.r.Nuisance != nil { - rel := t.r.Nuisance.o.Build() - rel.R.NotifyEmailNuisances = append(rel.R.NotifyEmailNuisances, o) - o.NuisanceID = rel.ID // h2 - o.R.Nuisance = rel - } -} - -// BuildSetter returns an *models.PublicreportNotifyEmailNuisanceSetter -// this does nothing with the relationship templates -func (o PublicreportNotifyEmailNuisanceTemplate) BuildSetter() *models.PublicreportNotifyEmailNuisanceSetter { - m := &models.PublicreportNotifyEmailNuisanceSetter{} - - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.Deleted != nil { - val := o.Deleted() - m.Deleted = omitnull.FromNull(val) - } - if o.NuisanceID != nil { - val := o.NuisanceID() - m.NuisanceID = omit.From(val) - } - if o.EmailAddress != nil { - val := o.EmailAddress() - m.EmailAddress = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.PublicreportNotifyEmailNuisanceSetter -// this does nothing with the relationship templates -func (o PublicreportNotifyEmailNuisanceTemplate) BuildManySetter(number int) []*models.PublicreportNotifyEmailNuisanceSetter { - m := make([]*models.PublicreportNotifyEmailNuisanceSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.PublicreportNotifyEmailNuisance -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportNotifyEmailNuisanceTemplate.Create -func (o PublicreportNotifyEmailNuisanceTemplate) Build() *models.PublicreportNotifyEmailNuisance { - m := &models.PublicreportNotifyEmailNuisance{} - - if o.Created != nil { - m.Created = o.Created() - } - if o.Deleted != nil { - m.Deleted = o.Deleted() - } - if o.NuisanceID != nil { - m.NuisanceID = o.NuisanceID() - } - if o.EmailAddress != nil { - m.EmailAddress = o.EmailAddress() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.PublicreportNotifyEmailNuisanceSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportNotifyEmailNuisanceTemplate.CreateMany -func (o PublicreportNotifyEmailNuisanceTemplate) BuildMany(number int) models.PublicreportNotifyEmailNuisanceSlice { - m := make(models.PublicreportNotifyEmailNuisanceSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatablePublicreportNotifyEmailNuisance(m *models.PublicreportNotifyEmailNuisanceSetter) { - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.NuisanceID.IsValue()) { - val := random_int32(nil) - m.NuisanceID = omit.From(val) - } - if !(m.EmailAddress.IsValue()) { - val := random_string(nil) - m.EmailAddress = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.PublicreportNotifyEmailNuisance -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *PublicreportNotifyEmailNuisanceTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.PublicreportNotifyEmailNuisance) error { - var err error - - return err -} - -// Create builds a publicreportNotifyEmailNuisance and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *PublicreportNotifyEmailNuisanceTemplate) Create(ctx context.Context, exec bob.Executor) (*models.PublicreportNotifyEmailNuisance, error) { - var err error - opt := o.BuildSetter() - ensureCreatablePublicreportNotifyEmailNuisance(opt) - - if o.r.EmailAddressEmailContact == nil { - PublicreportNotifyEmailNuisanceMods.WithNewEmailAddressEmailContact().Apply(ctx, o) - } - - var rel0 *models.CommsEmailContact - - if o.r.EmailAddressEmailContact.o.alreadyPersisted { - rel0 = o.r.EmailAddressEmailContact.o.Build() - } else { - rel0, err = o.r.EmailAddressEmailContact.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.EmailAddress = omit.From(rel0.Address) - - if o.r.Nuisance == nil { - PublicreportNotifyEmailNuisanceMods.WithNewNuisance().Apply(ctx, o) - } - - var rel1 *models.PublicreportNuisance - - if o.r.Nuisance.o.alreadyPersisted { - rel1 = o.r.Nuisance.o.Build() - } else { - rel1, err = o.r.Nuisance.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.NuisanceID = omit.From(rel1.ID) - - m, err := models.PublicreportNotifyEmailNuisances.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.EmailAddressEmailContact = rel0 - m.R.Nuisance = rel1 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a publicreportNotifyEmailNuisance and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *PublicreportNotifyEmailNuisanceTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.PublicreportNotifyEmailNuisance { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a publicreportNotifyEmailNuisance 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 *PublicreportNotifyEmailNuisanceTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.PublicreportNotifyEmailNuisance { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple publicreportNotifyEmailNuisances and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o PublicreportNotifyEmailNuisanceTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.PublicreportNotifyEmailNuisanceSlice, error) { - var err error - m := make(models.PublicreportNotifyEmailNuisanceSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple publicreportNotifyEmailNuisances and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o PublicreportNotifyEmailNuisanceTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.PublicreportNotifyEmailNuisanceSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple publicreportNotifyEmailNuisances 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 PublicreportNotifyEmailNuisanceTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.PublicreportNotifyEmailNuisanceSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// PublicreportNotifyEmailNuisance has methods that act as mods for the PublicreportNotifyEmailNuisanceTemplate -var PublicreportNotifyEmailNuisanceMods publicreportNotifyEmailNuisanceMods - -type publicreportNotifyEmailNuisanceMods struct{} - -func (m publicreportNotifyEmailNuisanceMods) RandomizeAllColumns(f *faker.Faker) PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModSlice{ - PublicreportNotifyEmailNuisanceMods.RandomCreated(f), - PublicreportNotifyEmailNuisanceMods.RandomDeleted(f), - PublicreportNotifyEmailNuisanceMods.RandomNuisanceID(f), - PublicreportNotifyEmailNuisanceMods.RandomEmailAddress(f), - } -} - -// Set the model columns to this value -func (m publicreportNotifyEmailNuisanceMods) Created(val time.Time) PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m publicreportNotifyEmailNuisanceMods) CreatedFunc(f func() time.Time) PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m publicreportNotifyEmailNuisanceMods) UnsetCreated() PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - 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 publicreportNotifyEmailNuisanceMods) RandomCreated(f *faker.Faker) PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNotifyEmailNuisanceMods) Deleted(val null.Val[time.Time]) PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - o.Deleted = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m publicreportNotifyEmailNuisanceMods) DeletedFunc(f func() null.Val[time.Time]) PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - o.Deleted = f - }) -} - -// Clear any values for the column -func (m publicreportNotifyEmailNuisanceMods) UnsetDeleted() PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - 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 publicreportNotifyEmailNuisanceMods) RandomDeleted(f *faker.Faker) PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - 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 publicreportNotifyEmailNuisanceMods) RandomDeletedNotNull(f *faker.Faker) PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - 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 publicreportNotifyEmailNuisanceMods) NuisanceID(val int32) PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - o.NuisanceID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportNotifyEmailNuisanceMods) NuisanceIDFunc(f func() int32) PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - o.NuisanceID = f - }) -} - -// Clear any values for the column -func (m publicreportNotifyEmailNuisanceMods) UnsetNuisanceID() PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - o.NuisanceID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNotifyEmailNuisanceMods) RandomNuisanceID(f *faker.Faker) PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - o.NuisanceID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNotifyEmailNuisanceMods) EmailAddress(val string) PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - o.EmailAddress = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportNotifyEmailNuisanceMods) EmailAddressFunc(f func() string) PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - o.EmailAddress = f - }) -} - -// Clear any values for the column -func (m publicreportNotifyEmailNuisanceMods) UnsetEmailAddress() PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - o.EmailAddress = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNotifyEmailNuisanceMods) RandomEmailAddress(f *faker.Faker) PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - o.EmailAddress = func() string { - return random_string(f) - } - }) -} - -func (m publicreportNotifyEmailNuisanceMods) WithParentsCascading() PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(ctx context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - if isDone, _ := publicreportNotifyEmailNuisanceWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = publicreportNotifyEmailNuisanceWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewCommsEmailContactWithContext(ctx, CommsEmailContactMods.WithParentsCascading()) - m.WithEmailAddressEmailContact(related).Apply(ctx, o) - } - { - - related := o.f.NewPublicreportNuisanceWithContext(ctx, PublicreportNuisanceMods.WithParentsCascading()) - m.WithNuisance(related).Apply(ctx, o) - } - }) -} - -func (m publicreportNotifyEmailNuisanceMods) WithEmailAddressEmailContact(rel *CommsEmailContactTemplate) PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(ctx context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - o.r.EmailAddressEmailContact = &publicreportNotifyEmailNuisanceREmailAddressEmailContactR{ - o: rel, - } - }) -} - -func (m publicreportNotifyEmailNuisanceMods) WithNewEmailAddressEmailContact(mods ...CommsEmailContactMod) PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(ctx context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - related := o.f.NewCommsEmailContactWithContext(ctx, mods...) - - m.WithEmailAddressEmailContact(related).Apply(ctx, o) - }) -} - -func (m publicreportNotifyEmailNuisanceMods) WithExistingEmailAddressEmailContact(em *models.CommsEmailContact) PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(ctx context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - o.r.EmailAddressEmailContact = &publicreportNotifyEmailNuisanceREmailAddressEmailContactR{ - o: o.f.FromExistingCommsEmailContact(em), - } - }) -} - -func (m publicreportNotifyEmailNuisanceMods) WithoutEmailAddressEmailContact() PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(ctx context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - o.r.EmailAddressEmailContact = nil - }) -} - -func (m publicreportNotifyEmailNuisanceMods) WithNuisance(rel *PublicreportNuisanceTemplate) PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(ctx context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - o.r.Nuisance = &publicreportNotifyEmailNuisanceRNuisanceR{ - o: rel, - } - }) -} - -func (m publicreportNotifyEmailNuisanceMods) WithNewNuisance(mods ...PublicreportNuisanceMod) PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(ctx context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - related := o.f.NewPublicreportNuisanceWithContext(ctx, mods...) - - m.WithNuisance(related).Apply(ctx, o) - }) -} - -func (m publicreportNotifyEmailNuisanceMods) WithExistingNuisance(em *models.PublicreportNuisance) PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(ctx context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - o.r.Nuisance = &publicreportNotifyEmailNuisanceRNuisanceR{ - o: o.f.FromExistingPublicreportNuisance(em), - } - }) -} - -func (m publicreportNotifyEmailNuisanceMods) WithoutNuisance() PublicreportNotifyEmailNuisanceMod { - return PublicreportNotifyEmailNuisanceModFunc(func(ctx context.Context, o *PublicreportNotifyEmailNuisanceTemplate) { - o.r.Nuisance = nil - }) -} diff --git a/db/factory/publicreport.notify_email_pool.bob.go b/db/factory/publicreport.notify_email_pool.bob.go deleted file mode 100644 index 2ac525a5..00000000 --- a/db/factory/publicreport.notify_email_pool.bob.go +++ /dev/null @@ -1,542 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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" -) - -type PublicreportNotifyEmailPoolMod interface { - Apply(context.Context, *PublicreportNotifyEmailPoolTemplate) -} - -type PublicreportNotifyEmailPoolModFunc func(context.Context, *PublicreportNotifyEmailPoolTemplate) - -func (f PublicreportNotifyEmailPoolModFunc) Apply(ctx context.Context, n *PublicreportNotifyEmailPoolTemplate) { - f(ctx, n) -} - -type PublicreportNotifyEmailPoolModSlice []PublicreportNotifyEmailPoolMod - -func (mods PublicreportNotifyEmailPoolModSlice) Apply(ctx context.Context, n *PublicreportNotifyEmailPoolTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// PublicreportNotifyEmailPoolTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type PublicreportNotifyEmailPoolTemplate struct { - Created func() time.Time - Deleted func() null.Val[time.Time] - PoolID func() int32 - EmailAddress func() string - - r publicreportNotifyEmailPoolR - f *Factory - - alreadyPersisted bool -} - -type publicreportNotifyEmailPoolR struct { - EmailAddressEmailContact *publicreportNotifyEmailPoolREmailAddressEmailContactR - Pool *publicreportNotifyEmailPoolRPoolR -} - -type publicreportNotifyEmailPoolREmailAddressEmailContactR struct { - o *CommsEmailContactTemplate -} -type publicreportNotifyEmailPoolRPoolR struct { - o *PublicreportPoolTemplate -} - -// Apply mods to the PublicreportNotifyEmailPoolTemplate -func (o *PublicreportNotifyEmailPoolTemplate) Apply(ctx context.Context, mods ...PublicreportNotifyEmailPoolMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.PublicreportNotifyEmailPool -// according to the relationships in the template. Nothing is inserted into the db -func (t PublicreportNotifyEmailPoolTemplate) setModelRels(o *models.PublicreportNotifyEmailPool) { - if t.r.EmailAddressEmailContact != nil { - rel := t.r.EmailAddressEmailContact.o.Build() - rel.R.EmailAddressNotifyEmailPools = append(rel.R.EmailAddressNotifyEmailPools, o) - o.EmailAddress = rel.Address // h2 - o.R.EmailAddressEmailContact = rel - } - - if t.r.Pool != nil { - rel := t.r.Pool.o.Build() - rel.R.NotifyEmailPools = append(rel.R.NotifyEmailPools, o) - o.PoolID = rel.ID // h2 - o.R.Pool = rel - } -} - -// BuildSetter returns an *models.PublicreportNotifyEmailPoolSetter -// this does nothing with the relationship templates -func (o PublicreportNotifyEmailPoolTemplate) BuildSetter() *models.PublicreportNotifyEmailPoolSetter { - m := &models.PublicreportNotifyEmailPoolSetter{} - - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.Deleted != nil { - val := o.Deleted() - m.Deleted = omitnull.FromNull(val) - } - if o.PoolID != nil { - val := o.PoolID() - m.PoolID = omit.From(val) - } - if o.EmailAddress != nil { - val := o.EmailAddress() - m.EmailAddress = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.PublicreportNotifyEmailPoolSetter -// this does nothing with the relationship templates -func (o PublicreportNotifyEmailPoolTemplate) BuildManySetter(number int) []*models.PublicreportNotifyEmailPoolSetter { - m := make([]*models.PublicreportNotifyEmailPoolSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.PublicreportNotifyEmailPool -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportNotifyEmailPoolTemplate.Create -func (o PublicreportNotifyEmailPoolTemplate) Build() *models.PublicreportNotifyEmailPool { - m := &models.PublicreportNotifyEmailPool{} - - if o.Created != nil { - m.Created = o.Created() - } - if o.Deleted != nil { - m.Deleted = o.Deleted() - } - if o.PoolID != nil { - m.PoolID = o.PoolID() - } - if o.EmailAddress != nil { - m.EmailAddress = o.EmailAddress() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.PublicreportNotifyEmailPoolSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportNotifyEmailPoolTemplate.CreateMany -func (o PublicreportNotifyEmailPoolTemplate) BuildMany(number int) models.PublicreportNotifyEmailPoolSlice { - m := make(models.PublicreportNotifyEmailPoolSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatablePublicreportNotifyEmailPool(m *models.PublicreportNotifyEmailPoolSetter) { - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.PoolID.IsValue()) { - val := random_int32(nil) - m.PoolID = omit.From(val) - } - if !(m.EmailAddress.IsValue()) { - val := random_string(nil) - m.EmailAddress = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.PublicreportNotifyEmailPool -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *PublicreportNotifyEmailPoolTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.PublicreportNotifyEmailPool) error { - var err error - - return err -} - -// Create builds a publicreportNotifyEmailPool and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *PublicreportNotifyEmailPoolTemplate) Create(ctx context.Context, exec bob.Executor) (*models.PublicreportNotifyEmailPool, error) { - var err error - opt := o.BuildSetter() - ensureCreatablePublicreportNotifyEmailPool(opt) - - if o.r.EmailAddressEmailContact == nil { - PublicreportNotifyEmailPoolMods.WithNewEmailAddressEmailContact().Apply(ctx, o) - } - - var rel0 *models.CommsEmailContact - - if o.r.EmailAddressEmailContact.o.alreadyPersisted { - rel0 = o.r.EmailAddressEmailContact.o.Build() - } else { - rel0, err = o.r.EmailAddressEmailContact.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.EmailAddress = omit.From(rel0.Address) - - if o.r.Pool == nil { - PublicreportNotifyEmailPoolMods.WithNewPool().Apply(ctx, o) - } - - var rel1 *models.PublicreportPool - - if o.r.Pool.o.alreadyPersisted { - rel1 = o.r.Pool.o.Build() - } else { - rel1, err = o.r.Pool.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.PoolID = omit.From(rel1.ID) - - m, err := models.PublicreportNotifyEmailPools.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.EmailAddressEmailContact = rel0 - m.R.Pool = rel1 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a publicreportNotifyEmailPool and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *PublicreportNotifyEmailPoolTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.PublicreportNotifyEmailPool { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a publicreportNotifyEmailPool 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 *PublicreportNotifyEmailPoolTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.PublicreportNotifyEmailPool { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple publicreportNotifyEmailPools and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o PublicreportNotifyEmailPoolTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.PublicreportNotifyEmailPoolSlice, error) { - var err error - m := make(models.PublicreportNotifyEmailPoolSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple publicreportNotifyEmailPools and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o PublicreportNotifyEmailPoolTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.PublicreportNotifyEmailPoolSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple publicreportNotifyEmailPools 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 PublicreportNotifyEmailPoolTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.PublicreportNotifyEmailPoolSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// PublicreportNotifyEmailPool has methods that act as mods for the PublicreportNotifyEmailPoolTemplate -var PublicreportNotifyEmailPoolMods publicreportNotifyEmailPoolMods - -type publicreportNotifyEmailPoolMods struct{} - -func (m publicreportNotifyEmailPoolMods) RandomizeAllColumns(f *faker.Faker) PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModSlice{ - PublicreportNotifyEmailPoolMods.RandomCreated(f), - PublicreportNotifyEmailPoolMods.RandomDeleted(f), - PublicreportNotifyEmailPoolMods.RandomPoolID(f), - PublicreportNotifyEmailPoolMods.RandomEmailAddress(f), - } -} - -// Set the model columns to this value -func (m publicreportNotifyEmailPoolMods) Created(val time.Time) PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(_ context.Context, o *PublicreportNotifyEmailPoolTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m publicreportNotifyEmailPoolMods) CreatedFunc(f func() time.Time) PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(_ context.Context, o *PublicreportNotifyEmailPoolTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m publicreportNotifyEmailPoolMods) UnsetCreated() PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(_ context.Context, o *PublicreportNotifyEmailPoolTemplate) { - 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 publicreportNotifyEmailPoolMods) RandomCreated(f *faker.Faker) PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(_ context.Context, o *PublicreportNotifyEmailPoolTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNotifyEmailPoolMods) Deleted(val null.Val[time.Time]) PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(_ context.Context, o *PublicreportNotifyEmailPoolTemplate) { - o.Deleted = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m publicreportNotifyEmailPoolMods) DeletedFunc(f func() null.Val[time.Time]) PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(_ context.Context, o *PublicreportNotifyEmailPoolTemplate) { - o.Deleted = f - }) -} - -// Clear any values for the column -func (m publicreportNotifyEmailPoolMods) UnsetDeleted() PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(_ context.Context, o *PublicreportNotifyEmailPoolTemplate) { - 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 publicreportNotifyEmailPoolMods) RandomDeleted(f *faker.Faker) PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(_ context.Context, o *PublicreportNotifyEmailPoolTemplate) { - 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 publicreportNotifyEmailPoolMods) RandomDeletedNotNull(f *faker.Faker) PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(_ context.Context, o *PublicreportNotifyEmailPoolTemplate) { - 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 publicreportNotifyEmailPoolMods) PoolID(val int32) PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(_ context.Context, o *PublicreportNotifyEmailPoolTemplate) { - o.PoolID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportNotifyEmailPoolMods) PoolIDFunc(f func() int32) PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(_ context.Context, o *PublicreportNotifyEmailPoolTemplate) { - o.PoolID = f - }) -} - -// Clear any values for the column -func (m publicreportNotifyEmailPoolMods) UnsetPoolID() PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(_ context.Context, o *PublicreportNotifyEmailPoolTemplate) { - o.PoolID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNotifyEmailPoolMods) RandomPoolID(f *faker.Faker) PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(_ context.Context, o *PublicreportNotifyEmailPoolTemplate) { - o.PoolID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNotifyEmailPoolMods) EmailAddress(val string) PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(_ context.Context, o *PublicreportNotifyEmailPoolTemplate) { - o.EmailAddress = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportNotifyEmailPoolMods) EmailAddressFunc(f func() string) PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(_ context.Context, o *PublicreportNotifyEmailPoolTemplate) { - o.EmailAddress = f - }) -} - -// Clear any values for the column -func (m publicreportNotifyEmailPoolMods) UnsetEmailAddress() PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(_ context.Context, o *PublicreportNotifyEmailPoolTemplate) { - o.EmailAddress = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNotifyEmailPoolMods) RandomEmailAddress(f *faker.Faker) PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(_ context.Context, o *PublicreportNotifyEmailPoolTemplate) { - o.EmailAddress = func() string { - return random_string(f) - } - }) -} - -func (m publicreportNotifyEmailPoolMods) WithParentsCascading() PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(ctx context.Context, o *PublicreportNotifyEmailPoolTemplate) { - if isDone, _ := publicreportNotifyEmailPoolWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = publicreportNotifyEmailPoolWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewCommsEmailContactWithContext(ctx, CommsEmailContactMods.WithParentsCascading()) - m.WithEmailAddressEmailContact(related).Apply(ctx, o) - } - { - - related := o.f.NewPublicreportPoolWithContext(ctx, PublicreportPoolMods.WithParentsCascading()) - m.WithPool(related).Apply(ctx, o) - } - }) -} - -func (m publicreportNotifyEmailPoolMods) WithEmailAddressEmailContact(rel *CommsEmailContactTemplate) PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(ctx context.Context, o *PublicreportNotifyEmailPoolTemplate) { - o.r.EmailAddressEmailContact = &publicreportNotifyEmailPoolREmailAddressEmailContactR{ - o: rel, - } - }) -} - -func (m publicreportNotifyEmailPoolMods) WithNewEmailAddressEmailContact(mods ...CommsEmailContactMod) PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(ctx context.Context, o *PublicreportNotifyEmailPoolTemplate) { - related := o.f.NewCommsEmailContactWithContext(ctx, mods...) - - m.WithEmailAddressEmailContact(related).Apply(ctx, o) - }) -} - -func (m publicreportNotifyEmailPoolMods) WithExistingEmailAddressEmailContact(em *models.CommsEmailContact) PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(ctx context.Context, o *PublicreportNotifyEmailPoolTemplate) { - o.r.EmailAddressEmailContact = &publicreportNotifyEmailPoolREmailAddressEmailContactR{ - o: o.f.FromExistingCommsEmailContact(em), - } - }) -} - -func (m publicreportNotifyEmailPoolMods) WithoutEmailAddressEmailContact() PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(ctx context.Context, o *PublicreportNotifyEmailPoolTemplate) { - o.r.EmailAddressEmailContact = nil - }) -} - -func (m publicreportNotifyEmailPoolMods) WithPool(rel *PublicreportPoolTemplate) PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(ctx context.Context, o *PublicreportNotifyEmailPoolTemplate) { - o.r.Pool = &publicreportNotifyEmailPoolRPoolR{ - o: rel, - } - }) -} - -func (m publicreportNotifyEmailPoolMods) WithNewPool(mods ...PublicreportPoolMod) PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(ctx context.Context, o *PublicreportNotifyEmailPoolTemplate) { - related := o.f.NewPublicreportPoolWithContext(ctx, mods...) - - m.WithPool(related).Apply(ctx, o) - }) -} - -func (m publicreportNotifyEmailPoolMods) WithExistingPool(em *models.PublicreportPool) PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(ctx context.Context, o *PublicreportNotifyEmailPoolTemplate) { - o.r.Pool = &publicreportNotifyEmailPoolRPoolR{ - o: o.f.FromExistingPublicreportPool(em), - } - }) -} - -func (m publicreportNotifyEmailPoolMods) WithoutPool() PublicreportNotifyEmailPoolMod { - return PublicreportNotifyEmailPoolModFunc(func(ctx context.Context, o *PublicreportNotifyEmailPoolTemplate) { - o.r.Pool = nil - }) -} diff --git a/db/factory/publicreport.notify_phone_nuisance.bob.go b/db/factory/publicreport.notify_phone_nuisance.bob.go deleted file mode 100644 index 00518c70..00000000 --- a/db/factory/publicreport.notify_phone_nuisance.bob.go +++ /dev/null @@ -1,542 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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" -) - -type PublicreportNotifyPhoneNuisanceMod interface { - Apply(context.Context, *PublicreportNotifyPhoneNuisanceTemplate) -} - -type PublicreportNotifyPhoneNuisanceModFunc func(context.Context, *PublicreportNotifyPhoneNuisanceTemplate) - -func (f PublicreportNotifyPhoneNuisanceModFunc) Apply(ctx context.Context, n *PublicreportNotifyPhoneNuisanceTemplate) { - f(ctx, n) -} - -type PublicreportNotifyPhoneNuisanceModSlice []PublicreportNotifyPhoneNuisanceMod - -func (mods PublicreportNotifyPhoneNuisanceModSlice) Apply(ctx context.Context, n *PublicreportNotifyPhoneNuisanceTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// PublicreportNotifyPhoneNuisanceTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type PublicreportNotifyPhoneNuisanceTemplate struct { - Created func() time.Time - Deleted func() null.Val[time.Time] - NuisanceID func() int32 - PhoneE164 func() string - - r publicreportNotifyPhoneNuisanceR - f *Factory - - alreadyPersisted bool -} - -type publicreportNotifyPhoneNuisanceR struct { - Nuisance *publicreportNotifyPhoneNuisanceRNuisanceR - PhoneE164Phone *publicreportNotifyPhoneNuisanceRPhoneE164PhoneR -} - -type publicreportNotifyPhoneNuisanceRNuisanceR struct { - o *PublicreportNuisanceTemplate -} -type publicreportNotifyPhoneNuisanceRPhoneE164PhoneR struct { - o *CommsPhoneTemplate -} - -// Apply mods to the PublicreportNotifyPhoneNuisanceTemplate -func (o *PublicreportNotifyPhoneNuisanceTemplate) Apply(ctx context.Context, mods ...PublicreportNotifyPhoneNuisanceMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.PublicreportNotifyPhoneNuisance -// according to the relationships in the template. Nothing is inserted into the db -func (t PublicreportNotifyPhoneNuisanceTemplate) setModelRels(o *models.PublicreportNotifyPhoneNuisance) { - if t.r.Nuisance != nil { - rel := t.r.Nuisance.o.Build() - rel.R.NotifyPhoneNuisances = append(rel.R.NotifyPhoneNuisances, o) - o.NuisanceID = rel.ID // h2 - o.R.Nuisance = rel - } - - if t.r.PhoneE164Phone != nil { - rel := t.r.PhoneE164Phone.o.Build() - rel.R.PhoneE164NotifyPhoneNuisances = append(rel.R.PhoneE164NotifyPhoneNuisances, o) - o.PhoneE164 = rel.E164 // h2 - o.R.PhoneE164Phone = rel - } -} - -// BuildSetter returns an *models.PublicreportNotifyPhoneNuisanceSetter -// this does nothing with the relationship templates -func (o PublicreportNotifyPhoneNuisanceTemplate) BuildSetter() *models.PublicreportNotifyPhoneNuisanceSetter { - m := &models.PublicreportNotifyPhoneNuisanceSetter{} - - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.Deleted != nil { - val := o.Deleted() - m.Deleted = omitnull.FromNull(val) - } - if o.NuisanceID != nil { - val := o.NuisanceID() - m.NuisanceID = omit.From(val) - } - if o.PhoneE164 != nil { - val := o.PhoneE164() - m.PhoneE164 = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.PublicreportNotifyPhoneNuisanceSetter -// this does nothing with the relationship templates -func (o PublicreportNotifyPhoneNuisanceTemplate) BuildManySetter(number int) []*models.PublicreportNotifyPhoneNuisanceSetter { - m := make([]*models.PublicreportNotifyPhoneNuisanceSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.PublicreportNotifyPhoneNuisance -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportNotifyPhoneNuisanceTemplate.Create -func (o PublicreportNotifyPhoneNuisanceTemplate) Build() *models.PublicreportNotifyPhoneNuisance { - m := &models.PublicreportNotifyPhoneNuisance{} - - if o.Created != nil { - m.Created = o.Created() - } - if o.Deleted != nil { - m.Deleted = o.Deleted() - } - if o.NuisanceID != nil { - m.NuisanceID = o.NuisanceID() - } - if o.PhoneE164 != nil { - m.PhoneE164 = o.PhoneE164() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.PublicreportNotifyPhoneNuisanceSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportNotifyPhoneNuisanceTemplate.CreateMany -func (o PublicreportNotifyPhoneNuisanceTemplate) BuildMany(number int) models.PublicreportNotifyPhoneNuisanceSlice { - m := make(models.PublicreportNotifyPhoneNuisanceSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatablePublicreportNotifyPhoneNuisance(m *models.PublicreportNotifyPhoneNuisanceSetter) { - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.NuisanceID.IsValue()) { - val := random_int32(nil) - m.NuisanceID = omit.From(val) - } - if !(m.PhoneE164.IsValue()) { - val := random_string(nil) - m.PhoneE164 = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.PublicreportNotifyPhoneNuisance -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *PublicreportNotifyPhoneNuisanceTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.PublicreportNotifyPhoneNuisance) error { - var err error - - return err -} - -// Create builds a publicreportNotifyPhoneNuisance and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *PublicreportNotifyPhoneNuisanceTemplate) Create(ctx context.Context, exec bob.Executor) (*models.PublicreportNotifyPhoneNuisance, error) { - var err error - opt := o.BuildSetter() - ensureCreatablePublicreportNotifyPhoneNuisance(opt) - - if o.r.Nuisance == nil { - PublicreportNotifyPhoneNuisanceMods.WithNewNuisance().Apply(ctx, o) - } - - var rel0 *models.PublicreportNuisance - - if o.r.Nuisance.o.alreadyPersisted { - rel0 = o.r.Nuisance.o.Build() - } else { - rel0, err = o.r.Nuisance.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.NuisanceID = omit.From(rel0.ID) - - if o.r.PhoneE164Phone == nil { - PublicreportNotifyPhoneNuisanceMods.WithNewPhoneE164Phone().Apply(ctx, o) - } - - var rel1 *models.CommsPhone - - if o.r.PhoneE164Phone.o.alreadyPersisted { - rel1 = o.r.PhoneE164Phone.o.Build() - } else { - rel1, err = o.r.PhoneE164Phone.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.PhoneE164 = omit.From(rel1.E164) - - m, err := models.PublicreportNotifyPhoneNuisances.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.Nuisance = rel0 - m.R.PhoneE164Phone = rel1 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a publicreportNotifyPhoneNuisance and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *PublicreportNotifyPhoneNuisanceTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.PublicreportNotifyPhoneNuisance { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a publicreportNotifyPhoneNuisance 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 *PublicreportNotifyPhoneNuisanceTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.PublicreportNotifyPhoneNuisance { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple publicreportNotifyPhoneNuisances and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o PublicreportNotifyPhoneNuisanceTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.PublicreportNotifyPhoneNuisanceSlice, error) { - var err error - m := make(models.PublicreportNotifyPhoneNuisanceSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple publicreportNotifyPhoneNuisances and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o PublicreportNotifyPhoneNuisanceTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.PublicreportNotifyPhoneNuisanceSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple publicreportNotifyPhoneNuisances 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 PublicreportNotifyPhoneNuisanceTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.PublicreportNotifyPhoneNuisanceSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// PublicreportNotifyPhoneNuisance has methods that act as mods for the PublicreportNotifyPhoneNuisanceTemplate -var PublicreportNotifyPhoneNuisanceMods publicreportNotifyPhoneNuisanceMods - -type publicreportNotifyPhoneNuisanceMods struct{} - -func (m publicreportNotifyPhoneNuisanceMods) RandomizeAllColumns(f *faker.Faker) PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModSlice{ - PublicreportNotifyPhoneNuisanceMods.RandomCreated(f), - PublicreportNotifyPhoneNuisanceMods.RandomDeleted(f), - PublicreportNotifyPhoneNuisanceMods.RandomNuisanceID(f), - PublicreportNotifyPhoneNuisanceMods.RandomPhoneE164(f), - } -} - -// Set the model columns to this value -func (m publicreportNotifyPhoneNuisanceMods) Created(val time.Time) PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m publicreportNotifyPhoneNuisanceMods) CreatedFunc(f func() time.Time) PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m publicreportNotifyPhoneNuisanceMods) UnsetCreated() PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - 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 publicreportNotifyPhoneNuisanceMods) RandomCreated(f *faker.Faker) PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNotifyPhoneNuisanceMods) Deleted(val null.Val[time.Time]) PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - o.Deleted = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m publicreportNotifyPhoneNuisanceMods) DeletedFunc(f func() null.Val[time.Time]) PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - o.Deleted = f - }) -} - -// Clear any values for the column -func (m publicreportNotifyPhoneNuisanceMods) UnsetDeleted() PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - 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 publicreportNotifyPhoneNuisanceMods) RandomDeleted(f *faker.Faker) PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - 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 publicreportNotifyPhoneNuisanceMods) RandomDeletedNotNull(f *faker.Faker) PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - 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 publicreportNotifyPhoneNuisanceMods) NuisanceID(val int32) PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - o.NuisanceID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportNotifyPhoneNuisanceMods) NuisanceIDFunc(f func() int32) PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - o.NuisanceID = f - }) -} - -// Clear any values for the column -func (m publicreportNotifyPhoneNuisanceMods) UnsetNuisanceID() PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - o.NuisanceID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNotifyPhoneNuisanceMods) RandomNuisanceID(f *faker.Faker) PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - o.NuisanceID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNotifyPhoneNuisanceMods) PhoneE164(val string) PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - o.PhoneE164 = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportNotifyPhoneNuisanceMods) PhoneE164Func(f func() string) PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - o.PhoneE164 = f - }) -} - -// Clear any values for the column -func (m publicreportNotifyPhoneNuisanceMods) UnsetPhoneE164() PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - o.PhoneE164 = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNotifyPhoneNuisanceMods) RandomPhoneE164(f *faker.Faker) PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(_ context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - o.PhoneE164 = func() string { - return random_string(f) - } - }) -} - -func (m publicreportNotifyPhoneNuisanceMods) WithParentsCascading() PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(ctx context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - if isDone, _ := publicreportNotifyPhoneNuisanceWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = publicreportNotifyPhoneNuisanceWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewPublicreportNuisanceWithContext(ctx, PublicreportNuisanceMods.WithParentsCascading()) - m.WithNuisance(related).Apply(ctx, o) - } - { - - related := o.f.NewCommsPhoneWithContext(ctx, CommsPhoneMods.WithParentsCascading()) - m.WithPhoneE164Phone(related).Apply(ctx, o) - } - }) -} - -func (m publicreportNotifyPhoneNuisanceMods) WithNuisance(rel *PublicreportNuisanceTemplate) PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(ctx context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - o.r.Nuisance = &publicreportNotifyPhoneNuisanceRNuisanceR{ - o: rel, - } - }) -} - -func (m publicreportNotifyPhoneNuisanceMods) WithNewNuisance(mods ...PublicreportNuisanceMod) PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(ctx context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - related := o.f.NewPublicreportNuisanceWithContext(ctx, mods...) - - m.WithNuisance(related).Apply(ctx, o) - }) -} - -func (m publicreportNotifyPhoneNuisanceMods) WithExistingNuisance(em *models.PublicreportNuisance) PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(ctx context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - o.r.Nuisance = &publicreportNotifyPhoneNuisanceRNuisanceR{ - o: o.f.FromExistingPublicreportNuisance(em), - } - }) -} - -func (m publicreportNotifyPhoneNuisanceMods) WithoutNuisance() PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(ctx context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - o.r.Nuisance = nil - }) -} - -func (m publicreportNotifyPhoneNuisanceMods) WithPhoneE164Phone(rel *CommsPhoneTemplate) PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(ctx context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - o.r.PhoneE164Phone = &publicreportNotifyPhoneNuisanceRPhoneE164PhoneR{ - o: rel, - } - }) -} - -func (m publicreportNotifyPhoneNuisanceMods) WithNewPhoneE164Phone(mods ...CommsPhoneMod) PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(ctx context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - related := o.f.NewCommsPhoneWithContext(ctx, mods...) - - m.WithPhoneE164Phone(related).Apply(ctx, o) - }) -} - -func (m publicreportNotifyPhoneNuisanceMods) WithExistingPhoneE164Phone(em *models.CommsPhone) PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(ctx context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - o.r.PhoneE164Phone = &publicreportNotifyPhoneNuisanceRPhoneE164PhoneR{ - o: o.f.FromExistingCommsPhone(em), - } - }) -} - -func (m publicreportNotifyPhoneNuisanceMods) WithoutPhoneE164Phone() PublicreportNotifyPhoneNuisanceMod { - return PublicreportNotifyPhoneNuisanceModFunc(func(ctx context.Context, o *PublicreportNotifyPhoneNuisanceTemplate) { - o.r.PhoneE164Phone = nil - }) -} diff --git a/db/factory/publicreport.notify_phone_pool.bob.go b/db/factory/publicreport.notify_phone_pool.bob.go deleted file mode 100644 index 8a04f117..00000000 --- a/db/factory/publicreport.notify_phone_pool.bob.go +++ /dev/null @@ -1,542 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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" -) - -type PublicreportNotifyPhonePoolMod interface { - Apply(context.Context, *PublicreportNotifyPhonePoolTemplate) -} - -type PublicreportNotifyPhonePoolModFunc func(context.Context, *PublicreportNotifyPhonePoolTemplate) - -func (f PublicreportNotifyPhonePoolModFunc) Apply(ctx context.Context, n *PublicreportNotifyPhonePoolTemplate) { - f(ctx, n) -} - -type PublicreportNotifyPhonePoolModSlice []PublicreportNotifyPhonePoolMod - -func (mods PublicreportNotifyPhonePoolModSlice) Apply(ctx context.Context, n *PublicreportNotifyPhonePoolTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// PublicreportNotifyPhonePoolTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type PublicreportNotifyPhonePoolTemplate struct { - Created func() time.Time - Deleted func() null.Val[time.Time] - PhoneE164 func() string - PoolID func() int32 - - r publicreportNotifyPhonePoolR - f *Factory - - alreadyPersisted bool -} - -type publicreportNotifyPhonePoolR struct { - PhoneE164Phone *publicreportNotifyPhonePoolRPhoneE164PhoneR - Pool *publicreportNotifyPhonePoolRPoolR -} - -type publicreportNotifyPhonePoolRPhoneE164PhoneR struct { - o *CommsPhoneTemplate -} -type publicreportNotifyPhonePoolRPoolR struct { - o *PublicreportPoolTemplate -} - -// Apply mods to the PublicreportNotifyPhonePoolTemplate -func (o *PublicreportNotifyPhonePoolTemplate) Apply(ctx context.Context, mods ...PublicreportNotifyPhonePoolMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.PublicreportNotifyPhonePool -// according to the relationships in the template. Nothing is inserted into the db -func (t PublicreportNotifyPhonePoolTemplate) setModelRels(o *models.PublicreportNotifyPhonePool) { - if t.r.PhoneE164Phone != nil { - rel := t.r.PhoneE164Phone.o.Build() - rel.R.PhoneE164NotifyPhonePools = append(rel.R.PhoneE164NotifyPhonePools, o) - o.PhoneE164 = rel.E164 // h2 - o.R.PhoneE164Phone = rel - } - - if t.r.Pool != nil { - rel := t.r.Pool.o.Build() - rel.R.NotifyPhonePools = append(rel.R.NotifyPhonePools, o) - o.PoolID = rel.ID // h2 - o.R.Pool = rel - } -} - -// BuildSetter returns an *models.PublicreportNotifyPhonePoolSetter -// this does nothing with the relationship templates -func (o PublicreportNotifyPhonePoolTemplate) BuildSetter() *models.PublicreportNotifyPhonePoolSetter { - m := &models.PublicreportNotifyPhonePoolSetter{} - - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.Deleted != nil { - val := o.Deleted() - m.Deleted = omitnull.FromNull(val) - } - if o.PhoneE164 != nil { - val := o.PhoneE164() - m.PhoneE164 = omit.From(val) - } - if o.PoolID != nil { - val := o.PoolID() - m.PoolID = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.PublicreportNotifyPhonePoolSetter -// this does nothing with the relationship templates -func (o PublicreportNotifyPhonePoolTemplate) BuildManySetter(number int) []*models.PublicreportNotifyPhonePoolSetter { - m := make([]*models.PublicreportNotifyPhonePoolSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.PublicreportNotifyPhonePool -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportNotifyPhonePoolTemplate.Create -func (o PublicreportNotifyPhonePoolTemplate) Build() *models.PublicreportNotifyPhonePool { - m := &models.PublicreportNotifyPhonePool{} - - if o.Created != nil { - m.Created = o.Created() - } - if o.Deleted != nil { - m.Deleted = o.Deleted() - } - if o.PhoneE164 != nil { - m.PhoneE164 = o.PhoneE164() - } - if o.PoolID != nil { - m.PoolID = o.PoolID() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.PublicreportNotifyPhonePoolSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportNotifyPhonePoolTemplate.CreateMany -func (o PublicreportNotifyPhonePoolTemplate) BuildMany(number int) models.PublicreportNotifyPhonePoolSlice { - m := make(models.PublicreportNotifyPhonePoolSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatablePublicreportNotifyPhonePool(m *models.PublicreportNotifyPhonePoolSetter) { - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.PhoneE164.IsValue()) { - val := random_string(nil) - m.PhoneE164 = omit.From(val) - } - if !(m.PoolID.IsValue()) { - val := random_int32(nil) - m.PoolID = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.PublicreportNotifyPhonePool -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *PublicreportNotifyPhonePoolTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.PublicreportNotifyPhonePool) error { - var err error - - return err -} - -// Create builds a publicreportNotifyPhonePool and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *PublicreportNotifyPhonePoolTemplate) Create(ctx context.Context, exec bob.Executor) (*models.PublicreportNotifyPhonePool, error) { - var err error - opt := o.BuildSetter() - ensureCreatablePublicreportNotifyPhonePool(opt) - - if o.r.PhoneE164Phone == nil { - PublicreportNotifyPhonePoolMods.WithNewPhoneE164Phone().Apply(ctx, o) - } - - var rel0 *models.CommsPhone - - if o.r.PhoneE164Phone.o.alreadyPersisted { - rel0 = o.r.PhoneE164Phone.o.Build() - } else { - rel0, err = o.r.PhoneE164Phone.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.PhoneE164 = omit.From(rel0.E164) - - if o.r.Pool == nil { - PublicreportNotifyPhonePoolMods.WithNewPool().Apply(ctx, o) - } - - var rel1 *models.PublicreportPool - - if o.r.Pool.o.alreadyPersisted { - rel1 = o.r.Pool.o.Build() - } else { - rel1, err = o.r.Pool.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.PoolID = omit.From(rel1.ID) - - m, err := models.PublicreportNotifyPhonePools.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.PhoneE164Phone = rel0 - m.R.Pool = rel1 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a publicreportNotifyPhonePool and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *PublicreportNotifyPhonePoolTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.PublicreportNotifyPhonePool { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a publicreportNotifyPhonePool 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 *PublicreportNotifyPhonePoolTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.PublicreportNotifyPhonePool { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple publicreportNotifyPhonePools and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o PublicreportNotifyPhonePoolTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.PublicreportNotifyPhonePoolSlice, error) { - var err error - m := make(models.PublicreportNotifyPhonePoolSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple publicreportNotifyPhonePools and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o PublicreportNotifyPhonePoolTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.PublicreportNotifyPhonePoolSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple publicreportNotifyPhonePools 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 PublicreportNotifyPhonePoolTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.PublicreportNotifyPhonePoolSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// PublicreportNotifyPhonePool has methods that act as mods for the PublicreportNotifyPhonePoolTemplate -var PublicreportNotifyPhonePoolMods publicreportNotifyPhonePoolMods - -type publicreportNotifyPhonePoolMods struct{} - -func (m publicreportNotifyPhonePoolMods) RandomizeAllColumns(f *faker.Faker) PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModSlice{ - PublicreportNotifyPhonePoolMods.RandomCreated(f), - PublicreportNotifyPhonePoolMods.RandomDeleted(f), - PublicreportNotifyPhonePoolMods.RandomPhoneE164(f), - PublicreportNotifyPhonePoolMods.RandomPoolID(f), - } -} - -// Set the model columns to this value -func (m publicreportNotifyPhonePoolMods) Created(val time.Time) PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(_ context.Context, o *PublicreportNotifyPhonePoolTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m publicreportNotifyPhonePoolMods) CreatedFunc(f func() time.Time) PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(_ context.Context, o *PublicreportNotifyPhonePoolTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m publicreportNotifyPhonePoolMods) UnsetCreated() PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(_ context.Context, o *PublicreportNotifyPhonePoolTemplate) { - 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 publicreportNotifyPhonePoolMods) RandomCreated(f *faker.Faker) PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(_ context.Context, o *PublicreportNotifyPhonePoolTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNotifyPhonePoolMods) Deleted(val null.Val[time.Time]) PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(_ context.Context, o *PublicreportNotifyPhonePoolTemplate) { - o.Deleted = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m publicreportNotifyPhonePoolMods) DeletedFunc(f func() null.Val[time.Time]) PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(_ context.Context, o *PublicreportNotifyPhonePoolTemplate) { - o.Deleted = f - }) -} - -// Clear any values for the column -func (m publicreportNotifyPhonePoolMods) UnsetDeleted() PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(_ context.Context, o *PublicreportNotifyPhonePoolTemplate) { - 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 publicreportNotifyPhonePoolMods) RandomDeleted(f *faker.Faker) PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(_ context.Context, o *PublicreportNotifyPhonePoolTemplate) { - 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 publicreportNotifyPhonePoolMods) RandomDeletedNotNull(f *faker.Faker) PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(_ context.Context, o *PublicreportNotifyPhonePoolTemplate) { - 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 publicreportNotifyPhonePoolMods) PhoneE164(val string) PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(_ context.Context, o *PublicreportNotifyPhonePoolTemplate) { - o.PhoneE164 = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportNotifyPhonePoolMods) PhoneE164Func(f func() string) PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(_ context.Context, o *PublicreportNotifyPhonePoolTemplate) { - o.PhoneE164 = f - }) -} - -// Clear any values for the column -func (m publicreportNotifyPhonePoolMods) UnsetPhoneE164() PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(_ context.Context, o *PublicreportNotifyPhonePoolTemplate) { - o.PhoneE164 = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNotifyPhonePoolMods) RandomPhoneE164(f *faker.Faker) PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(_ context.Context, o *PublicreportNotifyPhonePoolTemplate) { - o.PhoneE164 = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNotifyPhonePoolMods) PoolID(val int32) PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(_ context.Context, o *PublicreportNotifyPhonePoolTemplate) { - o.PoolID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportNotifyPhonePoolMods) PoolIDFunc(f func() int32) PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(_ context.Context, o *PublicreportNotifyPhonePoolTemplate) { - o.PoolID = f - }) -} - -// Clear any values for the column -func (m publicreportNotifyPhonePoolMods) UnsetPoolID() PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(_ context.Context, o *PublicreportNotifyPhonePoolTemplate) { - o.PoolID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNotifyPhonePoolMods) RandomPoolID(f *faker.Faker) PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(_ context.Context, o *PublicreportNotifyPhonePoolTemplate) { - o.PoolID = func() int32 { - return random_int32(f) - } - }) -} - -func (m publicreportNotifyPhonePoolMods) WithParentsCascading() PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(ctx context.Context, o *PublicreportNotifyPhonePoolTemplate) { - if isDone, _ := publicreportNotifyPhonePoolWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = publicreportNotifyPhonePoolWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewCommsPhoneWithContext(ctx, CommsPhoneMods.WithParentsCascading()) - m.WithPhoneE164Phone(related).Apply(ctx, o) - } - { - - related := o.f.NewPublicreportPoolWithContext(ctx, PublicreportPoolMods.WithParentsCascading()) - m.WithPool(related).Apply(ctx, o) - } - }) -} - -func (m publicreportNotifyPhonePoolMods) WithPhoneE164Phone(rel *CommsPhoneTemplate) PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(ctx context.Context, o *PublicreportNotifyPhonePoolTemplate) { - o.r.PhoneE164Phone = &publicreportNotifyPhonePoolRPhoneE164PhoneR{ - o: rel, - } - }) -} - -func (m publicreportNotifyPhonePoolMods) WithNewPhoneE164Phone(mods ...CommsPhoneMod) PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(ctx context.Context, o *PublicreportNotifyPhonePoolTemplate) { - related := o.f.NewCommsPhoneWithContext(ctx, mods...) - - m.WithPhoneE164Phone(related).Apply(ctx, o) - }) -} - -func (m publicreportNotifyPhonePoolMods) WithExistingPhoneE164Phone(em *models.CommsPhone) PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(ctx context.Context, o *PublicreportNotifyPhonePoolTemplate) { - o.r.PhoneE164Phone = &publicreportNotifyPhonePoolRPhoneE164PhoneR{ - o: o.f.FromExistingCommsPhone(em), - } - }) -} - -func (m publicreportNotifyPhonePoolMods) WithoutPhoneE164Phone() PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(ctx context.Context, o *PublicreportNotifyPhonePoolTemplate) { - o.r.PhoneE164Phone = nil - }) -} - -func (m publicreportNotifyPhonePoolMods) WithPool(rel *PublicreportPoolTemplate) PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(ctx context.Context, o *PublicreportNotifyPhonePoolTemplate) { - o.r.Pool = &publicreportNotifyPhonePoolRPoolR{ - o: rel, - } - }) -} - -func (m publicreportNotifyPhonePoolMods) WithNewPool(mods ...PublicreportPoolMod) PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(ctx context.Context, o *PublicreportNotifyPhonePoolTemplate) { - related := o.f.NewPublicreportPoolWithContext(ctx, mods...) - - m.WithPool(related).Apply(ctx, o) - }) -} - -func (m publicreportNotifyPhonePoolMods) WithExistingPool(em *models.PublicreportPool) PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(ctx context.Context, o *PublicreportNotifyPhonePoolTemplate) { - o.r.Pool = &publicreportNotifyPhonePoolRPoolR{ - o: o.f.FromExistingPublicreportPool(em), - } - }) -} - -func (m publicreportNotifyPhonePoolMods) WithoutPool() PublicreportNotifyPhonePoolMod { - return PublicreportNotifyPhonePoolModFunc(func(ctx context.Context, o *PublicreportNotifyPhonePoolTemplate) { - o.r.Pool = nil - }) -} diff --git a/db/factory/publicreport.nuisance.bob.go b/db/factory/publicreport.nuisance.bob.go deleted file mode 100644 index c3b3152d..00000000 --- a/db/factory/publicreport.nuisance.bob.go +++ /dev/null @@ -1,2204 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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/jaswdr/faker/v2" -) - -type PublicreportNuisanceMod interface { - Apply(context.Context, *PublicreportNuisanceTemplate) -} - -type PublicreportNuisanceModFunc func(context.Context, *PublicreportNuisanceTemplate) - -func (f PublicreportNuisanceModFunc) Apply(ctx context.Context, n *PublicreportNuisanceTemplate) { - f(ctx, n) -} - -type PublicreportNuisanceModSlice []PublicreportNuisanceMod - -func (mods PublicreportNuisanceModSlice) Apply(ctx context.Context, n *PublicreportNuisanceTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// PublicreportNuisanceTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type PublicreportNuisanceTemplate struct { - ID func() int32 - AdditionalInfo func() string - Created func() time.Time - Duration func() enums.PublicreportNuisancedurationtype - SourceContainer func() bool - SourceDescription func() string - SourceStagnant func() bool - PublicID func() string - ReporterEmail func() null.Val[string] - ReporterName func() null.Val[string] - ReporterPhone func() null.Val[string] - Address func() string - Location func() null.Val[string] - Status func() enums.PublicreportReportstatustype - OrganizationID func() null.Val[int32] - SourceGutter func() bool - H3cell func() null.Val[string] - AddressCountry func() string - AddressPlace func() string - AddressPostcode func() string - AddressRegion func() string - AddressStreet func() string - IsLocationBackyard func() bool - IsLocationFrontyard func() bool - IsLocationGarden func() bool - IsLocationOther func() bool - IsLocationPool func() bool - MapZoom func() float32 - TodEarly func() bool - TodDay func() bool - TodEvening func() bool - TodNight func() bool - LatlngAccuracyType func() enums.PublicreportAccuracytype - LatlngAccuracyValue func() float32 - ReporterContactConsent func() null.Val[bool] - - r publicreportNuisanceR - f *Factory - - alreadyPersisted bool -} - -type publicreportNuisanceR struct { - NotifyEmailNuisances []*publicreportNuisanceRNotifyEmailNuisancesR - NotifyPhoneNuisances []*publicreportNuisanceRNotifyPhoneNuisancesR - Organization *publicreportNuisanceROrganizationR - Images []*publicreportNuisanceRImagesR -} - -type publicreportNuisanceRNotifyEmailNuisancesR struct { - number int - o *PublicreportNotifyEmailNuisanceTemplate -} -type publicreportNuisanceRNotifyPhoneNuisancesR struct { - number int - o *PublicreportNotifyPhoneNuisanceTemplate -} -type publicreportNuisanceROrganizationR struct { - o *OrganizationTemplate -} -type publicreportNuisanceRImagesR struct { - number int - o *PublicreportImageTemplate -} - -// Apply mods to the PublicreportNuisanceTemplate -func (o *PublicreportNuisanceTemplate) Apply(ctx context.Context, mods ...PublicreportNuisanceMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.PublicreportNuisance -// according to the relationships in the template. Nothing is inserted into the db -func (t PublicreportNuisanceTemplate) setModelRels(o *models.PublicreportNuisance) { - if t.r.NotifyEmailNuisances != nil { - rel := models.PublicreportNotifyEmailNuisanceSlice{} - for _, r := range t.r.NotifyEmailNuisances { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.NuisanceID = o.ID // h2 - rel.R.Nuisance = o - } - rel = append(rel, related...) - } - o.R.NotifyEmailNuisances = rel - } - - if t.r.NotifyPhoneNuisances != nil { - rel := models.PublicreportNotifyPhoneNuisanceSlice{} - for _, r := range t.r.NotifyPhoneNuisances { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.NuisanceID = o.ID // h2 - rel.R.Nuisance = o - } - rel = append(rel, related...) - } - o.R.NotifyPhoneNuisances = rel - } - - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.Nuisances = append(rel.R.Nuisances, o) - o.OrganizationID = null.From(rel.ID) // h2 - o.R.Organization = rel - } - - if t.r.Images != nil { - rel := models.PublicreportImageSlice{} - for _, r := range t.r.Images { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.R.Nuisances = append(rel.R.Nuisances, o) - } - rel = append(rel, related...) - } - o.R.Images = rel - } -} - -// BuildSetter returns an *models.PublicreportNuisanceSetter -// this does nothing with the relationship templates -func (o PublicreportNuisanceTemplate) BuildSetter() *models.PublicreportNuisanceSetter { - m := &models.PublicreportNuisanceSetter{} - - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.AdditionalInfo != nil { - val := o.AdditionalInfo() - m.AdditionalInfo = omit.From(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.Duration != nil { - val := o.Duration() - m.Duration = omit.From(val) - } - if o.SourceContainer != nil { - val := o.SourceContainer() - m.SourceContainer = omit.From(val) - } - if o.SourceDescription != nil { - val := o.SourceDescription() - m.SourceDescription = omit.From(val) - } - if o.SourceStagnant != nil { - val := o.SourceStagnant() - m.SourceStagnant = omit.From(val) - } - if o.PublicID != nil { - val := o.PublicID() - m.PublicID = omit.From(val) - } - if o.ReporterEmail != nil { - val := o.ReporterEmail() - m.ReporterEmail = omitnull.FromNull(val) - } - if o.ReporterName != nil { - val := o.ReporterName() - m.ReporterName = omitnull.FromNull(val) - } - if o.ReporterPhone != nil { - val := o.ReporterPhone() - m.ReporterPhone = omitnull.FromNull(val) - } - if o.Address != nil { - val := o.Address() - m.Address = omit.From(val) - } - if o.Location != nil { - val := o.Location() - m.Location = omitnull.FromNull(val) - } - if o.Status != nil { - val := o.Status() - m.Status = omit.From(val) - } - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) - } - if o.SourceGutter != nil { - val := o.SourceGutter() - m.SourceGutter = omit.From(val) - } - if o.H3cell != nil { - val := o.H3cell() - m.H3cell = omitnull.FromNull(val) - } - if o.AddressCountry != nil { - val := o.AddressCountry() - m.AddressCountry = omit.From(val) - } - if o.AddressPlace != nil { - val := o.AddressPlace() - m.AddressPlace = omit.From(val) - } - if o.AddressPostcode != nil { - val := o.AddressPostcode() - m.AddressPostcode = omit.From(val) - } - if o.AddressRegion != nil { - val := o.AddressRegion() - m.AddressRegion = omit.From(val) - } - if o.AddressStreet != nil { - val := o.AddressStreet() - m.AddressStreet = omit.From(val) - } - if o.IsLocationBackyard != nil { - val := o.IsLocationBackyard() - m.IsLocationBackyard = omit.From(val) - } - if o.IsLocationFrontyard != nil { - val := o.IsLocationFrontyard() - m.IsLocationFrontyard = omit.From(val) - } - if o.IsLocationGarden != nil { - val := o.IsLocationGarden() - m.IsLocationGarden = omit.From(val) - } - if o.IsLocationOther != nil { - val := o.IsLocationOther() - m.IsLocationOther = omit.From(val) - } - if o.IsLocationPool != nil { - val := o.IsLocationPool() - m.IsLocationPool = omit.From(val) - } - if o.MapZoom != nil { - val := o.MapZoom() - m.MapZoom = omit.From(val) - } - if o.TodEarly != nil { - val := o.TodEarly() - m.TodEarly = omit.From(val) - } - if o.TodDay != nil { - val := o.TodDay() - m.TodDay = omit.From(val) - } - if o.TodEvening != nil { - val := o.TodEvening() - m.TodEvening = omit.From(val) - } - if o.TodNight != nil { - val := o.TodNight() - m.TodNight = omit.From(val) - } - if o.LatlngAccuracyType != nil { - val := o.LatlngAccuracyType() - m.LatlngAccuracyType = omit.From(val) - } - if o.LatlngAccuracyValue != nil { - val := o.LatlngAccuracyValue() - m.LatlngAccuracyValue = omit.From(val) - } - if o.ReporterContactConsent != nil { - val := o.ReporterContactConsent() - m.ReporterContactConsent = omitnull.FromNull(val) - } - - return m -} - -// BuildManySetter returns an []*models.PublicreportNuisanceSetter -// this does nothing with the relationship templates -func (o PublicreportNuisanceTemplate) BuildManySetter(number int) []*models.PublicreportNuisanceSetter { - m := make([]*models.PublicreportNuisanceSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.PublicreportNuisance -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportNuisanceTemplate.Create -func (o PublicreportNuisanceTemplate) Build() *models.PublicreportNuisance { - m := &models.PublicreportNuisance{} - - if o.ID != nil { - m.ID = o.ID() - } - if o.AdditionalInfo != nil { - m.AdditionalInfo = o.AdditionalInfo() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.Duration != nil { - m.Duration = o.Duration() - } - if o.SourceContainer != nil { - m.SourceContainer = o.SourceContainer() - } - if o.SourceDescription != nil { - m.SourceDescription = o.SourceDescription() - } - if o.SourceStagnant != nil { - m.SourceStagnant = o.SourceStagnant() - } - if o.PublicID != nil { - m.PublicID = o.PublicID() - } - if o.ReporterEmail != nil { - m.ReporterEmail = o.ReporterEmail() - } - if o.ReporterName != nil { - m.ReporterName = o.ReporterName() - } - if o.ReporterPhone != nil { - m.ReporterPhone = o.ReporterPhone() - } - if o.Address != nil { - m.Address = o.Address() - } - if o.Location != nil { - m.Location = o.Location() - } - if o.Status != nil { - m.Status = o.Status() - } - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.SourceGutter != nil { - m.SourceGutter = o.SourceGutter() - } - if o.H3cell != nil { - m.H3cell = o.H3cell() - } - if o.AddressCountry != nil { - m.AddressCountry = o.AddressCountry() - } - if o.AddressPlace != nil { - m.AddressPlace = o.AddressPlace() - } - if o.AddressPostcode != nil { - m.AddressPostcode = o.AddressPostcode() - } - if o.AddressRegion != nil { - m.AddressRegion = o.AddressRegion() - } - if o.AddressStreet != nil { - m.AddressStreet = o.AddressStreet() - } - if o.IsLocationBackyard != nil { - m.IsLocationBackyard = o.IsLocationBackyard() - } - if o.IsLocationFrontyard != nil { - m.IsLocationFrontyard = o.IsLocationFrontyard() - } - if o.IsLocationGarden != nil { - m.IsLocationGarden = o.IsLocationGarden() - } - if o.IsLocationOther != nil { - m.IsLocationOther = o.IsLocationOther() - } - if o.IsLocationPool != nil { - m.IsLocationPool = o.IsLocationPool() - } - if o.MapZoom != nil { - m.MapZoom = o.MapZoom() - } - if o.TodEarly != nil { - m.TodEarly = o.TodEarly() - } - if o.TodDay != nil { - m.TodDay = o.TodDay() - } - if o.TodEvening != nil { - m.TodEvening = o.TodEvening() - } - if o.TodNight != nil { - m.TodNight = o.TodNight() - } - if o.LatlngAccuracyType != nil { - m.LatlngAccuracyType = o.LatlngAccuracyType() - } - if o.LatlngAccuracyValue != nil { - m.LatlngAccuracyValue = o.LatlngAccuracyValue() - } - if o.ReporterContactConsent != nil { - m.ReporterContactConsent = o.ReporterContactConsent() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.PublicreportNuisanceSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportNuisanceTemplate.CreateMany -func (o PublicreportNuisanceTemplate) BuildMany(number int) models.PublicreportNuisanceSlice { - m := make(models.PublicreportNuisanceSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatablePublicreportNuisance(m *models.PublicreportNuisanceSetter) { - if !(m.AdditionalInfo.IsValue()) { - val := random_string(nil) - m.AdditionalInfo = omit.From(val) - } - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.Duration.IsValue()) { - val := random_enums_PublicreportNuisancedurationtype(nil) - m.Duration = omit.From(val) - } - if !(m.SourceContainer.IsValue()) { - val := random_bool(nil) - m.SourceContainer = omit.From(val) - } - if !(m.SourceDescription.IsValue()) { - val := random_string(nil) - m.SourceDescription = omit.From(val) - } - if !(m.SourceStagnant.IsValue()) { - val := random_bool(nil) - m.SourceStagnant = omit.From(val) - } - if !(m.PublicID.IsValue()) { - val := random_string(nil) - m.PublicID = omit.From(val) - } - if !(m.Address.IsValue()) { - val := random_string(nil) - m.Address = omit.From(val) - } - if !(m.Status.IsValue()) { - val := random_enums_PublicreportReportstatustype(nil) - m.Status = omit.From(val) - } - if !(m.SourceGutter.IsValue()) { - val := random_bool(nil) - m.SourceGutter = omit.From(val) - } - if !(m.AddressCountry.IsValue()) { - val := random_string(nil) - m.AddressCountry = omit.From(val) - } - if !(m.AddressPlace.IsValue()) { - val := random_string(nil) - m.AddressPlace = omit.From(val) - } - if !(m.AddressPostcode.IsValue()) { - val := random_string(nil) - m.AddressPostcode = omit.From(val) - } - if !(m.AddressRegion.IsValue()) { - val := random_string(nil) - m.AddressRegion = omit.From(val) - } - if !(m.AddressStreet.IsValue()) { - val := random_string(nil) - m.AddressStreet = omit.From(val) - } - if !(m.IsLocationBackyard.IsValue()) { - val := random_bool(nil) - m.IsLocationBackyard = omit.From(val) - } - if !(m.IsLocationFrontyard.IsValue()) { - val := random_bool(nil) - m.IsLocationFrontyard = omit.From(val) - } - if !(m.IsLocationGarden.IsValue()) { - val := random_bool(nil) - m.IsLocationGarden = omit.From(val) - } - if !(m.IsLocationOther.IsValue()) { - val := random_bool(nil) - m.IsLocationOther = omit.From(val) - } - if !(m.IsLocationPool.IsValue()) { - val := random_bool(nil) - m.IsLocationPool = omit.From(val) - } - if !(m.MapZoom.IsValue()) { - val := random_float32(nil) - m.MapZoom = omit.From(val) - } - if !(m.TodEarly.IsValue()) { - val := random_bool(nil) - m.TodEarly = omit.From(val) - } - if !(m.TodDay.IsValue()) { - val := random_bool(nil) - m.TodDay = omit.From(val) - } - if !(m.TodEvening.IsValue()) { - val := random_bool(nil) - m.TodEvening = omit.From(val) - } - if !(m.TodNight.IsValue()) { - val := random_bool(nil) - m.TodNight = omit.From(val) - } - if !(m.LatlngAccuracyType.IsValue()) { - val := random_enums_PublicreportAccuracytype(nil) - m.LatlngAccuracyType = omit.From(val) - } - if !(m.LatlngAccuracyValue.IsValue()) { - val := random_float32(nil) - m.LatlngAccuracyValue = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.PublicreportNuisance -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *PublicreportNuisanceTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.PublicreportNuisance) error { - var err error - - isNotifyEmailNuisancesDone, _ := publicreportNuisanceRelNotifyEmailNuisancesCtx.Value(ctx) - if !isNotifyEmailNuisancesDone && o.r.NotifyEmailNuisances != nil { - ctx = publicreportNuisanceRelNotifyEmailNuisancesCtx.WithValue(ctx, true) - for _, r := range o.r.NotifyEmailNuisances { - if r.o.alreadyPersisted { - m.R.NotifyEmailNuisances = append(m.R.NotifyEmailNuisances, r.o.Build()) - } else { - rel0, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachNotifyEmailNuisances(ctx, exec, rel0...) - if err != nil { - return err - } - } - } - } - - isNotifyPhoneNuisancesDone, _ := publicreportNuisanceRelNotifyPhoneNuisancesCtx.Value(ctx) - if !isNotifyPhoneNuisancesDone && o.r.NotifyPhoneNuisances != nil { - ctx = publicreportNuisanceRelNotifyPhoneNuisancesCtx.WithValue(ctx, true) - for _, r := range o.r.NotifyPhoneNuisances { - if r.o.alreadyPersisted { - m.R.NotifyPhoneNuisances = append(m.R.NotifyPhoneNuisances, r.o.Build()) - } else { - rel1, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachNotifyPhoneNuisances(ctx, exec, rel1...) - if err != nil { - return err - } - } - } - } - - isOrganizationDone, _ := publicreportNuisanceRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = publicreportNuisanceRelOrganizationCtx.WithValue(ctx, true) - 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) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel2) - if err != nil { - return err - } - } - - } - - isImagesDone, _ := publicreportNuisanceRelImagesCtx.Value(ctx) - if !isImagesDone && o.r.Images != nil { - ctx = publicreportNuisanceRelImagesCtx.WithValue(ctx, true) - for _, r := range o.r.Images { - if r.o.alreadyPersisted { - m.R.Images = append(m.R.Images, r.o.Build()) - } else { - rel3, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachImages(ctx, exec, rel3...) - if err != nil { - return err - } - } - } - } - - return err -} - -// Create builds a publicreportNuisance and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *PublicreportNuisanceTemplate) Create(ctx context.Context, exec bob.Executor) (*models.PublicreportNuisance, error) { - var err error - opt := o.BuildSetter() - ensureCreatablePublicreportNuisance(opt) - - m, err := models.PublicreportNuisances.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a publicreportNuisance and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *PublicreportNuisanceTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.PublicreportNuisance { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a publicreportNuisance 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 *PublicreportNuisanceTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.PublicreportNuisance { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple publicreportNuisances and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o PublicreportNuisanceTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.PublicreportNuisanceSlice, error) { - var err error - m := make(models.PublicreportNuisanceSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple publicreportNuisances and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o PublicreportNuisanceTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.PublicreportNuisanceSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple publicreportNuisances 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 PublicreportNuisanceTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.PublicreportNuisanceSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// PublicreportNuisance has methods that act as mods for the PublicreportNuisanceTemplate -var PublicreportNuisanceMods publicreportNuisanceMods - -type publicreportNuisanceMods struct{} - -func (m publicreportNuisanceMods) RandomizeAllColumns(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModSlice{ - PublicreportNuisanceMods.RandomID(f), - PublicreportNuisanceMods.RandomAdditionalInfo(f), - PublicreportNuisanceMods.RandomCreated(f), - PublicreportNuisanceMods.RandomDuration(f), - PublicreportNuisanceMods.RandomSourceContainer(f), - PublicreportNuisanceMods.RandomSourceDescription(f), - PublicreportNuisanceMods.RandomSourceStagnant(f), - PublicreportNuisanceMods.RandomPublicID(f), - PublicreportNuisanceMods.RandomReporterEmail(f), - PublicreportNuisanceMods.RandomReporterName(f), - PublicreportNuisanceMods.RandomReporterPhone(f), - PublicreportNuisanceMods.RandomAddress(f), - PublicreportNuisanceMods.RandomLocation(f), - PublicreportNuisanceMods.RandomStatus(f), - PublicreportNuisanceMods.RandomOrganizationID(f), - PublicreportNuisanceMods.RandomSourceGutter(f), - PublicreportNuisanceMods.RandomH3cell(f), - PublicreportNuisanceMods.RandomAddressCountry(f), - PublicreportNuisanceMods.RandomAddressPlace(f), - PublicreportNuisanceMods.RandomAddressPostcode(f), - PublicreportNuisanceMods.RandomAddressRegion(f), - PublicreportNuisanceMods.RandomAddressStreet(f), - PublicreportNuisanceMods.RandomIsLocationBackyard(f), - PublicreportNuisanceMods.RandomIsLocationFrontyard(f), - PublicreportNuisanceMods.RandomIsLocationGarden(f), - PublicreportNuisanceMods.RandomIsLocationOther(f), - PublicreportNuisanceMods.RandomIsLocationPool(f), - PublicreportNuisanceMods.RandomMapZoom(f), - PublicreportNuisanceMods.RandomTodEarly(f), - PublicreportNuisanceMods.RandomTodDay(f), - PublicreportNuisanceMods.RandomTodEvening(f), - PublicreportNuisanceMods.RandomTodNight(f), - PublicreportNuisanceMods.RandomLatlngAccuracyType(f), - PublicreportNuisanceMods.RandomLatlngAccuracyValue(f), - PublicreportNuisanceMods.RandomReporterContactConsent(f), - } -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) ID(val int32) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) IDFunc(f func() int32) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetID() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomID(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) AdditionalInfo(val string) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AdditionalInfo = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) AdditionalInfoFunc(f func() string) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AdditionalInfo = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetAdditionalInfo() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AdditionalInfo = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomAdditionalInfo(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AdditionalInfo = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) Created(val time.Time) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) CreatedFunc(f func() time.Time) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetCreated() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - 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 publicreportNuisanceMods) RandomCreated(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) Duration(val enums.PublicreportNuisancedurationtype) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Duration = func() enums.PublicreportNuisancedurationtype { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) DurationFunc(f func() enums.PublicreportNuisancedurationtype) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Duration = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetDuration() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - 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 publicreportNuisanceMods) RandomDuration(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Duration = func() enums.PublicreportNuisancedurationtype { - return random_enums_PublicreportNuisancedurationtype(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) SourceContainer(val bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.SourceContainer = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) SourceContainerFunc(f func() bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.SourceContainer = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetSourceContainer() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.SourceContainer = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomSourceContainer(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.SourceContainer = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) SourceDescription(val string) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.SourceDescription = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) SourceDescriptionFunc(f func() string) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.SourceDescription = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetSourceDescription() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.SourceDescription = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomSourceDescription(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.SourceDescription = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) SourceStagnant(val bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.SourceStagnant = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) SourceStagnantFunc(f func() bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.SourceStagnant = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetSourceStagnant() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.SourceStagnant = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomSourceStagnant(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.SourceStagnant = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) PublicID(val string) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.PublicID = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) PublicIDFunc(f func() string) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.PublicID = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetPublicID() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.PublicID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomPublicID(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.PublicID = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) ReporterEmail(val null.Val[string]) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ReporterEmail = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) ReporterEmailFunc(f func() null.Val[string]) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ReporterEmail = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetReporterEmail() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ReporterEmail = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m publicreportNuisanceMods) RandomReporterEmail(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ReporterEmail = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m publicreportNuisanceMods) RandomReporterEmailNotNull(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ReporterEmail = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) ReporterName(val null.Val[string]) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ReporterName = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) ReporterNameFunc(f func() null.Val[string]) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ReporterName = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetReporterName() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ReporterName = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m publicreportNuisanceMods) RandomReporterName(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ReporterName = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m publicreportNuisanceMods) RandomReporterNameNotNull(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ReporterName = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) ReporterPhone(val null.Val[string]) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ReporterPhone = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) ReporterPhoneFunc(f func() null.Val[string]) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ReporterPhone = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetReporterPhone() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ReporterPhone = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m publicreportNuisanceMods) RandomReporterPhone(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ReporterPhone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m publicreportNuisanceMods) RandomReporterPhoneNotNull(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ReporterPhone = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) Address(val string) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Address = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) AddressFunc(f func() string) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Address = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetAddress() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Address = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomAddress(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Address = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) Location(val null.Val[string]) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Location = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) LocationFunc(f func() null.Val[string]) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Location = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetLocation() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Location = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m publicreportNuisanceMods) RandomLocation(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Location = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m publicreportNuisanceMods) RandomLocationNotNull(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Location = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) Status(val enums.PublicreportReportstatustype) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Status = func() enums.PublicreportReportstatustype { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) StatusFunc(f func() enums.PublicreportReportstatustype) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Status = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetStatus() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Status = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomStatus(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.Status = func() enums.PublicreportReportstatustype { - return random_enums_PublicreportReportstatustype(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) OrganizationID(val null.Val[int32]) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) OrganizationIDFunc(f func() null.Val[int32]) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetOrganizationID() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.OrganizationID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m publicreportNuisanceMods) RandomOrganizationID(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.OrganizationID = 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 publicreportNuisanceMods) RandomOrganizationIDNotNull(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.OrganizationID = 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 publicreportNuisanceMods) SourceGutter(val bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.SourceGutter = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) SourceGutterFunc(f func() bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.SourceGutter = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetSourceGutter() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.SourceGutter = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomSourceGutter(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.SourceGutter = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) H3cell(val null.Val[string]) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.H3cell = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) H3cellFunc(f func() null.Val[string]) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.H3cell = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetH3cell() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.H3cell = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m publicreportNuisanceMods) RandomH3cell(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.H3cell = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m publicreportNuisanceMods) RandomH3cellNotNull(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.H3cell = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) AddressCountry(val string) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AddressCountry = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) AddressCountryFunc(f func() string) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AddressCountry = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetAddressCountry() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AddressCountry = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomAddressCountry(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AddressCountry = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) AddressPlace(val string) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AddressPlace = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) AddressPlaceFunc(f func() string) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AddressPlace = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetAddressPlace() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AddressPlace = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomAddressPlace(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AddressPlace = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) AddressPostcode(val string) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AddressPostcode = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) AddressPostcodeFunc(f func() string) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AddressPostcode = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetAddressPostcode() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AddressPostcode = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomAddressPostcode(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AddressPostcode = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) AddressRegion(val string) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AddressRegion = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) AddressRegionFunc(f func() string) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AddressRegion = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetAddressRegion() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AddressRegion = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomAddressRegion(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AddressRegion = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) AddressStreet(val string) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AddressStreet = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) AddressStreetFunc(f func() string) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AddressStreet = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetAddressStreet() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AddressStreet = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomAddressStreet(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.AddressStreet = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) IsLocationBackyard(val bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.IsLocationBackyard = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) IsLocationBackyardFunc(f func() bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.IsLocationBackyard = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetIsLocationBackyard() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.IsLocationBackyard = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomIsLocationBackyard(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.IsLocationBackyard = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) IsLocationFrontyard(val bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.IsLocationFrontyard = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) IsLocationFrontyardFunc(f func() bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.IsLocationFrontyard = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetIsLocationFrontyard() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.IsLocationFrontyard = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomIsLocationFrontyard(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.IsLocationFrontyard = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) IsLocationGarden(val bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.IsLocationGarden = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) IsLocationGardenFunc(f func() bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.IsLocationGarden = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetIsLocationGarden() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.IsLocationGarden = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomIsLocationGarden(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.IsLocationGarden = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) IsLocationOther(val bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.IsLocationOther = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) IsLocationOtherFunc(f func() bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.IsLocationOther = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetIsLocationOther() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.IsLocationOther = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomIsLocationOther(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.IsLocationOther = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) IsLocationPool(val bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.IsLocationPool = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) IsLocationPoolFunc(f func() bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.IsLocationPool = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetIsLocationPool() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.IsLocationPool = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomIsLocationPool(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.IsLocationPool = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) MapZoom(val float32) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.MapZoom = func() float32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) MapZoomFunc(f func() float32) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.MapZoom = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetMapZoom() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.MapZoom = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomMapZoom(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.MapZoom = func() float32 { - return random_float32(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) TodEarly(val bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TodEarly = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) TodEarlyFunc(f func() bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TodEarly = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetTodEarly() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TodEarly = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomTodEarly(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TodEarly = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) TodDay(val bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TodDay = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) TodDayFunc(f func() bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TodDay = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetTodDay() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TodDay = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomTodDay(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TodDay = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) TodEvening(val bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TodEvening = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) TodEveningFunc(f func() bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TodEvening = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetTodEvening() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TodEvening = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomTodEvening(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TodEvening = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) TodNight(val bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TodNight = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) TodNightFunc(f func() bool) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TodNight = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetTodNight() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TodNight = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomTodNight(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.TodNight = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) LatlngAccuracyType(val enums.PublicreportAccuracytype) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.LatlngAccuracyType = func() enums.PublicreportAccuracytype { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) LatlngAccuracyTypeFunc(f func() enums.PublicreportAccuracytype) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.LatlngAccuracyType = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetLatlngAccuracyType() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.LatlngAccuracyType = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomLatlngAccuracyType(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.LatlngAccuracyType = func() enums.PublicreportAccuracytype { - return random_enums_PublicreportAccuracytype(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) LatlngAccuracyValue(val float32) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.LatlngAccuracyValue = func() float32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) LatlngAccuracyValueFunc(f func() float32) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.LatlngAccuracyValue = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetLatlngAccuracyValue() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.LatlngAccuracyValue = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceMods) RandomLatlngAccuracyValue(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.LatlngAccuracyValue = func() float32 { - return random_float32(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceMods) ReporterContactConsent(val null.Val[bool]) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ReporterContactConsent = func() null.Val[bool] { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceMods) ReporterContactConsentFunc(f func() null.Val[bool]) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ReporterContactConsent = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceMods) UnsetReporterContactConsent() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ReporterContactConsent = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m publicreportNuisanceMods) RandomReporterContactConsent(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ReporterContactConsent = func() null.Val[bool] { - if f == nil { - f = &defaultFaker - } - - val := random_bool(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m publicreportNuisanceMods) RandomReporterContactConsentNotNull(f *faker.Faker) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(_ context.Context, o *PublicreportNuisanceTemplate) { - o.ReporterContactConsent = func() null.Val[bool] { - if f == nil { - f = &defaultFaker - } - - val := random_bool(f) - return null.From(val) - } - }) -} - -func (m publicreportNuisanceMods) WithParentsCascading() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - if isDone, _ := publicreportNuisanceWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = publicreportNuisanceWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m publicreportNuisanceMods) WithOrganization(rel *OrganizationTemplate) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - o.r.Organization = &publicreportNuisanceROrganizationR{ - o: rel, - } - }) -} - -func (m publicreportNuisanceMods) WithNewOrganization(mods ...OrganizationMod) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m publicreportNuisanceMods) WithExistingOrganization(em *models.Organization) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - o.r.Organization = &publicreportNuisanceROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m publicreportNuisanceMods) WithoutOrganization() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - o.r.Organization = nil - }) -} - -func (m publicreportNuisanceMods) WithNotifyEmailNuisances(number int, related *PublicreportNotifyEmailNuisanceTemplate) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - o.r.NotifyEmailNuisances = []*publicreportNuisanceRNotifyEmailNuisancesR{{ - number: number, - o: related, - }} - }) -} - -func (m publicreportNuisanceMods) WithNewNotifyEmailNuisances(number int, mods ...PublicreportNotifyEmailNuisanceMod) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - related := o.f.NewPublicreportNotifyEmailNuisanceWithContext(ctx, mods...) - m.WithNotifyEmailNuisances(number, related).Apply(ctx, o) - }) -} - -func (m publicreportNuisanceMods) AddNotifyEmailNuisances(number int, related *PublicreportNotifyEmailNuisanceTemplate) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - o.r.NotifyEmailNuisances = append(o.r.NotifyEmailNuisances, &publicreportNuisanceRNotifyEmailNuisancesR{ - number: number, - o: related, - }) - }) -} - -func (m publicreportNuisanceMods) AddNewNotifyEmailNuisances(number int, mods ...PublicreportNotifyEmailNuisanceMod) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - related := o.f.NewPublicreportNotifyEmailNuisanceWithContext(ctx, mods...) - m.AddNotifyEmailNuisances(number, related).Apply(ctx, o) - }) -} - -func (m publicreportNuisanceMods) AddExistingNotifyEmailNuisances(existingModels ...*models.PublicreportNotifyEmailNuisance) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - for _, em := range existingModels { - o.r.NotifyEmailNuisances = append(o.r.NotifyEmailNuisances, &publicreportNuisanceRNotifyEmailNuisancesR{ - o: o.f.FromExistingPublicreportNotifyEmailNuisance(em), - }) - } - }) -} - -func (m publicreportNuisanceMods) WithoutNotifyEmailNuisances() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - o.r.NotifyEmailNuisances = nil - }) -} - -func (m publicreportNuisanceMods) WithNotifyPhoneNuisances(number int, related *PublicreportNotifyPhoneNuisanceTemplate) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - o.r.NotifyPhoneNuisances = []*publicreportNuisanceRNotifyPhoneNuisancesR{{ - number: number, - o: related, - }} - }) -} - -func (m publicreportNuisanceMods) WithNewNotifyPhoneNuisances(number int, mods ...PublicreportNotifyPhoneNuisanceMod) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - related := o.f.NewPublicreportNotifyPhoneNuisanceWithContext(ctx, mods...) - m.WithNotifyPhoneNuisances(number, related).Apply(ctx, o) - }) -} - -func (m publicreportNuisanceMods) AddNotifyPhoneNuisances(number int, related *PublicreportNotifyPhoneNuisanceTemplate) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - o.r.NotifyPhoneNuisances = append(o.r.NotifyPhoneNuisances, &publicreportNuisanceRNotifyPhoneNuisancesR{ - number: number, - o: related, - }) - }) -} - -func (m publicreportNuisanceMods) AddNewNotifyPhoneNuisances(number int, mods ...PublicreportNotifyPhoneNuisanceMod) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - related := o.f.NewPublicreportNotifyPhoneNuisanceWithContext(ctx, mods...) - m.AddNotifyPhoneNuisances(number, related).Apply(ctx, o) - }) -} - -func (m publicreportNuisanceMods) AddExistingNotifyPhoneNuisances(existingModels ...*models.PublicreportNotifyPhoneNuisance) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - for _, em := range existingModels { - o.r.NotifyPhoneNuisances = append(o.r.NotifyPhoneNuisances, &publicreportNuisanceRNotifyPhoneNuisancesR{ - o: o.f.FromExistingPublicreportNotifyPhoneNuisance(em), - }) - } - }) -} - -func (m publicreportNuisanceMods) WithoutNotifyPhoneNuisances() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - o.r.NotifyPhoneNuisances = nil - }) -} - -func (m publicreportNuisanceMods) WithImages(number int, related *PublicreportImageTemplate) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - o.r.Images = []*publicreportNuisanceRImagesR{{ - number: number, - o: related, - }} - }) -} - -func (m publicreportNuisanceMods) WithNewImages(number int, mods ...PublicreportImageMod) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - related := o.f.NewPublicreportImageWithContext(ctx, mods...) - m.WithImages(number, related).Apply(ctx, o) - }) -} - -func (m publicreportNuisanceMods) AddImages(number int, related *PublicreportImageTemplate) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - o.r.Images = append(o.r.Images, &publicreportNuisanceRImagesR{ - number: number, - o: related, - }) - }) -} - -func (m publicreportNuisanceMods) AddNewImages(number int, mods ...PublicreportImageMod) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - related := o.f.NewPublicreportImageWithContext(ctx, mods...) - m.AddImages(number, related).Apply(ctx, o) - }) -} - -func (m publicreportNuisanceMods) AddExistingImages(existingModels ...*models.PublicreportImage) PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - for _, em := range existingModels { - o.r.Images = append(o.r.Images, &publicreportNuisanceRImagesR{ - o: o.f.FromExistingPublicreportImage(em), - }) - } - }) -} - -func (m publicreportNuisanceMods) WithoutImages() PublicreportNuisanceMod { - return PublicreportNuisanceModFunc(func(ctx context.Context, o *PublicreportNuisanceTemplate) { - o.r.Images = nil - }) -} diff --git a/db/factory/publicreport.nuisance_image.bob.go b/db/factory/publicreport.nuisance_image.bob.go deleted file mode 100644 index 0ad1d6e5..00000000 --- a/db/factory/publicreport.nuisance_image.bob.go +++ /dev/null @@ -1,431 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/omit" - "github.com/jaswdr/faker/v2" -) - -type PublicreportNuisanceImageMod interface { - Apply(context.Context, *PublicreportNuisanceImageTemplate) -} - -type PublicreportNuisanceImageModFunc func(context.Context, *PublicreportNuisanceImageTemplate) - -func (f PublicreportNuisanceImageModFunc) Apply(ctx context.Context, n *PublicreportNuisanceImageTemplate) { - f(ctx, n) -} - -type PublicreportNuisanceImageModSlice []PublicreportNuisanceImageMod - -func (mods PublicreportNuisanceImageModSlice) Apply(ctx context.Context, n *PublicreportNuisanceImageTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// PublicreportNuisanceImageTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type PublicreportNuisanceImageTemplate struct { - ImageID func() int32 - NuisanceID func() int32 - - r publicreportNuisanceImageR - f *Factory - - alreadyPersisted bool -} - -type publicreportNuisanceImageR struct { - Image *publicreportNuisanceImageRImageR - Nuisance *publicreportNuisanceImageRNuisanceR -} - -type publicreportNuisanceImageRImageR struct { - o *PublicreportImageTemplate -} -type publicreportNuisanceImageRNuisanceR struct { - o *PublicreportNuisanceTemplate -} - -// Apply mods to the PublicreportNuisanceImageTemplate -func (o *PublicreportNuisanceImageTemplate) Apply(ctx context.Context, mods ...PublicreportNuisanceImageMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.PublicreportNuisanceImage -// according to the relationships in the template. Nothing is inserted into the db -func (t PublicreportNuisanceImageTemplate) setModelRels(o *models.PublicreportNuisanceImage) { - if t.r.Image != nil { - rel := t.r.Image.o.Build() - o.ImageID = rel.ID // h2 - o.R.Image = rel - } - - if t.r.Nuisance != nil { - rel := t.r.Nuisance.o.Build() - o.NuisanceID = rel.ID // h2 - o.R.Nuisance = rel - } -} - -// BuildSetter returns an *models.PublicreportNuisanceImageSetter -// this does nothing with the relationship templates -func (o PublicreportNuisanceImageTemplate) BuildSetter() *models.PublicreportNuisanceImageSetter { - m := &models.PublicreportNuisanceImageSetter{} - - if o.ImageID != nil { - val := o.ImageID() - m.ImageID = omit.From(val) - } - if o.NuisanceID != nil { - val := o.NuisanceID() - m.NuisanceID = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.PublicreportNuisanceImageSetter -// this does nothing with the relationship templates -func (o PublicreportNuisanceImageTemplate) BuildManySetter(number int) []*models.PublicreportNuisanceImageSetter { - m := make([]*models.PublicreportNuisanceImageSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.PublicreportNuisanceImage -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportNuisanceImageTemplate.Create -func (o PublicreportNuisanceImageTemplate) Build() *models.PublicreportNuisanceImage { - m := &models.PublicreportNuisanceImage{} - - if o.ImageID != nil { - m.ImageID = o.ImageID() - } - if o.NuisanceID != nil { - m.NuisanceID = o.NuisanceID() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.PublicreportNuisanceImageSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportNuisanceImageTemplate.CreateMany -func (o PublicreportNuisanceImageTemplate) BuildMany(number int) models.PublicreportNuisanceImageSlice { - m := make(models.PublicreportNuisanceImageSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatablePublicreportNuisanceImage(m *models.PublicreportNuisanceImageSetter) { - if !(m.ImageID.IsValue()) { - val := random_int32(nil) - m.ImageID = omit.From(val) - } - if !(m.NuisanceID.IsValue()) { - val := random_int32(nil) - m.NuisanceID = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.PublicreportNuisanceImage -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *PublicreportNuisanceImageTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.PublicreportNuisanceImage) error { - var err error - - return err -} - -// Create builds a publicreportNuisanceImage and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *PublicreportNuisanceImageTemplate) Create(ctx context.Context, exec bob.Executor) (*models.PublicreportNuisanceImage, error) { - var err error - opt := o.BuildSetter() - ensureCreatablePublicreportNuisanceImage(opt) - - if o.r.Image == nil { - PublicreportNuisanceImageMods.WithNewImage().Apply(ctx, o) - } - - var rel0 *models.PublicreportImage - - if o.r.Image.o.alreadyPersisted { - rel0 = o.r.Image.o.Build() - } else { - rel0, err = o.r.Image.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.ImageID = omit.From(rel0.ID) - - if o.r.Nuisance == nil { - PublicreportNuisanceImageMods.WithNewNuisance().Apply(ctx, o) - } - - var rel1 *models.PublicreportNuisance - - if o.r.Nuisance.o.alreadyPersisted { - rel1 = o.r.Nuisance.o.Build() - } else { - rel1, err = o.r.Nuisance.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.NuisanceID = omit.From(rel1.ID) - - m, err := models.PublicreportNuisanceImages.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.Image = rel0 - m.R.Nuisance = rel1 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a publicreportNuisanceImage and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *PublicreportNuisanceImageTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.PublicreportNuisanceImage { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a publicreportNuisanceImage 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 *PublicreportNuisanceImageTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.PublicreportNuisanceImage { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple publicreportNuisanceImages and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o PublicreportNuisanceImageTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.PublicreportNuisanceImageSlice, error) { - var err error - m := make(models.PublicreportNuisanceImageSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple publicreportNuisanceImages and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o PublicreportNuisanceImageTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.PublicreportNuisanceImageSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple publicreportNuisanceImages 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 PublicreportNuisanceImageTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.PublicreportNuisanceImageSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// PublicreportNuisanceImage has methods that act as mods for the PublicreportNuisanceImageTemplate -var PublicreportNuisanceImageMods publicreportNuisanceImageMods - -type publicreportNuisanceImageMods struct{} - -func (m publicreportNuisanceImageMods) RandomizeAllColumns(f *faker.Faker) PublicreportNuisanceImageMod { - return PublicreportNuisanceImageModSlice{ - PublicreportNuisanceImageMods.RandomImageID(f), - PublicreportNuisanceImageMods.RandomNuisanceID(f), - } -} - -// Set the model columns to this value -func (m publicreportNuisanceImageMods) ImageID(val int32) PublicreportNuisanceImageMod { - return PublicreportNuisanceImageModFunc(func(_ context.Context, o *PublicreportNuisanceImageTemplate) { - o.ImageID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceImageMods) ImageIDFunc(f func() int32) PublicreportNuisanceImageMod { - return PublicreportNuisanceImageModFunc(func(_ context.Context, o *PublicreportNuisanceImageTemplate) { - o.ImageID = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceImageMods) UnsetImageID() PublicreportNuisanceImageMod { - return PublicreportNuisanceImageModFunc(func(_ context.Context, o *PublicreportNuisanceImageTemplate) { - o.ImageID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceImageMods) RandomImageID(f *faker.Faker) PublicreportNuisanceImageMod { - return PublicreportNuisanceImageModFunc(func(_ context.Context, o *PublicreportNuisanceImageTemplate) { - o.ImageID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportNuisanceImageMods) NuisanceID(val int32) PublicreportNuisanceImageMod { - return PublicreportNuisanceImageModFunc(func(_ context.Context, o *PublicreportNuisanceImageTemplate) { - o.NuisanceID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportNuisanceImageMods) NuisanceIDFunc(f func() int32) PublicreportNuisanceImageMod { - return PublicreportNuisanceImageModFunc(func(_ context.Context, o *PublicreportNuisanceImageTemplate) { - o.NuisanceID = f - }) -} - -// Clear any values for the column -func (m publicreportNuisanceImageMods) UnsetNuisanceID() PublicreportNuisanceImageMod { - return PublicreportNuisanceImageModFunc(func(_ context.Context, o *PublicreportNuisanceImageTemplate) { - o.NuisanceID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportNuisanceImageMods) RandomNuisanceID(f *faker.Faker) PublicreportNuisanceImageMod { - return PublicreportNuisanceImageModFunc(func(_ context.Context, o *PublicreportNuisanceImageTemplate) { - o.NuisanceID = func() int32 { - return random_int32(f) - } - }) -} - -func (m publicreportNuisanceImageMods) WithParentsCascading() PublicreportNuisanceImageMod { - return PublicreportNuisanceImageModFunc(func(ctx context.Context, o *PublicreportNuisanceImageTemplate) { - if isDone, _ := publicreportNuisanceImageWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = publicreportNuisanceImageWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewPublicreportImageWithContext(ctx, PublicreportImageMods.WithParentsCascading()) - m.WithImage(related).Apply(ctx, o) - } - { - - related := o.f.NewPublicreportNuisanceWithContext(ctx, PublicreportNuisanceMods.WithParentsCascading()) - m.WithNuisance(related).Apply(ctx, o) - } - }) -} - -func (m publicreportNuisanceImageMods) WithImage(rel *PublicreportImageTemplate) PublicreportNuisanceImageMod { - return PublicreportNuisanceImageModFunc(func(ctx context.Context, o *PublicreportNuisanceImageTemplate) { - o.r.Image = &publicreportNuisanceImageRImageR{ - o: rel, - } - }) -} - -func (m publicreportNuisanceImageMods) WithNewImage(mods ...PublicreportImageMod) PublicreportNuisanceImageMod { - return PublicreportNuisanceImageModFunc(func(ctx context.Context, o *PublicreportNuisanceImageTemplate) { - related := o.f.NewPublicreportImageWithContext(ctx, mods...) - - m.WithImage(related).Apply(ctx, o) - }) -} - -func (m publicreportNuisanceImageMods) WithExistingImage(em *models.PublicreportImage) PublicreportNuisanceImageMod { - return PublicreportNuisanceImageModFunc(func(ctx context.Context, o *PublicreportNuisanceImageTemplate) { - o.r.Image = &publicreportNuisanceImageRImageR{ - o: o.f.FromExistingPublicreportImage(em), - } - }) -} - -func (m publicreportNuisanceImageMods) WithoutImage() PublicreportNuisanceImageMod { - return PublicreportNuisanceImageModFunc(func(ctx context.Context, o *PublicreportNuisanceImageTemplate) { - o.r.Image = nil - }) -} - -func (m publicreportNuisanceImageMods) WithNuisance(rel *PublicreportNuisanceTemplate) PublicreportNuisanceImageMod { - return PublicreportNuisanceImageModFunc(func(ctx context.Context, o *PublicreportNuisanceImageTemplate) { - o.r.Nuisance = &publicreportNuisanceImageRNuisanceR{ - o: rel, - } - }) -} - -func (m publicreportNuisanceImageMods) WithNewNuisance(mods ...PublicreportNuisanceMod) PublicreportNuisanceImageMod { - return PublicreportNuisanceImageModFunc(func(ctx context.Context, o *PublicreportNuisanceImageTemplate) { - related := o.f.NewPublicreportNuisanceWithContext(ctx, mods...) - - m.WithNuisance(related).Apply(ctx, o) - }) -} - -func (m publicreportNuisanceImageMods) WithExistingNuisance(em *models.PublicreportNuisance) PublicreportNuisanceImageMod { - return PublicreportNuisanceImageModFunc(func(ctx context.Context, o *PublicreportNuisanceImageTemplate) { - o.r.Nuisance = &publicreportNuisanceImageRNuisanceR{ - o: o.f.FromExistingPublicreportNuisance(em), - } - }) -} - -func (m publicreportNuisanceImageMods) WithoutNuisance() PublicreportNuisanceImageMod { - return PublicreportNuisanceImageModFunc(func(ctx context.Context, o *PublicreportNuisanceImageTemplate) { - o.r.Nuisance = nil - }) -} diff --git a/db/factory/publicreport.pool.bob.go b/db/factory/publicreport.pool.bob.go deleted file mode 100644 index 440daf57..00000000 --- a/db/factory/publicreport.pool.bob.go +++ /dev/null @@ -1,2106 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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/jaswdr/faker/v2" -) - -type PublicreportPoolMod interface { - Apply(context.Context, *PublicreportPoolTemplate) -} - -type PublicreportPoolModFunc func(context.Context, *PublicreportPoolTemplate) - -func (f PublicreportPoolModFunc) Apply(ctx context.Context, n *PublicreportPoolTemplate) { - f(ctx, n) -} - -type PublicreportPoolModSlice []PublicreportPoolMod - -func (mods PublicreportPoolModSlice) Apply(ctx context.Context, n *PublicreportPoolTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// PublicreportPoolTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type PublicreportPoolTemplate struct { - ID func() int32 - AccessComments func() string - AccessGate func() bool - AccessFence func() bool - AccessLocked func() bool - AccessDog func() bool - AccessOther func() bool - Address func() string - AddressCountry func() string - AddressPostCode func() string - AddressPlace func() string - AddressStreet func() string - AddressRegion func() string - Comments func() string - Created func() time.Time - H3cell func() null.Val[string] - HasAdult func() bool - HasLarvae func() bool - HasPupae func() bool - Location func() null.Val[string] - MapZoom func() float32 - OwnerEmail func() string - OwnerName func() string - OwnerPhone func() string - PublicID func() string - ReporterEmail func() string - ReporterName func() string - ReporterPhone func() string - Status func() enums.PublicreportReportstatustype - OrganizationID func() null.Val[int32] - HasBackyardPermission func() bool - IsReporterConfidential func() bool - IsReporterOwner func() bool - ReporterContactConsent func() null.Val[bool] - - r publicreportPoolR - f *Factory - - alreadyPersisted bool -} - -type publicreportPoolR struct { - NotifyEmailPools []*publicreportPoolRNotifyEmailPoolsR - NotifyPhonePools []*publicreportPoolRNotifyPhonePoolsR - Organization *publicreportPoolROrganizationR - Images []*publicreportPoolRImagesR -} - -type publicreportPoolRNotifyEmailPoolsR struct { - number int - o *PublicreportNotifyEmailPoolTemplate -} -type publicreportPoolRNotifyPhonePoolsR struct { - number int - o *PublicreportNotifyPhonePoolTemplate -} -type publicreportPoolROrganizationR struct { - o *OrganizationTemplate -} -type publicreportPoolRImagesR struct { - number int - o *PublicreportImageTemplate -} - -// Apply mods to the PublicreportPoolTemplate -func (o *PublicreportPoolTemplate) Apply(ctx context.Context, mods ...PublicreportPoolMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.PublicreportPool -// according to the relationships in the template. Nothing is inserted into the db -func (t PublicreportPoolTemplate) setModelRels(o *models.PublicreportPool) { - if t.r.NotifyEmailPools != nil { - rel := models.PublicreportNotifyEmailPoolSlice{} - for _, r := range t.r.NotifyEmailPools { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.PoolID = o.ID // h2 - rel.R.Pool = o - } - rel = append(rel, related...) - } - o.R.NotifyEmailPools = rel - } - - if t.r.NotifyPhonePools != nil { - rel := models.PublicreportNotifyPhonePoolSlice{} - for _, r := range t.r.NotifyPhonePools { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.PoolID = o.ID // h2 - rel.R.Pool = o - } - rel = append(rel, related...) - } - o.R.NotifyPhonePools = rel - } - - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.PublicreportPool = append(rel.R.PublicreportPool, o) - o.OrganizationID = null.From(rel.ID) // h2 - o.R.Organization = rel - } - - if t.r.Images != nil { - rel := models.PublicreportImageSlice{} - for _, r := range t.r.Images { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.R.Pools = append(rel.R.Pools, o) - } - rel = append(rel, related...) - } - o.R.Images = rel - } -} - -// BuildSetter returns an *models.PublicreportPoolSetter -// this does nothing with the relationship templates -func (o PublicreportPoolTemplate) BuildSetter() *models.PublicreportPoolSetter { - m := &models.PublicreportPoolSetter{} - - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.AccessComments != nil { - val := o.AccessComments() - m.AccessComments = omit.From(val) - } - if o.AccessGate != nil { - val := o.AccessGate() - m.AccessGate = omit.From(val) - } - if o.AccessFence != nil { - val := o.AccessFence() - m.AccessFence = omit.From(val) - } - if o.AccessLocked != nil { - val := o.AccessLocked() - m.AccessLocked = omit.From(val) - } - if o.AccessDog != nil { - val := o.AccessDog() - m.AccessDog = omit.From(val) - } - if o.AccessOther != nil { - val := o.AccessOther() - m.AccessOther = omit.From(val) - } - if o.Address != nil { - val := o.Address() - m.Address = omit.From(val) - } - if o.AddressCountry != nil { - val := o.AddressCountry() - m.AddressCountry = omit.From(val) - } - if o.AddressPostCode != nil { - val := o.AddressPostCode() - m.AddressPostCode = omit.From(val) - } - if o.AddressPlace != nil { - val := o.AddressPlace() - m.AddressPlace = omit.From(val) - } - if o.AddressStreet != nil { - val := o.AddressStreet() - m.AddressStreet = omit.From(val) - } - if o.AddressRegion != nil { - val := o.AddressRegion() - m.AddressRegion = omit.From(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omit.From(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.H3cell != nil { - val := o.H3cell() - m.H3cell = omitnull.FromNull(val) - } - if o.HasAdult != nil { - val := o.HasAdult() - m.HasAdult = omit.From(val) - } - if o.HasLarvae != nil { - val := o.HasLarvae() - m.HasLarvae = omit.From(val) - } - if o.HasPupae != nil { - val := o.HasPupae() - m.HasPupae = omit.From(val) - } - if o.Location != nil { - val := o.Location() - m.Location = omitnull.FromNull(val) - } - if o.MapZoom != nil { - val := o.MapZoom() - m.MapZoom = omit.From(val) - } - if o.OwnerEmail != nil { - val := o.OwnerEmail() - m.OwnerEmail = omit.From(val) - } - if o.OwnerName != nil { - val := o.OwnerName() - m.OwnerName = omit.From(val) - } - if o.OwnerPhone != nil { - val := o.OwnerPhone() - m.OwnerPhone = omit.From(val) - } - if o.PublicID != nil { - val := o.PublicID() - m.PublicID = omit.From(val) - } - if o.ReporterEmail != nil { - val := o.ReporterEmail() - m.ReporterEmail = omit.From(val) - } - if o.ReporterName != nil { - val := o.ReporterName() - m.ReporterName = omit.From(val) - } - if o.ReporterPhone != nil { - val := o.ReporterPhone() - m.ReporterPhone = omit.From(val) - } - if o.Status != nil { - val := o.Status() - m.Status = omit.From(val) - } - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) - } - if o.HasBackyardPermission != nil { - val := o.HasBackyardPermission() - m.HasBackyardPermission = omit.From(val) - } - if o.IsReporterConfidential != nil { - val := o.IsReporterConfidential() - m.IsReporterConfidential = omit.From(val) - } - if o.IsReporterOwner != nil { - val := o.IsReporterOwner() - m.IsReporterOwner = omit.From(val) - } - if o.ReporterContactConsent != nil { - val := o.ReporterContactConsent() - m.ReporterContactConsent = omitnull.FromNull(val) - } - - return m -} - -// BuildManySetter returns an []*models.PublicreportPoolSetter -// this does nothing with the relationship templates -func (o PublicreportPoolTemplate) BuildManySetter(number int) []*models.PublicreportPoolSetter { - m := make([]*models.PublicreportPoolSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.PublicreportPool -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportPoolTemplate.Create -func (o PublicreportPoolTemplate) Build() *models.PublicreportPool { - m := &models.PublicreportPool{} - - if o.ID != nil { - m.ID = o.ID() - } - if o.AccessComments != nil { - m.AccessComments = o.AccessComments() - } - if o.AccessGate != nil { - m.AccessGate = o.AccessGate() - } - if o.AccessFence != nil { - m.AccessFence = o.AccessFence() - } - if o.AccessLocked != nil { - m.AccessLocked = o.AccessLocked() - } - if o.AccessDog != nil { - m.AccessDog = o.AccessDog() - } - if o.AccessOther != nil { - m.AccessOther = o.AccessOther() - } - if o.Address != nil { - m.Address = o.Address() - } - if o.AddressCountry != nil { - m.AddressCountry = o.AddressCountry() - } - if o.AddressPostCode != nil { - m.AddressPostCode = o.AddressPostCode() - } - if o.AddressPlace != nil { - m.AddressPlace = o.AddressPlace() - } - if o.AddressStreet != nil { - m.AddressStreet = o.AddressStreet() - } - if o.AddressRegion != nil { - m.AddressRegion = o.AddressRegion() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.H3cell != nil { - m.H3cell = o.H3cell() - } - if o.HasAdult != nil { - m.HasAdult = o.HasAdult() - } - if o.HasLarvae != nil { - m.HasLarvae = o.HasLarvae() - } - if o.HasPupae != nil { - m.HasPupae = o.HasPupae() - } - if o.Location != nil { - m.Location = o.Location() - } - if o.MapZoom != nil { - m.MapZoom = o.MapZoom() - } - if o.OwnerEmail != nil { - m.OwnerEmail = o.OwnerEmail() - } - if o.OwnerName != nil { - m.OwnerName = o.OwnerName() - } - if o.OwnerPhone != nil { - m.OwnerPhone = o.OwnerPhone() - } - if o.PublicID != nil { - m.PublicID = o.PublicID() - } - if o.ReporterEmail != nil { - m.ReporterEmail = o.ReporterEmail() - } - if o.ReporterName != nil { - m.ReporterName = o.ReporterName() - } - if o.ReporterPhone != nil { - m.ReporterPhone = o.ReporterPhone() - } - if o.Status != nil { - m.Status = o.Status() - } - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.HasBackyardPermission != nil { - m.HasBackyardPermission = o.HasBackyardPermission() - } - if o.IsReporterConfidential != nil { - m.IsReporterConfidential = o.IsReporterConfidential() - } - if o.IsReporterOwner != nil { - m.IsReporterOwner = o.IsReporterOwner() - } - if o.ReporterContactConsent != nil { - m.ReporterContactConsent = o.ReporterContactConsent() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.PublicreportPoolSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportPoolTemplate.CreateMany -func (o PublicreportPoolTemplate) BuildMany(number int) models.PublicreportPoolSlice { - m := make(models.PublicreportPoolSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatablePublicreportPool(m *models.PublicreportPoolSetter) { - if !(m.AccessComments.IsValue()) { - val := random_string(nil) - m.AccessComments = omit.From(val) - } - if !(m.AccessGate.IsValue()) { - val := random_bool(nil) - m.AccessGate = omit.From(val) - } - if !(m.AccessFence.IsValue()) { - val := random_bool(nil) - m.AccessFence = omit.From(val) - } - if !(m.AccessLocked.IsValue()) { - val := random_bool(nil) - m.AccessLocked = omit.From(val) - } - if !(m.AccessDog.IsValue()) { - val := random_bool(nil) - m.AccessDog = omit.From(val) - } - if !(m.AccessOther.IsValue()) { - val := random_bool(nil) - m.AccessOther = omit.From(val) - } - if !(m.Address.IsValue()) { - val := random_string(nil) - m.Address = omit.From(val) - } - if !(m.AddressCountry.IsValue()) { - val := random_string(nil) - m.AddressCountry = omit.From(val) - } - if !(m.AddressPostCode.IsValue()) { - val := random_string(nil) - m.AddressPostCode = omit.From(val) - } - if !(m.AddressPlace.IsValue()) { - val := random_string(nil) - m.AddressPlace = omit.From(val) - } - if !(m.AddressStreet.IsValue()) { - val := random_string(nil) - m.AddressStreet = omit.From(val) - } - if !(m.AddressRegion.IsValue()) { - val := random_string(nil) - m.AddressRegion = omit.From(val) - } - if !(m.Comments.IsValue()) { - val := random_string(nil) - m.Comments = omit.From(val) - } - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.HasAdult.IsValue()) { - val := random_bool(nil) - m.HasAdult = omit.From(val) - } - if !(m.HasLarvae.IsValue()) { - val := random_bool(nil) - m.HasLarvae = omit.From(val) - } - if !(m.HasPupae.IsValue()) { - val := random_bool(nil) - m.HasPupae = omit.From(val) - } - if !(m.MapZoom.IsValue()) { - val := random_float32(nil) - m.MapZoom = omit.From(val) - } - if !(m.OwnerEmail.IsValue()) { - val := random_string(nil) - m.OwnerEmail = omit.From(val) - } - if !(m.OwnerName.IsValue()) { - val := random_string(nil) - m.OwnerName = omit.From(val) - } - if !(m.OwnerPhone.IsValue()) { - val := random_string(nil) - m.OwnerPhone = omit.From(val) - } - if !(m.PublicID.IsValue()) { - val := random_string(nil) - m.PublicID = omit.From(val) - } - if !(m.ReporterEmail.IsValue()) { - val := random_string(nil) - m.ReporterEmail = omit.From(val) - } - if !(m.ReporterName.IsValue()) { - val := random_string(nil) - m.ReporterName = omit.From(val) - } - if !(m.ReporterPhone.IsValue()) { - val := random_string(nil) - m.ReporterPhone = omit.From(val) - } - if !(m.Status.IsValue()) { - val := random_enums_PublicreportReportstatustype(nil) - m.Status = omit.From(val) - } - if !(m.HasBackyardPermission.IsValue()) { - val := random_bool(nil) - m.HasBackyardPermission = omit.From(val) - } - if !(m.IsReporterConfidential.IsValue()) { - val := random_bool(nil) - m.IsReporterConfidential = omit.From(val) - } - if !(m.IsReporterOwner.IsValue()) { - val := random_bool(nil) - m.IsReporterOwner = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.PublicreportPool -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *PublicreportPoolTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.PublicreportPool) error { - var err error - - isNotifyEmailPoolsDone, _ := publicreportPoolRelNotifyEmailPoolsCtx.Value(ctx) - if !isNotifyEmailPoolsDone && o.r.NotifyEmailPools != nil { - ctx = publicreportPoolRelNotifyEmailPoolsCtx.WithValue(ctx, true) - for _, r := range o.r.NotifyEmailPools { - if r.o.alreadyPersisted { - m.R.NotifyEmailPools = append(m.R.NotifyEmailPools, r.o.Build()) - } else { - rel0, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachNotifyEmailPools(ctx, exec, rel0...) - if err != nil { - return err - } - } - } - } - - isNotifyPhonePoolsDone, _ := publicreportPoolRelNotifyPhonePoolsCtx.Value(ctx) - if !isNotifyPhonePoolsDone && o.r.NotifyPhonePools != nil { - ctx = publicreportPoolRelNotifyPhonePoolsCtx.WithValue(ctx, true) - for _, r := range o.r.NotifyPhonePools { - if r.o.alreadyPersisted { - m.R.NotifyPhonePools = append(m.R.NotifyPhonePools, r.o.Build()) - } else { - rel1, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachNotifyPhonePools(ctx, exec, rel1...) - if err != nil { - return err - } - } - } - } - - isOrganizationDone, _ := publicreportPoolRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = publicreportPoolRelOrganizationCtx.WithValue(ctx, true) - 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) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel2) - if err != nil { - return err - } - } - - } - - isImagesDone, _ := publicreportPoolRelImagesCtx.Value(ctx) - if !isImagesDone && o.r.Images != nil { - ctx = publicreportPoolRelImagesCtx.WithValue(ctx, true) - for _, r := range o.r.Images { - if r.o.alreadyPersisted { - m.R.Images = append(m.R.Images, r.o.Build()) - } else { - rel3, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachImages(ctx, exec, rel3...) - if err != nil { - return err - } - } - } - } - - return err -} - -// Create builds a publicreportPool and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *PublicreportPoolTemplate) Create(ctx context.Context, exec bob.Executor) (*models.PublicreportPool, error) { - var err error - opt := o.BuildSetter() - ensureCreatablePublicreportPool(opt) - - m, err := models.PublicreportPools.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a publicreportPool and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *PublicreportPoolTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.PublicreportPool { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a publicreportPool 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 *PublicreportPoolTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.PublicreportPool { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple publicreportPools and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o PublicreportPoolTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.PublicreportPoolSlice, error) { - var err error - m := make(models.PublicreportPoolSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple publicreportPools and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o PublicreportPoolTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.PublicreportPoolSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple publicreportPools 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 PublicreportPoolTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.PublicreportPoolSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// PublicreportPool has methods that act as mods for the PublicreportPoolTemplate -var PublicreportPoolMods publicreportPoolMods - -type publicreportPoolMods struct{} - -func (m publicreportPoolMods) RandomizeAllColumns(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModSlice{ - PublicreportPoolMods.RandomID(f), - PublicreportPoolMods.RandomAccessComments(f), - PublicreportPoolMods.RandomAccessGate(f), - PublicreportPoolMods.RandomAccessFence(f), - PublicreportPoolMods.RandomAccessLocked(f), - PublicreportPoolMods.RandomAccessDog(f), - PublicreportPoolMods.RandomAccessOther(f), - PublicreportPoolMods.RandomAddress(f), - PublicreportPoolMods.RandomAddressCountry(f), - PublicreportPoolMods.RandomAddressPostCode(f), - PublicreportPoolMods.RandomAddressPlace(f), - PublicreportPoolMods.RandomAddressStreet(f), - PublicreportPoolMods.RandomAddressRegion(f), - PublicreportPoolMods.RandomComments(f), - PublicreportPoolMods.RandomCreated(f), - PublicreportPoolMods.RandomH3cell(f), - PublicreportPoolMods.RandomHasAdult(f), - PublicreportPoolMods.RandomHasLarvae(f), - PublicreportPoolMods.RandomHasPupae(f), - PublicreportPoolMods.RandomLocation(f), - PublicreportPoolMods.RandomMapZoom(f), - PublicreportPoolMods.RandomOwnerEmail(f), - PublicreportPoolMods.RandomOwnerName(f), - PublicreportPoolMods.RandomOwnerPhone(f), - PublicreportPoolMods.RandomPublicID(f), - PublicreportPoolMods.RandomReporterEmail(f), - PublicreportPoolMods.RandomReporterName(f), - PublicreportPoolMods.RandomReporterPhone(f), - PublicreportPoolMods.RandomStatus(f), - PublicreportPoolMods.RandomOrganizationID(f), - PublicreportPoolMods.RandomHasBackyardPermission(f), - PublicreportPoolMods.RandomIsReporterConfidential(f), - PublicreportPoolMods.RandomIsReporterOwner(f), - PublicreportPoolMods.RandomReporterContactConsent(f), - } -} - -// Set the model columns to this value -func (m publicreportPoolMods) ID(val int32) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) IDFunc(f func() int32) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetID() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomID(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) AccessComments(val string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessComments = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) AccessCommentsFunc(f func() string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessComments = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetAccessComments() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessComments = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomAccessComments(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessComments = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) AccessGate(val bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessGate = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) AccessGateFunc(f func() bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessGate = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetAccessGate() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessGate = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomAccessGate(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessGate = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) AccessFence(val bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessFence = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) AccessFenceFunc(f func() bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessFence = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetAccessFence() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessFence = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomAccessFence(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessFence = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) AccessLocked(val bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessLocked = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) AccessLockedFunc(f func() bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessLocked = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetAccessLocked() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessLocked = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomAccessLocked(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessLocked = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) AccessDog(val bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessDog = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) AccessDogFunc(f func() bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessDog = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetAccessDog() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessDog = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomAccessDog(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessDog = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) AccessOther(val bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessOther = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) AccessOtherFunc(f func() bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessOther = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetAccessOther() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessOther = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomAccessOther(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AccessOther = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) Address(val string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.Address = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) AddressFunc(f func() string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.Address = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetAddress() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.Address = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomAddress(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.Address = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) AddressCountry(val string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AddressCountry = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) AddressCountryFunc(f func() string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AddressCountry = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetAddressCountry() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AddressCountry = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomAddressCountry(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AddressCountry = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) AddressPostCode(val string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AddressPostCode = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) AddressPostCodeFunc(f func() string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AddressPostCode = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetAddressPostCode() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AddressPostCode = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomAddressPostCode(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AddressPostCode = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) AddressPlace(val string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AddressPlace = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) AddressPlaceFunc(f func() string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AddressPlace = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetAddressPlace() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AddressPlace = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomAddressPlace(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AddressPlace = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) AddressStreet(val string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AddressStreet = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) AddressStreetFunc(f func() string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AddressStreet = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetAddressStreet() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AddressStreet = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomAddressStreet(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AddressStreet = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) AddressRegion(val string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AddressRegion = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) AddressRegionFunc(f func() string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AddressRegion = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetAddressRegion() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AddressRegion = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomAddressRegion(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.AddressRegion = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) Comments(val string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.Comments = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) CommentsFunc(f func() string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetComments() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.Comments = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomComments(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.Comments = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) Created(val time.Time) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) CreatedFunc(f func() time.Time) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetCreated() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - 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 publicreportPoolMods) RandomCreated(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) H3cell(val null.Val[string]) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.H3cell = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) H3cellFunc(f func() null.Val[string]) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.H3cell = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetH3cell() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.H3cell = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m publicreportPoolMods) RandomH3cell(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.H3cell = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m publicreportPoolMods) RandomH3cellNotNull(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.H3cell = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) HasAdult(val bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.HasAdult = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) HasAdultFunc(f func() bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.HasAdult = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetHasAdult() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.HasAdult = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomHasAdult(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.HasAdult = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) HasLarvae(val bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.HasLarvae = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) HasLarvaeFunc(f func() bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.HasLarvae = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetHasLarvae() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.HasLarvae = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomHasLarvae(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.HasLarvae = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) HasPupae(val bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.HasPupae = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) HasPupaeFunc(f func() bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.HasPupae = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetHasPupae() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.HasPupae = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomHasPupae(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.HasPupae = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) Location(val null.Val[string]) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.Location = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) LocationFunc(f func() null.Val[string]) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.Location = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetLocation() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.Location = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m publicreportPoolMods) RandomLocation(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.Location = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m publicreportPoolMods) RandomLocationNotNull(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.Location = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) MapZoom(val float32) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.MapZoom = func() float32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) MapZoomFunc(f func() float32) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.MapZoom = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetMapZoom() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.MapZoom = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomMapZoom(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.MapZoom = func() float32 { - return random_float32(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) OwnerEmail(val string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.OwnerEmail = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) OwnerEmailFunc(f func() string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.OwnerEmail = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetOwnerEmail() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.OwnerEmail = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomOwnerEmail(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.OwnerEmail = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) OwnerName(val string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.OwnerName = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) OwnerNameFunc(f func() string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.OwnerName = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetOwnerName() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.OwnerName = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomOwnerName(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.OwnerName = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) OwnerPhone(val string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.OwnerPhone = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) OwnerPhoneFunc(f func() string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.OwnerPhone = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetOwnerPhone() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.OwnerPhone = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomOwnerPhone(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.OwnerPhone = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) PublicID(val string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.PublicID = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) PublicIDFunc(f func() string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.PublicID = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetPublicID() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.PublicID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomPublicID(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.PublicID = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) ReporterEmail(val string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.ReporterEmail = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) ReporterEmailFunc(f func() string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.ReporterEmail = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetReporterEmail() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.ReporterEmail = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomReporterEmail(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.ReporterEmail = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) ReporterName(val string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.ReporterName = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) ReporterNameFunc(f func() string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.ReporterName = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetReporterName() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.ReporterName = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomReporterName(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.ReporterName = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) ReporterPhone(val string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.ReporterPhone = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) ReporterPhoneFunc(f func() string) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.ReporterPhone = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetReporterPhone() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.ReporterPhone = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomReporterPhone(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.ReporterPhone = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) Status(val enums.PublicreportReportstatustype) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.Status = func() enums.PublicreportReportstatustype { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) StatusFunc(f func() enums.PublicreportReportstatustype) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.Status = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetStatus() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.Status = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomStatus(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.Status = func() enums.PublicreportReportstatustype { - return random_enums_PublicreportReportstatustype(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) OrganizationID(val null.Val[int32]) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) OrganizationIDFunc(f func() null.Val[int32]) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetOrganizationID() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.OrganizationID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m publicreportPoolMods) RandomOrganizationID(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.OrganizationID = 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 publicreportPoolMods) RandomOrganizationIDNotNull(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.OrganizationID = 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 publicreportPoolMods) HasBackyardPermission(val bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.HasBackyardPermission = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) HasBackyardPermissionFunc(f func() bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.HasBackyardPermission = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetHasBackyardPermission() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.HasBackyardPermission = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomHasBackyardPermission(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.HasBackyardPermission = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) IsReporterConfidential(val bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.IsReporterConfidential = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) IsReporterConfidentialFunc(f func() bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.IsReporterConfidential = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetIsReporterConfidential() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.IsReporterConfidential = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomIsReporterConfidential(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.IsReporterConfidential = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) IsReporterOwner(val bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.IsReporterOwner = func() bool { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) IsReporterOwnerFunc(f func() bool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.IsReporterOwner = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetIsReporterOwner() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.IsReporterOwner = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolMods) RandomIsReporterOwner(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.IsReporterOwner = func() bool { - return random_bool(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolMods) ReporterContactConsent(val null.Val[bool]) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.ReporterContactConsent = func() null.Val[bool] { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolMods) ReporterContactConsentFunc(f func() null.Val[bool]) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.ReporterContactConsent = f - }) -} - -// Clear any values for the column -func (m publicreportPoolMods) UnsetReporterContactConsent() PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.ReporterContactConsent = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m publicreportPoolMods) RandomReporterContactConsent(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.ReporterContactConsent = func() null.Val[bool] { - if f == nil { - f = &defaultFaker - } - - val := random_bool(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m publicreportPoolMods) RandomReporterContactConsentNotNull(f *faker.Faker) PublicreportPoolMod { - return PublicreportPoolModFunc(func(_ context.Context, o *PublicreportPoolTemplate) { - o.ReporterContactConsent = func() null.Val[bool] { - if f == nil { - f = &defaultFaker - } - - val := random_bool(f) - return null.From(val) - } - }) -} - -func (m publicreportPoolMods) WithParentsCascading() PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - if isDone, _ := publicreportPoolWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = publicreportPoolWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m publicreportPoolMods) WithOrganization(rel *OrganizationTemplate) PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - o.r.Organization = &publicreportPoolROrganizationR{ - o: rel, - } - }) -} - -func (m publicreportPoolMods) WithNewOrganization(mods ...OrganizationMod) PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m publicreportPoolMods) WithExistingOrganization(em *models.Organization) PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - o.r.Organization = &publicreportPoolROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m publicreportPoolMods) WithoutOrganization() PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - o.r.Organization = nil - }) -} - -func (m publicreportPoolMods) WithNotifyEmailPools(number int, related *PublicreportNotifyEmailPoolTemplate) PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - o.r.NotifyEmailPools = []*publicreportPoolRNotifyEmailPoolsR{{ - number: number, - o: related, - }} - }) -} - -func (m publicreportPoolMods) WithNewNotifyEmailPools(number int, mods ...PublicreportNotifyEmailPoolMod) PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - related := o.f.NewPublicreportNotifyEmailPoolWithContext(ctx, mods...) - m.WithNotifyEmailPools(number, related).Apply(ctx, o) - }) -} - -func (m publicreportPoolMods) AddNotifyEmailPools(number int, related *PublicreportNotifyEmailPoolTemplate) PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - o.r.NotifyEmailPools = append(o.r.NotifyEmailPools, &publicreportPoolRNotifyEmailPoolsR{ - number: number, - o: related, - }) - }) -} - -func (m publicreportPoolMods) AddNewNotifyEmailPools(number int, mods ...PublicreportNotifyEmailPoolMod) PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - related := o.f.NewPublicreportNotifyEmailPoolWithContext(ctx, mods...) - m.AddNotifyEmailPools(number, related).Apply(ctx, o) - }) -} - -func (m publicreportPoolMods) AddExistingNotifyEmailPools(existingModels ...*models.PublicreportNotifyEmailPool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - for _, em := range existingModels { - o.r.NotifyEmailPools = append(o.r.NotifyEmailPools, &publicreportPoolRNotifyEmailPoolsR{ - o: o.f.FromExistingPublicreportNotifyEmailPool(em), - }) - } - }) -} - -func (m publicreportPoolMods) WithoutNotifyEmailPools() PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - o.r.NotifyEmailPools = nil - }) -} - -func (m publicreportPoolMods) WithNotifyPhonePools(number int, related *PublicreportNotifyPhonePoolTemplate) PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - o.r.NotifyPhonePools = []*publicreportPoolRNotifyPhonePoolsR{{ - number: number, - o: related, - }} - }) -} - -func (m publicreportPoolMods) WithNewNotifyPhonePools(number int, mods ...PublicreportNotifyPhonePoolMod) PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - related := o.f.NewPublicreportNotifyPhonePoolWithContext(ctx, mods...) - m.WithNotifyPhonePools(number, related).Apply(ctx, o) - }) -} - -func (m publicreportPoolMods) AddNotifyPhonePools(number int, related *PublicreportNotifyPhonePoolTemplate) PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - o.r.NotifyPhonePools = append(o.r.NotifyPhonePools, &publicreportPoolRNotifyPhonePoolsR{ - number: number, - o: related, - }) - }) -} - -func (m publicreportPoolMods) AddNewNotifyPhonePools(number int, mods ...PublicreportNotifyPhonePoolMod) PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - related := o.f.NewPublicreportNotifyPhonePoolWithContext(ctx, mods...) - m.AddNotifyPhonePools(number, related).Apply(ctx, o) - }) -} - -func (m publicreportPoolMods) AddExistingNotifyPhonePools(existingModels ...*models.PublicreportNotifyPhonePool) PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - for _, em := range existingModels { - o.r.NotifyPhonePools = append(o.r.NotifyPhonePools, &publicreportPoolRNotifyPhonePoolsR{ - o: o.f.FromExistingPublicreportNotifyPhonePool(em), - }) - } - }) -} - -func (m publicreportPoolMods) WithoutNotifyPhonePools() PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - o.r.NotifyPhonePools = nil - }) -} - -func (m publicreportPoolMods) WithImages(number int, related *PublicreportImageTemplate) PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - o.r.Images = []*publicreportPoolRImagesR{{ - number: number, - o: related, - }} - }) -} - -func (m publicreportPoolMods) WithNewImages(number int, mods ...PublicreportImageMod) PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - related := o.f.NewPublicreportImageWithContext(ctx, mods...) - m.WithImages(number, related).Apply(ctx, o) - }) -} - -func (m publicreportPoolMods) AddImages(number int, related *PublicreportImageTemplate) PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - o.r.Images = append(o.r.Images, &publicreportPoolRImagesR{ - number: number, - o: related, - }) - }) -} - -func (m publicreportPoolMods) AddNewImages(number int, mods ...PublicreportImageMod) PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - related := o.f.NewPublicreportImageWithContext(ctx, mods...) - m.AddImages(number, related).Apply(ctx, o) - }) -} - -func (m publicreportPoolMods) AddExistingImages(existingModels ...*models.PublicreportImage) PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - for _, em := range existingModels { - o.r.Images = append(o.r.Images, &publicreportPoolRImagesR{ - o: o.f.FromExistingPublicreportImage(em), - }) - } - }) -} - -func (m publicreportPoolMods) WithoutImages() PublicreportPoolMod { - return PublicreportPoolModFunc(func(ctx context.Context, o *PublicreportPoolTemplate) { - o.r.Images = nil - }) -} diff --git a/db/factory/publicreport.pool_image.bob.go b/db/factory/publicreport.pool_image.bob.go deleted file mode 100644 index ce98ed9a..00000000 --- a/db/factory/publicreport.pool_image.bob.go +++ /dev/null @@ -1,431 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/omit" - "github.com/jaswdr/faker/v2" -) - -type PublicreportPoolImageMod interface { - Apply(context.Context, *PublicreportPoolImageTemplate) -} - -type PublicreportPoolImageModFunc func(context.Context, *PublicreportPoolImageTemplate) - -func (f PublicreportPoolImageModFunc) Apply(ctx context.Context, n *PublicreportPoolImageTemplate) { - f(ctx, n) -} - -type PublicreportPoolImageModSlice []PublicreportPoolImageMod - -func (mods PublicreportPoolImageModSlice) Apply(ctx context.Context, n *PublicreportPoolImageTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// PublicreportPoolImageTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type PublicreportPoolImageTemplate struct { - ImageID func() int32 - PoolID func() int32 - - r publicreportPoolImageR - f *Factory - - alreadyPersisted bool -} - -type publicreportPoolImageR struct { - Image *publicreportPoolImageRImageR - Pool *publicreportPoolImageRPoolR -} - -type publicreportPoolImageRImageR struct { - o *PublicreportImageTemplate -} -type publicreportPoolImageRPoolR struct { - o *PublicreportPoolTemplate -} - -// Apply mods to the PublicreportPoolImageTemplate -func (o *PublicreportPoolImageTemplate) Apply(ctx context.Context, mods ...PublicreportPoolImageMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.PublicreportPoolImage -// according to the relationships in the template. Nothing is inserted into the db -func (t PublicreportPoolImageTemplate) setModelRels(o *models.PublicreportPoolImage) { - if t.r.Image != nil { - rel := t.r.Image.o.Build() - o.ImageID = rel.ID // h2 - o.R.Image = rel - } - - if t.r.Pool != nil { - rel := t.r.Pool.o.Build() - o.PoolID = rel.ID // h2 - o.R.Pool = rel - } -} - -// BuildSetter returns an *models.PublicreportPoolImageSetter -// this does nothing with the relationship templates -func (o PublicreportPoolImageTemplate) BuildSetter() *models.PublicreportPoolImageSetter { - m := &models.PublicreportPoolImageSetter{} - - if o.ImageID != nil { - val := o.ImageID() - m.ImageID = omit.From(val) - } - if o.PoolID != nil { - val := o.PoolID() - m.PoolID = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.PublicreportPoolImageSetter -// this does nothing with the relationship templates -func (o PublicreportPoolImageTemplate) BuildManySetter(number int) []*models.PublicreportPoolImageSetter { - m := make([]*models.PublicreportPoolImageSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.PublicreportPoolImage -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportPoolImageTemplate.Create -func (o PublicreportPoolImageTemplate) Build() *models.PublicreportPoolImage { - m := &models.PublicreportPoolImage{} - - if o.ImageID != nil { - m.ImageID = o.ImageID() - } - if o.PoolID != nil { - m.PoolID = o.PoolID() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.PublicreportPoolImageSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportPoolImageTemplate.CreateMany -func (o PublicreportPoolImageTemplate) BuildMany(number int) models.PublicreportPoolImageSlice { - m := make(models.PublicreportPoolImageSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatablePublicreportPoolImage(m *models.PublicreportPoolImageSetter) { - if !(m.ImageID.IsValue()) { - val := random_int32(nil) - m.ImageID = omit.From(val) - } - if !(m.PoolID.IsValue()) { - val := random_int32(nil) - m.PoolID = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.PublicreportPoolImage -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *PublicreportPoolImageTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.PublicreportPoolImage) error { - var err error - - return err -} - -// Create builds a publicreportPoolImage and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *PublicreportPoolImageTemplate) Create(ctx context.Context, exec bob.Executor) (*models.PublicreportPoolImage, error) { - var err error - opt := o.BuildSetter() - ensureCreatablePublicreportPoolImage(opt) - - if o.r.Image == nil { - PublicreportPoolImageMods.WithNewImage().Apply(ctx, o) - } - - var rel0 *models.PublicreportImage - - if o.r.Image.o.alreadyPersisted { - rel0 = o.r.Image.o.Build() - } else { - rel0, err = o.r.Image.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.ImageID = omit.From(rel0.ID) - - if o.r.Pool == nil { - PublicreportPoolImageMods.WithNewPool().Apply(ctx, o) - } - - var rel1 *models.PublicreportPool - - if o.r.Pool.o.alreadyPersisted { - rel1 = o.r.Pool.o.Build() - } else { - rel1, err = o.r.Pool.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.PoolID = omit.From(rel1.ID) - - m, err := models.PublicreportPoolImages.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.Image = rel0 - m.R.Pool = rel1 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a publicreportPoolImage and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *PublicreportPoolImageTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.PublicreportPoolImage { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a publicreportPoolImage 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 *PublicreportPoolImageTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.PublicreportPoolImage { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple publicreportPoolImages and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o PublicreportPoolImageTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.PublicreportPoolImageSlice, error) { - var err error - m := make(models.PublicreportPoolImageSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple publicreportPoolImages and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o PublicreportPoolImageTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.PublicreportPoolImageSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple publicreportPoolImages 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 PublicreportPoolImageTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.PublicreportPoolImageSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// PublicreportPoolImage has methods that act as mods for the PublicreportPoolImageTemplate -var PublicreportPoolImageMods publicreportPoolImageMods - -type publicreportPoolImageMods struct{} - -func (m publicreportPoolImageMods) RandomizeAllColumns(f *faker.Faker) PublicreportPoolImageMod { - return PublicreportPoolImageModSlice{ - PublicreportPoolImageMods.RandomImageID(f), - PublicreportPoolImageMods.RandomPoolID(f), - } -} - -// Set the model columns to this value -func (m publicreportPoolImageMods) ImageID(val int32) PublicreportPoolImageMod { - return PublicreportPoolImageModFunc(func(_ context.Context, o *PublicreportPoolImageTemplate) { - o.ImageID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolImageMods) ImageIDFunc(f func() int32) PublicreportPoolImageMod { - return PublicreportPoolImageModFunc(func(_ context.Context, o *PublicreportPoolImageTemplate) { - o.ImageID = f - }) -} - -// Clear any values for the column -func (m publicreportPoolImageMods) UnsetImageID() PublicreportPoolImageMod { - return PublicreportPoolImageModFunc(func(_ context.Context, o *PublicreportPoolImageTemplate) { - o.ImageID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolImageMods) RandomImageID(f *faker.Faker) PublicreportPoolImageMod { - return PublicreportPoolImageModFunc(func(_ context.Context, o *PublicreportPoolImageTemplate) { - o.ImageID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportPoolImageMods) PoolID(val int32) PublicreportPoolImageMod { - return PublicreportPoolImageModFunc(func(_ context.Context, o *PublicreportPoolImageTemplate) { - o.PoolID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportPoolImageMods) PoolIDFunc(f func() int32) PublicreportPoolImageMod { - return PublicreportPoolImageModFunc(func(_ context.Context, o *PublicreportPoolImageTemplate) { - o.PoolID = f - }) -} - -// Clear any values for the column -func (m publicreportPoolImageMods) UnsetPoolID() PublicreportPoolImageMod { - return PublicreportPoolImageModFunc(func(_ context.Context, o *PublicreportPoolImageTemplate) { - o.PoolID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportPoolImageMods) RandomPoolID(f *faker.Faker) PublicreportPoolImageMod { - return PublicreportPoolImageModFunc(func(_ context.Context, o *PublicreportPoolImageTemplate) { - o.PoolID = func() int32 { - return random_int32(f) - } - }) -} - -func (m publicreportPoolImageMods) WithParentsCascading() PublicreportPoolImageMod { - return PublicreportPoolImageModFunc(func(ctx context.Context, o *PublicreportPoolImageTemplate) { - if isDone, _ := publicreportPoolImageWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = publicreportPoolImageWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewPublicreportImageWithContext(ctx, PublicreportImageMods.WithParentsCascading()) - m.WithImage(related).Apply(ctx, o) - } - { - - related := o.f.NewPublicreportPoolWithContext(ctx, PublicreportPoolMods.WithParentsCascading()) - m.WithPool(related).Apply(ctx, o) - } - }) -} - -func (m publicreportPoolImageMods) WithImage(rel *PublicreportImageTemplate) PublicreportPoolImageMod { - return PublicreportPoolImageModFunc(func(ctx context.Context, o *PublicreportPoolImageTemplate) { - o.r.Image = &publicreportPoolImageRImageR{ - o: rel, - } - }) -} - -func (m publicreportPoolImageMods) WithNewImage(mods ...PublicreportImageMod) PublicreportPoolImageMod { - return PublicreportPoolImageModFunc(func(ctx context.Context, o *PublicreportPoolImageTemplate) { - related := o.f.NewPublicreportImageWithContext(ctx, mods...) - - m.WithImage(related).Apply(ctx, o) - }) -} - -func (m publicreportPoolImageMods) WithExistingImage(em *models.PublicreportImage) PublicreportPoolImageMod { - return PublicreportPoolImageModFunc(func(ctx context.Context, o *PublicreportPoolImageTemplate) { - o.r.Image = &publicreportPoolImageRImageR{ - o: o.f.FromExistingPublicreportImage(em), - } - }) -} - -func (m publicreportPoolImageMods) WithoutImage() PublicreportPoolImageMod { - return PublicreportPoolImageModFunc(func(ctx context.Context, o *PublicreportPoolImageTemplate) { - o.r.Image = nil - }) -} - -func (m publicreportPoolImageMods) WithPool(rel *PublicreportPoolTemplate) PublicreportPoolImageMod { - return PublicreportPoolImageModFunc(func(ctx context.Context, o *PublicreportPoolImageTemplate) { - o.r.Pool = &publicreportPoolImageRPoolR{ - o: rel, - } - }) -} - -func (m publicreportPoolImageMods) WithNewPool(mods ...PublicreportPoolMod) PublicreportPoolImageMod { - return PublicreportPoolImageModFunc(func(ctx context.Context, o *PublicreportPoolImageTemplate) { - related := o.f.NewPublicreportPoolWithContext(ctx, mods...) - - m.WithPool(related).Apply(ctx, o) - }) -} - -func (m publicreportPoolImageMods) WithExistingPool(em *models.PublicreportPool) PublicreportPoolImageMod { - return PublicreportPoolImageModFunc(func(ctx context.Context, o *PublicreportPoolImageTemplate) { - o.r.Pool = &publicreportPoolImageRPoolR{ - o: o.f.FromExistingPublicreportPool(em), - } - }) -} - -func (m publicreportPoolImageMods) WithoutPool() PublicreportPoolImageMod { - return PublicreportPoolImageModFunc(func(ctx context.Context, o *PublicreportPoolImageTemplate) { - o.r.Pool = nil - }) -} diff --git a/db/factory/publicreport.quick.bob.go b/db/factory/publicreport.quick.bob.go deleted file mode 100644 index 97cec339..00000000 --- a/db/factory/publicreport.quick.bob.go +++ /dev/null @@ -1,904 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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/jaswdr/faker/v2" -) - -type PublicreportQuickMod interface { - Apply(context.Context, *PublicreportQuickTemplate) -} - -type PublicreportQuickModFunc func(context.Context, *PublicreportQuickTemplate) - -func (f PublicreportQuickModFunc) Apply(ctx context.Context, n *PublicreportQuickTemplate) { - f(ctx, n) -} - -type PublicreportQuickModSlice []PublicreportQuickMod - -func (mods PublicreportQuickModSlice) Apply(ctx context.Context, n *PublicreportQuickTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// PublicreportQuickTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type PublicreportQuickTemplate struct { - ID func() int32 - Created func() time.Time - Comments func() string - Location func() null.Val[string] - H3cell func() null.Val[string] - PublicID func() string - ReporterEmail func() string - ReporterPhone func() string - Address func() string - Status func() enums.PublicreportReportstatustype - OrganizationID func() null.Val[int32] - - r publicreportQuickR - f *Factory - - alreadyPersisted bool -} - -type publicreportQuickR struct { - Organization *publicreportQuickROrganizationR - Images []*publicreportQuickRImagesR -} - -type publicreportQuickROrganizationR struct { - o *OrganizationTemplate -} -type publicreportQuickRImagesR struct { - number int - o *PublicreportImageTemplate -} - -// Apply mods to the PublicreportQuickTemplate -func (o *PublicreportQuickTemplate) Apply(ctx context.Context, mods ...PublicreportQuickMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.PublicreportQuick -// according to the relationships in the template. Nothing is inserted into the db -func (t PublicreportQuickTemplate) setModelRels(o *models.PublicreportQuick) { - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.Quicks = append(rel.R.Quicks, o) - o.OrganizationID = null.From(rel.ID) // h2 - o.R.Organization = rel - } - - if t.r.Images != nil { - rel := models.PublicreportImageSlice{} - for _, r := range t.r.Images { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.R.Quicks = append(rel.R.Quicks, o) - } - rel = append(rel, related...) - } - o.R.Images = rel - } -} - -// BuildSetter returns an *models.PublicreportQuickSetter -// this does nothing with the relationship templates -func (o PublicreportQuickTemplate) BuildSetter() *models.PublicreportQuickSetter { - m := &models.PublicreportQuickSetter{} - - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.Comments != nil { - val := o.Comments() - m.Comments = omit.From(val) - } - if o.Location != nil { - val := o.Location() - m.Location = omitnull.FromNull(val) - } - if o.H3cell != nil { - val := o.H3cell() - m.H3cell = omitnull.FromNull(val) - } - if o.PublicID != nil { - val := o.PublicID() - m.PublicID = omit.From(val) - } - if o.ReporterEmail != nil { - val := o.ReporterEmail() - m.ReporterEmail = omit.From(val) - } - if o.ReporterPhone != nil { - val := o.ReporterPhone() - m.ReporterPhone = omit.From(val) - } - if o.Address != nil { - val := o.Address() - m.Address = omit.From(val) - } - if o.Status != nil { - val := o.Status() - m.Status = omit.From(val) - } - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omitnull.FromNull(val) - } - - return m -} - -// BuildManySetter returns an []*models.PublicreportQuickSetter -// this does nothing with the relationship templates -func (o PublicreportQuickTemplate) BuildManySetter(number int) []*models.PublicreportQuickSetter { - m := make([]*models.PublicreportQuickSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.PublicreportQuick -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportQuickTemplate.Create -func (o PublicreportQuickTemplate) Build() *models.PublicreportQuick { - m := &models.PublicreportQuick{} - - if o.ID != nil { - m.ID = o.ID() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.Comments != nil { - m.Comments = o.Comments() - } - if o.Location != nil { - m.Location = o.Location() - } - if o.H3cell != nil { - m.H3cell = o.H3cell() - } - if o.PublicID != nil { - m.PublicID = o.PublicID() - } - if o.ReporterEmail != nil { - m.ReporterEmail = o.ReporterEmail() - } - if o.ReporterPhone != nil { - m.ReporterPhone = o.ReporterPhone() - } - if o.Address != nil { - m.Address = o.Address() - } - if o.Status != nil { - m.Status = o.Status() - } - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.PublicreportQuickSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportQuickTemplate.CreateMany -func (o PublicreportQuickTemplate) BuildMany(number int) models.PublicreportQuickSlice { - m := make(models.PublicreportQuickSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatablePublicreportQuick(m *models.PublicreportQuickSetter) { - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.Comments.IsValue()) { - val := random_string(nil) - m.Comments = omit.From(val) - } - if !(m.PublicID.IsValue()) { - val := random_string(nil) - m.PublicID = omit.From(val) - } - if !(m.ReporterEmail.IsValue()) { - val := random_string(nil) - m.ReporterEmail = omit.From(val) - } - if !(m.ReporterPhone.IsValue()) { - val := random_string(nil) - m.ReporterPhone = omit.From(val) - } - if !(m.Address.IsValue()) { - val := random_string(nil) - m.Address = omit.From(val) - } - if !(m.Status.IsValue()) { - val := random_enums_PublicreportReportstatustype(nil) - m.Status = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.PublicreportQuick -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *PublicreportQuickTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.PublicreportQuick) error { - var err error - - isOrganizationDone, _ := publicreportQuickRelOrganizationCtx.Value(ctx) - if !isOrganizationDone && o.r.Organization != nil { - ctx = publicreportQuickRelOrganizationCtx.WithValue(ctx, true) - if o.r.Organization.o.alreadyPersisted { - m.R.Organization = o.r.Organization.o.Build() - } else { - var rel0 *models.Organization - rel0, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachOrganization(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - - isImagesDone, _ := publicreportQuickRelImagesCtx.Value(ctx) - if !isImagesDone && o.r.Images != nil { - ctx = publicreportQuickRelImagesCtx.WithValue(ctx, true) - for _, r := range o.r.Images { - if r.o.alreadyPersisted { - m.R.Images = append(m.R.Images, r.o.Build()) - } else { - rel1, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachImages(ctx, exec, rel1...) - if err != nil { - return err - } - } - } - } - - return err -} - -// Create builds a publicreportQuick and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *PublicreportQuickTemplate) Create(ctx context.Context, exec bob.Executor) (*models.PublicreportQuick, error) { - var err error - opt := o.BuildSetter() - ensureCreatablePublicreportQuick(opt) - - m, err := models.PublicreportQuicks.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a publicreportQuick and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *PublicreportQuickTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.PublicreportQuick { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a publicreportQuick 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 *PublicreportQuickTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.PublicreportQuick { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple publicreportQuicks and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o PublicreportQuickTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.PublicreportQuickSlice, error) { - var err error - m := make(models.PublicreportQuickSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple publicreportQuicks and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o PublicreportQuickTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.PublicreportQuickSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple publicreportQuicks 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 PublicreportQuickTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.PublicreportQuickSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// PublicreportQuick has methods that act as mods for the PublicreportQuickTemplate -var PublicreportQuickMods publicreportQuickMods - -type publicreportQuickMods struct{} - -func (m publicreportQuickMods) RandomizeAllColumns(f *faker.Faker) PublicreportQuickMod { - return PublicreportQuickModSlice{ - PublicreportQuickMods.RandomID(f), - PublicreportQuickMods.RandomCreated(f), - PublicreportQuickMods.RandomComments(f), - PublicreportQuickMods.RandomLocation(f), - PublicreportQuickMods.RandomH3cell(f), - PublicreportQuickMods.RandomPublicID(f), - PublicreportQuickMods.RandomReporterEmail(f), - PublicreportQuickMods.RandomReporterPhone(f), - PublicreportQuickMods.RandomAddress(f), - PublicreportQuickMods.RandomStatus(f), - PublicreportQuickMods.RandomOrganizationID(f), - } -} - -// Set the model columns to this value -func (m publicreportQuickMods) ID(val int32) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportQuickMods) IDFunc(f func() int32) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m publicreportQuickMods) UnsetID() PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportQuickMods) RandomID(f *faker.Faker) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportQuickMods) Created(val time.Time) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m publicreportQuickMods) CreatedFunc(f func() time.Time) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m publicreportQuickMods) UnsetCreated() PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - 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 publicreportQuickMods) RandomCreated(f *faker.Faker) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportQuickMods) Comments(val string) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.Comments = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportQuickMods) CommentsFunc(f func() string) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.Comments = f - }) -} - -// Clear any values for the column -func (m publicreportQuickMods) UnsetComments() PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.Comments = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportQuickMods) RandomComments(f *faker.Faker) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.Comments = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportQuickMods) Location(val null.Val[string]) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.Location = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m publicreportQuickMods) LocationFunc(f func() null.Val[string]) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.Location = f - }) -} - -// Clear any values for the column -func (m publicreportQuickMods) UnsetLocation() PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.Location = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m publicreportQuickMods) RandomLocation(f *faker.Faker) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.Location = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m publicreportQuickMods) RandomLocationNotNull(f *faker.Faker) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.Location = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m publicreportQuickMods) H3cell(val null.Val[string]) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.H3cell = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m publicreportQuickMods) H3cellFunc(f func() null.Val[string]) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.H3cell = f - }) -} - -// Clear any values for the column -func (m publicreportQuickMods) UnsetH3cell() PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.H3cell = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m publicreportQuickMods) RandomH3cell(f *faker.Faker) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.H3cell = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m publicreportQuickMods) RandomH3cellNotNull(f *faker.Faker) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.H3cell = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m publicreportQuickMods) PublicID(val string) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.PublicID = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportQuickMods) PublicIDFunc(f func() string) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.PublicID = f - }) -} - -// Clear any values for the column -func (m publicreportQuickMods) UnsetPublicID() PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.PublicID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportQuickMods) RandomPublicID(f *faker.Faker) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.PublicID = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportQuickMods) ReporterEmail(val string) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.ReporterEmail = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportQuickMods) ReporterEmailFunc(f func() string) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.ReporterEmail = f - }) -} - -// Clear any values for the column -func (m publicreportQuickMods) UnsetReporterEmail() PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.ReporterEmail = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportQuickMods) RandomReporterEmail(f *faker.Faker) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.ReporterEmail = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportQuickMods) ReporterPhone(val string) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.ReporterPhone = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportQuickMods) ReporterPhoneFunc(f func() string) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.ReporterPhone = f - }) -} - -// Clear any values for the column -func (m publicreportQuickMods) UnsetReporterPhone() PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.ReporterPhone = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportQuickMods) RandomReporterPhone(f *faker.Faker) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.ReporterPhone = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportQuickMods) Address(val string) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.Address = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportQuickMods) AddressFunc(f func() string) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.Address = f - }) -} - -// Clear any values for the column -func (m publicreportQuickMods) UnsetAddress() PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.Address = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportQuickMods) RandomAddress(f *faker.Faker) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.Address = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportQuickMods) Status(val enums.PublicreportReportstatustype) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.Status = func() enums.PublicreportReportstatustype { return val } - }) -} - -// Set the Column from the function -func (m publicreportQuickMods) StatusFunc(f func() enums.PublicreportReportstatustype) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.Status = f - }) -} - -// Clear any values for the column -func (m publicreportQuickMods) UnsetStatus() PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.Status = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportQuickMods) RandomStatus(f *faker.Faker) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.Status = func() enums.PublicreportReportstatustype { - return random_enums_PublicreportReportstatustype(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportQuickMods) OrganizationID(val null.Val[int32]) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.OrganizationID = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m publicreportQuickMods) OrganizationIDFunc(f func() null.Val[int32]) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m publicreportQuickMods) UnsetOrganizationID() PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.OrganizationID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m publicreportQuickMods) RandomOrganizationID(f *faker.Faker) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.OrganizationID = 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 publicreportQuickMods) RandomOrganizationIDNotNull(f *faker.Faker) PublicreportQuickMod { - return PublicreportQuickModFunc(func(_ context.Context, o *PublicreportQuickTemplate) { - o.OrganizationID = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -func (m publicreportQuickMods) WithParentsCascading() PublicreportQuickMod { - return PublicreportQuickModFunc(func(ctx context.Context, o *PublicreportQuickTemplate) { - if isDone, _ := publicreportQuickWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = publicreportQuickWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m publicreportQuickMods) WithOrganization(rel *OrganizationTemplate) PublicreportQuickMod { - return PublicreportQuickModFunc(func(ctx context.Context, o *PublicreportQuickTemplate) { - o.r.Organization = &publicreportQuickROrganizationR{ - o: rel, - } - }) -} - -func (m publicreportQuickMods) WithNewOrganization(mods ...OrganizationMod) PublicreportQuickMod { - return PublicreportQuickModFunc(func(ctx context.Context, o *PublicreportQuickTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m publicreportQuickMods) WithExistingOrganization(em *models.Organization) PublicreportQuickMod { - return PublicreportQuickModFunc(func(ctx context.Context, o *PublicreportQuickTemplate) { - o.r.Organization = &publicreportQuickROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m publicreportQuickMods) WithoutOrganization() PublicreportQuickMod { - return PublicreportQuickModFunc(func(ctx context.Context, o *PublicreportQuickTemplate) { - o.r.Organization = nil - }) -} - -func (m publicreportQuickMods) WithImages(number int, related *PublicreportImageTemplate) PublicreportQuickMod { - return PublicreportQuickModFunc(func(ctx context.Context, o *PublicreportQuickTemplate) { - o.r.Images = []*publicreportQuickRImagesR{{ - number: number, - o: related, - }} - }) -} - -func (m publicreportQuickMods) WithNewImages(number int, mods ...PublicreportImageMod) PublicreportQuickMod { - return PublicreportQuickModFunc(func(ctx context.Context, o *PublicreportQuickTemplate) { - related := o.f.NewPublicreportImageWithContext(ctx, mods...) - m.WithImages(number, related).Apply(ctx, o) - }) -} - -func (m publicreportQuickMods) AddImages(number int, related *PublicreportImageTemplate) PublicreportQuickMod { - return PublicreportQuickModFunc(func(ctx context.Context, o *PublicreportQuickTemplate) { - o.r.Images = append(o.r.Images, &publicreportQuickRImagesR{ - number: number, - o: related, - }) - }) -} - -func (m publicreportQuickMods) AddNewImages(number int, mods ...PublicreportImageMod) PublicreportQuickMod { - return PublicreportQuickModFunc(func(ctx context.Context, o *PublicreportQuickTemplate) { - related := o.f.NewPublicreportImageWithContext(ctx, mods...) - m.AddImages(number, related).Apply(ctx, o) - }) -} - -func (m publicreportQuickMods) AddExistingImages(existingModels ...*models.PublicreportImage) PublicreportQuickMod { - return PublicreportQuickModFunc(func(ctx context.Context, o *PublicreportQuickTemplate) { - for _, em := range existingModels { - o.r.Images = append(o.r.Images, &publicreportQuickRImagesR{ - o: o.f.FromExistingPublicreportImage(em), - }) - } - }) -} - -func (m publicreportQuickMods) WithoutImages() PublicreportQuickMod { - return PublicreportQuickModFunc(func(ctx context.Context, o *PublicreportQuickTemplate) { - o.r.Images = nil - }) -} diff --git a/db/factory/publicreport.quick_image.bob.go b/db/factory/publicreport.quick_image.bob.go deleted file mode 100644 index 63873cbf..00000000 --- a/db/factory/publicreport.quick_image.bob.go +++ /dev/null @@ -1,431 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/omit" - "github.com/jaswdr/faker/v2" -) - -type PublicreportQuickImageMod interface { - Apply(context.Context, *PublicreportQuickImageTemplate) -} - -type PublicreportQuickImageModFunc func(context.Context, *PublicreportQuickImageTemplate) - -func (f PublicreportQuickImageModFunc) Apply(ctx context.Context, n *PublicreportQuickImageTemplate) { - f(ctx, n) -} - -type PublicreportQuickImageModSlice []PublicreportQuickImageMod - -func (mods PublicreportQuickImageModSlice) Apply(ctx context.Context, n *PublicreportQuickImageTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// PublicreportQuickImageTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type PublicreportQuickImageTemplate struct { - ImageID func() int32 - QuickID func() int32 - - r publicreportQuickImageR - f *Factory - - alreadyPersisted bool -} - -type publicreportQuickImageR struct { - Image *publicreportQuickImageRImageR - Quick *publicreportQuickImageRQuickR -} - -type publicreportQuickImageRImageR struct { - o *PublicreportImageTemplate -} -type publicreportQuickImageRQuickR struct { - o *PublicreportQuickTemplate -} - -// Apply mods to the PublicreportQuickImageTemplate -func (o *PublicreportQuickImageTemplate) Apply(ctx context.Context, mods ...PublicreportQuickImageMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.PublicreportQuickImage -// according to the relationships in the template. Nothing is inserted into the db -func (t PublicreportQuickImageTemplate) setModelRels(o *models.PublicreportQuickImage) { - if t.r.Image != nil { - rel := t.r.Image.o.Build() - o.ImageID = rel.ID // h2 - o.R.Image = rel - } - - if t.r.Quick != nil { - rel := t.r.Quick.o.Build() - o.QuickID = rel.ID // h2 - o.R.Quick = rel - } -} - -// BuildSetter returns an *models.PublicreportQuickImageSetter -// this does nothing with the relationship templates -func (o PublicreportQuickImageTemplate) BuildSetter() *models.PublicreportQuickImageSetter { - m := &models.PublicreportQuickImageSetter{} - - if o.ImageID != nil { - val := o.ImageID() - m.ImageID = omit.From(val) - } - if o.QuickID != nil { - val := o.QuickID() - m.QuickID = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.PublicreportQuickImageSetter -// this does nothing with the relationship templates -func (o PublicreportQuickImageTemplate) BuildManySetter(number int) []*models.PublicreportQuickImageSetter { - m := make([]*models.PublicreportQuickImageSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.PublicreportQuickImage -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportQuickImageTemplate.Create -func (o PublicreportQuickImageTemplate) Build() *models.PublicreportQuickImage { - m := &models.PublicreportQuickImage{} - - if o.ImageID != nil { - m.ImageID = o.ImageID() - } - if o.QuickID != nil { - m.QuickID = o.QuickID() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.PublicreportQuickImageSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportQuickImageTemplate.CreateMany -func (o PublicreportQuickImageTemplate) BuildMany(number int) models.PublicreportQuickImageSlice { - m := make(models.PublicreportQuickImageSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatablePublicreportQuickImage(m *models.PublicreportQuickImageSetter) { - if !(m.ImageID.IsValue()) { - val := random_int32(nil) - m.ImageID = omit.From(val) - } - if !(m.QuickID.IsValue()) { - val := random_int32(nil) - m.QuickID = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.PublicreportQuickImage -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *PublicreportQuickImageTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.PublicreportQuickImage) error { - var err error - - return err -} - -// Create builds a publicreportQuickImage and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *PublicreportQuickImageTemplate) Create(ctx context.Context, exec bob.Executor) (*models.PublicreportQuickImage, error) { - var err error - opt := o.BuildSetter() - ensureCreatablePublicreportQuickImage(opt) - - if o.r.Image == nil { - PublicreportQuickImageMods.WithNewImage().Apply(ctx, o) - } - - var rel0 *models.PublicreportImage - - if o.r.Image.o.alreadyPersisted { - rel0 = o.r.Image.o.Build() - } else { - rel0, err = o.r.Image.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.ImageID = omit.From(rel0.ID) - - if o.r.Quick == nil { - PublicreportQuickImageMods.WithNewQuick().Apply(ctx, o) - } - - var rel1 *models.PublicreportQuick - - if o.r.Quick.o.alreadyPersisted { - rel1 = o.r.Quick.o.Build() - } else { - rel1, err = o.r.Quick.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.QuickID = omit.From(rel1.ID) - - m, err := models.PublicreportQuickImages.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.Image = rel0 - m.R.Quick = rel1 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a publicreportQuickImage and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *PublicreportQuickImageTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.PublicreportQuickImage { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a publicreportQuickImage 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 *PublicreportQuickImageTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.PublicreportQuickImage { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple publicreportQuickImages and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o PublicreportQuickImageTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.PublicreportQuickImageSlice, error) { - var err error - m := make(models.PublicreportQuickImageSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple publicreportQuickImages and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o PublicreportQuickImageTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.PublicreportQuickImageSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple publicreportQuickImages 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 PublicreportQuickImageTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.PublicreportQuickImageSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// PublicreportQuickImage has methods that act as mods for the PublicreportQuickImageTemplate -var PublicreportQuickImageMods publicreportQuickImageMods - -type publicreportQuickImageMods struct{} - -func (m publicreportQuickImageMods) RandomizeAllColumns(f *faker.Faker) PublicreportQuickImageMod { - return PublicreportQuickImageModSlice{ - PublicreportQuickImageMods.RandomImageID(f), - PublicreportQuickImageMods.RandomQuickID(f), - } -} - -// Set the model columns to this value -func (m publicreportQuickImageMods) ImageID(val int32) PublicreportQuickImageMod { - return PublicreportQuickImageModFunc(func(_ context.Context, o *PublicreportQuickImageTemplate) { - o.ImageID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportQuickImageMods) ImageIDFunc(f func() int32) PublicreportQuickImageMod { - return PublicreportQuickImageModFunc(func(_ context.Context, o *PublicreportQuickImageTemplate) { - o.ImageID = f - }) -} - -// Clear any values for the column -func (m publicreportQuickImageMods) UnsetImageID() PublicreportQuickImageMod { - return PublicreportQuickImageModFunc(func(_ context.Context, o *PublicreportQuickImageTemplate) { - o.ImageID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportQuickImageMods) RandomImageID(f *faker.Faker) PublicreportQuickImageMod { - return PublicreportQuickImageModFunc(func(_ context.Context, o *PublicreportQuickImageTemplate) { - o.ImageID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportQuickImageMods) QuickID(val int32) PublicreportQuickImageMod { - return PublicreportQuickImageModFunc(func(_ context.Context, o *PublicreportQuickImageTemplate) { - o.QuickID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportQuickImageMods) QuickIDFunc(f func() int32) PublicreportQuickImageMod { - return PublicreportQuickImageModFunc(func(_ context.Context, o *PublicreportQuickImageTemplate) { - o.QuickID = f - }) -} - -// Clear any values for the column -func (m publicreportQuickImageMods) UnsetQuickID() PublicreportQuickImageMod { - return PublicreportQuickImageModFunc(func(_ context.Context, o *PublicreportQuickImageTemplate) { - o.QuickID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportQuickImageMods) RandomQuickID(f *faker.Faker) PublicreportQuickImageMod { - return PublicreportQuickImageModFunc(func(_ context.Context, o *PublicreportQuickImageTemplate) { - o.QuickID = func() int32 { - return random_int32(f) - } - }) -} - -func (m publicreportQuickImageMods) WithParentsCascading() PublicreportQuickImageMod { - return PublicreportQuickImageModFunc(func(ctx context.Context, o *PublicreportQuickImageTemplate) { - if isDone, _ := publicreportQuickImageWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = publicreportQuickImageWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewPublicreportImageWithContext(ctx, PublicreportImageMods.WithParentsCascading()) - m.WithImage(related).Apply(ctx, o) - } - { - - related := o.f.NewPublicreportQuickWithContext(ctx, PublicreportQuickMods.WithParentsCascading()) - m.WithQuick(related).Apply(ctx, o) - } - }) -} - -func (m publicreportQuickImageMods) WithImage(rel *PublicreportImageTemplate) PublicreportQuickImageMod { - return PublicreportQuickImageModFunc(func(ctx context.Context, o *PublicreportQuickImageTemplate) { - o.r.Image = &publicreportQuickImageRImageR{ - o: rel, - } - }) -} - -func (m publicreportQuickImageMods) WithNewImage(mods ...PublicreportImageMod) PublicreportQuickImageMod { - return PublicreportQuickImageModFunc(func(ctx context.Context, o *PublicreportQuickImageTemplate) { - related := o.f.NewPublicreportImageWithContext(ctx, mods...) - - m.WithImage(related).Apply(ctx, o) - }) -} - -func (m publicreportQuickImageMods) WithExistingImage(em *models.PublicreportImage) PublicreportQuickImageMod { - return PublicreportQuickImageModFunc(func(ctx context.Context, o *PublicreportQuickImageTemplate) { - o.r.Image = &publicreportQuickImageRImageR{ - o: o.f.FromExistingPublicreportImage(em), - } - }) -} - -func (m publicreportQuickImageMods) WithoutImage() PublicreportQuickImageMod { - return PublicreportQuickImageModFunc(func(ctx context.Context, o *PublicreportQuickImageTemplate) { - o.r.Image = nil - }) -} - -func (m publicreportQuickImageMods) WithQuick(rel *PublicreportQuickTemplate) PublicreportQuickImageMod { - return PublicreportQuickImageModFunc(func(ctx context.Context, o *PublicreportQuickImageTemplate) { - o.r.Quick = &publicreportQuickImageRQuickR{ - o: rel, - } - }) -} - -func (m publicreportQuickImageMods) WithNewQuick(mods ...PublicreportQuickMod) PublicreportQuickImageMod { - return PublicreportQuickImageModFunc(func(ctx context.Context, o *PublicreportQuickImageTemplate) { - related := o.f.NewPublicreportQuickWithContext(ctx, mods...) - - m.WithQuick(related).Apply(ctx, o) - }) -} - -func (m publicreportQuickImageMods) WithExistingQuick(em *models.PublicreportQuick) PublicreportQuickImageMod { - return PublicreportQuickImageModFunc(func(ctx context.Context, o *PublicreportQuickImageTemplate) { - o.r.Quick = &publicreportQuickImageRQuickR{ - o: o.f.FromExistingPublicreportQuick(em), - } - }) -} - -func (m publicreportQuickImageMods) WithoutQuick() PublicreportQuickImageMod { - return PublicreportQuickImageModFunc(func(ctx context.Context, o *PublicreportQuickImageTemplate) { - o.r.Quick = nil - }) -} diff --git a/db/factory/publicreport.report_location.bob.go b/db/factory/publicreport.report_location.bob.go deleted file mode 100644 index 44b0057a..00000000 --- a/db/factory/publicreport.report_location.bob.go +++ /dev/null @@ -1,502 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "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/jaswdr/faker/v2" -) - -type PublicreportReportLocationMod interface { - Apply(context.Context, *PublicreportReportLocationTemplate) -} - -type PublicreportReportLocationModFunc func(context.Context, *PublicreportReportLocationTemplate) - -func (f PublicreportReportLocationModFunc) Apply(ctx context.Context, n *PublicreportReportLocationTemplate) { - f(ctx, n) -} - -type PublicreportReportLocationModSlice []PublicreportReportLocationMod - -func (mods PublicreportReportLocationModSlice) Apply(ctx context.Context, n *PublicreportReportLocationTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// PublicreportReportLocationTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type PublicreportReportLocationTemplate struct { - ID func() null.Val[int64] - TableName func() null.Val[string] - Address func() null.Val[string] - Created func() null.Val[time.Time] - Location func() null.Val[string] - PublicID func() null.Val[string] - Status func() null.Val[enums.PublicreportReportstatustype] - - f *Factory - - alreadyPersisted bool -} - -// Apply mods to the PublicreportReportLocationTemplate -func (o *PublicreportReportLocationTemplate) Apply(ctx context.Context, mods ...PublicreportReportLocationMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.PublicreportReportLocation -// according to the relationships in the template. Nothing is inserted into the db -func (t PublicreportReportLocationTemplate) setModelRels(o *models.PublicreportReportLocation) {} - -// Build returns an *models.PublicreportReportLocation -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportReportLocationTemplate.Create -func (o PublicreportReportLocationTemplate) Build() *models.PublicreportReportLocation { - m := &models.PublicreportReportLocation{} - - if o.ID != nil { - m.ID = o.ID() - } - if o.TableName != nil { - m.TableName = o.TableName() - } - if o.Address != nil { - m.Address = o.Address() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.Location != nil { - m.Location = o.Location() - } - if o.PublicID != nil { - m.PublicID = o.PublicID() - } - if o.Status != nil { - m.Status = o.Status() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.PublicreportReportLocationSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportReportLocationTemplate.CreateMany -func (o PublicreportReportLocationTemplate) BuildMany(number int) models.PublicreportReportLocationSlice { - m := make(models.PublicreportReportLocationSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -// PublicreportReportLocation has methods that act as mods for the PublicreportReportLocationTemplate -var PublicreportReportLocationMods publicreportReportLocationMods - -type publicreportReportLocationMods struct{} - -func (m publicreportReportLocationMods) RandomizeAllColumns(f *faker.Faker) PublicreportReportLocationMod { - return PublicreportReportLocationModSlice{ - PublicreportReportLocationMods.RandomID(f), - PublicreportReportLocationMods.RandomTableName(f), - PublicreportReportLocationMods.RandomAddress(f), - PublicreportReportLocationMods.RandomCreated(f), - PublicreportReportLocationMods.RandomLocation(f), - PublicreportReportLocationMods.RandomPublicID(f), - PublicreportReportLocationMods.RandomStatus(f), - } -} - -// Set the model columns to this value -func (m publicreportReportLocationMods) ID(val null.Val[int64]) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.ID = func() null.Val[int64] { return val } - }) -} - -// Set the Column from the function -func (m publicreportReportLocationMods) IDFunc(f func() null.Val[int64]) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m publicreportReportLocationMods) UnsetID() PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m publicreportReportLocationMods) RandomID(f *faker.Faker) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.ID = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m publicreportReportLocationMods) RandomIDNotNull(f *faker.Faker) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.ID = func() null.Val[int64] { - if f == nil { - f = &defaultFaker - } - - val := random_int64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m publicreportReportLocationMods) TableName(val null.Val[string]) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.TableName = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m publicreportReportLocationMods) TableNameFunc(f func() null.Val[string]) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.TableName = f - }) -} - -// Clear any values for the column -func (m publicreportReportLocationMods) UnsetTableName() PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.TableName = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m publicreportReportLocationMods) RandomTableName(f *faker.Faker) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.TableName = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m publicreportReportLocationMods) RandomTableNameNotNull(f *faker.Faker) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.TableName = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m publicreportReportLocationMods) Address(val null.Val[string]) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.Address = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m publicreportReportLocationMods) AddressFunc(f func() null.Val[string]) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.Address = f - }) -} - -// Clear any values for the column -func (m publicreportReportLocationMods) UnsetAddress() PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.Address = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m publicreportReportLocationMods) RandomAddress(f *faker.Faker) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.Address = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m publicreportReportLocationMods) RandomAddressNotNull(f *faker.Faker) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.Address = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m publicreportReportLocationMods) Created(val null.Val[time.Time]) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.Created = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m publicreportReportLocationMods) CreatedFunc(f func() null.Val[time.Time]) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m publicreportReportLocationMods) UnsetCreated() PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - 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 publicreportReportLocationMods) RandomCreated(f *faker.Faker) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - 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 publicreportReportLocationMods) RandomCreatedNotNull(f *faker.Faker) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - 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 publicreportReportLocationMods) Location(val null.Val[string]) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.Location = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m publicreportReportLocationMods) LocationFunc(f func() null.Val[string]) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.Location = f - }) -} - -// Clear any values for the column -func (m publicreportReportLocationMods) UnsetLocation() PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.Location = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m publicreportReportLocationMods) RandomLocation(f *faker.Faker) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.Location = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m publicreportReportLocationMods) RandomLocationNotNull(f *faker.Faker) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.Location = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m publicreportReportLocationMods) PublicID(val null.Val[string]) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.PublicID = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m publicreportReportLocationMods) PublicIDFunc(f func() null.Val[string]) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.PublicID = f - }) -} - -// Clear any values for the column -func (m publicreportReportLocationMods) UnsetPublicID() PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.PublicID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m publicreportReportLocationMods) RandomPublicID(f *faker.Faker) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.PublicID = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m publicreportReportLocationMods) RandomPublicIDNotNull(f *faker.Faker) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.PublicID = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m publicreportReportLocationMods) Status(val null.Val[enums.PublicreportReportstatustype]) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.Status = func() null.Val[enums.PublicreportReportstatustype] { return val } - }) -} - -// Set the Column from the function -func (m publicreportReportLocationMods) StatusFunc(f func() null.Val[enums.PublicreportReportstatustype]) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.Status = f - }) -} - -// Clear any values for the column -func (m publicreportReportLocationMods) UnsetStatus() PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - 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 publicreportReportLocationMods) RandomStatus(f *faker.Faker) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.Status = func() null.Val[enums.PublicreportReportstatustype] { - if f == nil { - f = &defaultFaker - } - - val := random_enums_PublicreportReportstatustype(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m publicreportReportLocationMods) RandomStatusNotNull(f *faker.Faker) PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) { - o.Status = func() null.Val[enums.PublicreportReportstatustype] { - if f == nil { - f = &defaultFaker - } - - val := random_enums_PublicreportReportstatustype(f) - return null.From(val) - } - }) -} - -func (m publicreportReportLocationMods) WithParentsCascading() PublicreportReportLocationMod { - return PublicreportReportLocationModFunc(func(ctx context.Context, o *PublicreportReportLocationTemplate) { - if isDone, _ := publicreportReportLocationWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = publicreportReportLocationWithParentsCascadingCtx.WithValue(ctx, true) - }) -} diff --git a/db/factory/publicreport.subscribe_email.bob.go b/db/factory/publicreport.subscribe_email.bob.go deleted file mode 100644 index 23009620..00000000 --- a/db/factory/publicreport.subscribe_email.bob.go +++ /dev/null @@ -1,474 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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" -) - -type PublicreportSubscribeEmailMod interface { - Apply(context.Context, *PublicreportSubscribeEmailTemplate) -} - -type PublicreportSubscribeEmailModFunc func(context.Context, *PublicreportSubscribeEmailTemplate) - -func (f PublicreportSubscribeEmailModFunc) Apply(ctx context.Context, n *PublicreportSubscribeEmailTemplate) { - f(ctx, n) -} - -type PublicreportSubscribeEmailModSlice []PublicreportSubscribeEmailMod - -func (mods PublicreportSubscribeEmailModSlice) Apply(ctx context.Context, n *PublicreportSubscribeEmailTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// PublicreportSubscribeEmailTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type PublicreportSubscribeEmailTemplate struct { - Created func() time.Time - Deleted func() null.Val[time.Time] - EmailAddress func() string - ID func() int32 - - r publicreportSubscribeEmailR - f *Factory - - alreadyPersisted bool -} - -type publicreportSubscribeEmailR struct { - EmailAddressEmailContact *publicreportSubscribeEmailREmailAddressEmailContactR -} - -type publicreportSubscribeEmailREmailAddressEmailContactR struct { - o *CommsEmailContactTemplate -} - -// Apply mods to the PublicreportSubscribeEmailTemplate -func (o *PublicreportSubscribeEmailTemplate) Apply(ctx context.Context, mods ...PublicreportSubscribeEmailMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.PublicreportSubscribeEmail -// according to the relationships in the template. Nothing is inserted into the db -func (t PublicreportSubscribeEmailTemplate) setModelRels(o *models.PublicreportSubscribeEmail) { - if t.r.EmailAddressEmailContact != nil { - rel := t.r.EmailAddressEmailContact.o.Build() - rel.R.EmailAddressSubscribeEmails = append(rel.R.EmailAddressSubscribeEmails, o) - o.EmailAddress = rel.Address // h2 - o.R.EmailAddressEmailContact = rel - } -} - -// BuildSetter returns an *models.PublicreportSubscribeEmailSetter -// this does nothing with the relationship templates -func (o PublicreportSubscribeEmailTemplate) BuildSetter() *models.PublicreportSubscribeEmailSetter { - m := &models.PublicreportSubscribeEmailSetter{} - - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.Deleted != nil { - val := o.Deleted() - m.Deleted = omitnull.FromNull(val) - } - if o.EmailAddress != nil { - val := o.EmailAddress() - m.EmailAddress = omit.From(val) - } - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.PublicreportSubscribeEmailSetter -// this does nothing with the relationship templates -func (o PublicreportSubscribeEmailTemplate) BuildManySetter(number int) []*models.PublicreportSubscribeEmailSetter { - m := make([]*models.PublicreportSubscribeEmailSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.PublicreportSubscribeEmail -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportSubscribeEmailTemplate.Create -func (o PublicreportSubscribeEmailTemplate) Build() *models.PublicreportSubscribeEmail { - m := &models.PublicreportSubscribeEmail{} - - if o.Created != nil { - m.Created = o.Created() - } - if o.Deleted != nil { - m.Deleted = o.Deleted() - } - if o.EmailAddress != nil { - m.EmailAddress = o.EmailAddress() - } - if o.ID != nil { - m.ID = o.ID() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.PublicreportSubscribeEmailSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportSubscribeEmailTemplate.CreateMany -func (o PublicreportSubscribeEmailTemplate) BuildMany(number int) models.PublicreportSubscribeEmailSlice { - m := make(models.PublicreportSubscribeEmailSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatablePublicreportSubscribeEmail(m *models.PublicreportSubscribeEmailSetter) { - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.EmailAddress.IsValue()) { - val := random_string(nil) - m.EmailAddress = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.PublicreportSubscribeEmail -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *PublicreportSubscribeEmailTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.PublicreportSubscribeEmail) error { - var err error - - return err -} - -// Create builds a publicreportSubscribeEmail and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *PublicreportSubscribeEmailTemplate) Create(ctx context.Context, exec bob.Executor) (*models.PublicreportSubscribeEmail, error) { - var err error - opt := o.BuildSetter() - ensureCreatablePublicreportSubscribeEmail(opt) - - if o.r.EmailAddressEmailContact == nil { - PublicreportSubscribeEmailMods.WithNewEmailAddressEmailContact().Apply(ctx, o) - } - - var rel0 *models.CommsEmailContact - - if o.r.EmailAddressEmailContact.o.alreadyPersisted { - rel0 = o.r.EmailAddressEmailContact.o.Build() - } else { - rel0, err = o.r.EmailAddressEmailContact.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.EmailAddress = omit.From(rel0.Address) - - m, err := models.PublicreportSubscribeEmails.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.EmailAddressEmailContact = rel0 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a publicreportSubscribeEmail and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *PublicreportSubscribeEmailTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.PublicreportSubscribeEmail { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a publicreportSubscribeEmail 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 *PublicreportSubscribeEmailTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.PublicreportSubscribeEmail { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple publicreportSubscribeEmails and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o PublicreportSubscribeEmailTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.PublicreportSubscribeEmailSlice, error) { - var err error - m := make(models.PublicreportSubscribeEmailSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple publicreportSubscribeEmails and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o PublicreportSubscribeEmailTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.PublicreportSubscribeEmailSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple publicreportSubscribeEmails 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 PublicreportSubscribeEmailTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.PublicreportSubscribeEmailSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// PublicreportSubscribeEmail has methods that act as mods for the PublicreportSubscribeEmailTemplate -var PublicreportSubscribeEmailMods publicreportSubscribeEmailMods - -type publicreportSubscribeEmailMods struct{} - -func (m publicreportSubscribeEmailMods) RandomizeAllColumns(f *faker.Faker) PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModSlice{ - PublicreportSubscribeEmailMods.RandomCreated(f), - PublicreportSubscribeEmailMods.RandomDeleted(f), - PublicreportSubscribeEmailMods.RandomEmailAddress(f), - PublicreportSubscribeEmailMods.RandomID(f), - } -} - -// Set the model columns to this value -func (m publicreportSubscribeEmailMods) Created(val time.Time) PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(_ context.Context, o *PublicreportSubscribeEmailTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m publicreportSubscribeEmailMods) CreatedFunc(f func() time.Time) PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(_ context.Context, o *PublicreportSubscribeEmailTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m publicreportSubscribeEmailMods) UnsetCreated() PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(_ context.Context, o *PublicreportSubscribeEmailTemplate) { - 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 publicreportSubscribeEmailMods) RandomCreated(f *faker.Faker) PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(_ context.Context, o *PublicreportSubscribeEmailTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportSubscribeEmailMods) Deleted(val null.Val[time.Time]) PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(_ context.Context, o *PublicreportSubscribeEmailTemplate) { - o.Deleted = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m publicreportSubscribeEmailMods) DeletedFunc(f func() null.Val[time.Time]) PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(_ context.Context, o *PublicreportSubscribeEmailTemplate) { - o.Deleted = f - }) -} - -// Clear any values for the column -func (m publicreportSubscribeEmailMods) UnsetDeleted() PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(_ context.Context, o *PublicreportSubscribeEmailTemplate) { - 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 publicreportSubscribeEmailMods) RandomDeleted(f *faker.Faker) PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(_ context.Context, o *PublicreportSubscribeEmailTemplate) { - 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 publicreportSubscribeEmailMods) RandomDeletedNotNull(f *faker.Faker) PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(_ context.Context, o *PublicreportSubscribeEmailTemplate) { - 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 publicreportSubscribeEmailMods) EmailAddress(val string) PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(_ context.Context, o *PublicreportSubscribeEmailTemplate) { - o.EmailAddress = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportSubscribeEmailMods) EmailAddressFunc(f func() string) PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(_ context.Context, o *PublicreportSubscribeEmailTemplate) { - o.EmailAddress = f - }) -} - -// Clear any values for the column -func (m publicreportSubscribeEmailMods) UnsetEmailAddress() PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(_ context.Context, o *PublicreportSubscribeEmailTemplate) { - o.EmailAddress = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportSubscribeEmailMods) RandomEmailAddress(f *faker.Faker) PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(_ context.Context, o *PublicreportSubscribeEmailTemplate) { - o.EmailAddress = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportSubscribeEmailMods) ID(val int32) PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(_ context.Context, o *PublicreportSubscribeEmailTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportSubscribeEmailMods) IDFunc(f func() int32) PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(_ context.Context, o *PublicreportSubscribeEmailTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m publicreportSubscribeEmailMods) UnsetID() PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(_ context.Context, o *PublicreportSubscribeEmailTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportSubscribeEmailMods) RandomID(f *faker.Faker) PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(_ context.Context, o *PublicreportSubscribeEmailTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -func (m publicreportSubscribeEmailMods) WithParentsCascading() PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(ctx context.Context, o *PublicreportSubscribeEmailTemplate) { - if isDone, _ := publicreportSubscribeEmailWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = publicreportSubscribeEmailWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewCommsEmailContactWithContext(ctx, CommsEmailContactMods.WithParentsCascading()) - m.WithEmailAddressEmailContact(related).Apply(ctx, o) - } - }) -} - -func (m publicreportSubscribeEmailMods) WithEmailAddressEmailContact(rel *CommsEmailContactTemplate) PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(ctx context.Context, o *PublicreportSubscribeEmailTemplate) { - o.r.EmailAddressEmailContact = &publicreportSubscribeEmailREmailAddressEmailContactR{ - o: rel, - } - }) -} - -func (m publicreportSubscribeEmailMods) WithNewEmailAddressEmailContact(mods ...CommsEmailContactMod) PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(ctx context.Context, o *PublicreportSubscribeEmailTemplate) { - related := o.f.NewCommsEmailContactWithContext(ctx, mods...) - - m.WithEmailAddressEmailContact(related).Apply(ctx, o) - }) -} - -func (m publicreportSubscribeEmailMods) WithExistingEmailAddressEmailContact(em *models.CommsEmailContact) PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(ctx context.Context, o *PublicreportSubscribeEmailTemplate) { - o.r.EmailAddressEmailContact = &publicreportSubscribeEmailREmailAddressEmailContactR{ - o: o.f.FromExistingCommsEmailContact(em), - } - }) -} - -func (m publicreportSubscribeEmailMods) WithoutEmailAddressEmailContact() PublicreportSubscribeEmailMod { - return PublicreportSubscribeEmailModFunc(func(ctx context.Context, o *PublicreportSubscribeEmailTemplate) { - o.r.EmailAddressEmailContact = nil - }) -} diff --git a/db/factory/publicreport.subscribe_phone.bob.go b/db/factory/publicreport.subscribe_phone.bob.go deleted file mode 100644 index 4988af0a..00000000 --- a/db/factory/publicreport.subscribe_phone.bob.go +++ /dev/null @@ -1,474 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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" -) - -type PublicreportSubscribePhoneMod interface { - Apply(context.Context, *PublicreportSubscribePhoneTemplate) -} - -type PublicreportSubscribePhoneModFunc func(context.Context, *PublicreportSubscribePhoneTemplate) - -func (f PublicreportSubscribePhoneModFunc) Apply(ctx context.Context, n *PublicreportSubscribePhoneTemplate) { - f(ctx, n) -} - -type PublicreportSubscribePhoneModSlice []PublicreportSubscribePhoneMod - -func (mods PublicreportSubscribePhoneModSlice) Apply(ctx context.Context, n *PublicreportSubscribePhoneTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// PublicreportSubscribePhoneTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type PublicreportSubscribePhoneTemplate struct { - Created func() time.Time - Deleted func() null.Val[time.Time] - ID func() int32 - PhoneE164 func() string - - r publicreportSubscribePhoneR - f *Factory - - alreadyPersisted bool -} - -type publicreportSubscribePhoneR struct { - PhoneE164Phone *publicreportSubscribePhoneRPhoneE164PhoneR -} - -type publicreportSubscribePhoneRPhoneE164PhoneR struct { - o *CommsPhoneTemplate -} - -// Apply mods to the PublicreportSubscribePhoneTemplate -func (o *PublicreportSubscribePhoneTemplate) Apply(ctx context.Context, mods ...PublicreportSubscribePhoneMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.PublicreportSubscribePhone -// according to the relationships in the template. Nothing is inserted into the db -func (t PublicreportSubscribePhoneTemplate) setModelRels(o *models.PublicreportSubscribePhone) { - if t.r.PhoneE164Phone != nil { - rel := t.r.PhoneE164Phone.o.Build() - rel.R.PhoneE164SubscribePhones = append(rel.R.PhoneE164SubscribePhones, o) - o.PhoneE164 = rel.E164 // h2 - o.R.PhoneE164Phone = rel - } -} - -// BuildSetter returns an *models.PublicreportSubscribePhoneSetter -// this does nothing with the relationship templates -func (o PublicreportSubscribePhoneTemplate) BuildSetter() *models.PublicreportSubscribePhoneSetter { - m := &models.PublicreportSubscribePhoneSetter{} - - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.Deleted != nil { - val := o.Deleted() - m.Deleted = omitnull.FromNull(val) - } - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.PhoneE164 != nil { - val := o.PhoneE164() - m.PhoneE164 = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.PublicreportSubscribePhoneSetter -// this does nothing with the relationship templates -func (o PublicreportSubscribePhoneTemplate) BuildManySetter(number int) []*models.PublicreportSubscribePhoneSetter { - m := make([]*models.PublicreportSubscribePhoneSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.PublicreportSubscribePhone -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportSubscribePhoneTemplate.Create -func (o PublicreportSubscribePhoneTemplate) Build() *models.PublicreportSubscribePhone { - m := &models.PublicreportSubscribePhone{} - - if o.Created != nil { - m.Created = o.Created() - } - if o.Deleted != nil { - m.Deleted = o.Deleted() - } - if o.ID != nil { - m.ID = o.ID() - } - if o.PhoneE164 != nil { - m.PhoneE164 = o.PhoneE164() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.PublicreportSubscribePhoneSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use PublicreportSubscribePhoneTemplate.CreateMany -func (o PublicreportSubscribePhoneTemplate) BuildMany(number int) models.PublicreportSubscribePhoneSlice { - m := make(models.PublicreportSubscribePhoneSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatablePublicreportSubscribePhone(m *models.PublicreportSubscribePhoneSetter) { - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.PhoneE164.IsValue()) { - val := random_string(nil) - m.PhoneE164 = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.PublicreportSubscribePhone -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *PublicreportSubscribePhoneTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.PublicreportSubscribePhone) error { - var err error - - return err -} - -// Create builds a publicreportSubscribePhone and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *PublicreportSubscribePhoneTemplate) Create(ctx context.Context, exec bob.Executor) (*models.PublicreportSubscribePhone, error) { - var err error - opt := o.BuildSetter() - ensureCreatablePublicreportSubscribePhone(opt) - - if o.r.PhoneE164Phone == nil { - PublicreportSubscribePhoneMods.WithNewPhoneE164Phone().Apply(ctx, o) - } - - var rel0 *models.CommsPhone - - if o.r.PhoneE164Phone.o.alreadyPersisted { - rel0 = o.r.PhoneE164Phone.o.Build() - } else { - rel0, err = o.r.PhoneE164Phone.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.PhoneE164 = omit.From(rel0.E164) - - m, err := models.PublicreportSubscribePhones.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.PhoneE164Phone = rel0 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a publicreportSubscribePhone and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *PublicreportSubscribePhoneTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.PublicreportSubscribePhone { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a publicreportSubscribePhone 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 *PublicreportSubscribePhoneTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.PublicreportSubscribePhone { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple publicreportSubscribePhones and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o PublicreportSubscribePhoneTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.PublicreportSubscribePhoneSlice, error) { - var err error - m := make(models.PublicreportSubscribePhoneSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple publicreportSubscribePhones and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o PublicreportSubscribePhoneTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.PublicreportSubscribePhoneSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple publicreportSubscribePhones 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 PublicreportSubscribePhoneTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.PublicreportSubscribePhoneSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// PublicreportSubscribePhone has methods that act as mods for the PublicreportSubscribePhoneTemplate -var PublicreportSubscribePhoneMods publicreportSubscribePhoneMods - -type publicreportSubscribePhoneMods struct{} - -func (m publicreportSubscribePhoneMods) RandomizeAllColumns(f *faker.Faker) PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModSlice{ - PublicreportSubscribePhoneMods.RandomCreated(f), - PublicreportSubscribePhoneMods.RandomDeleted(f), - PublicreportSubscribePhoneMods.RandomID(f), - PublicreportSubscribePhoneMods.RandomPhoneE164(f), - } -} - -// Set the model columns to this value -func (m publicreportSubscribePhoneMods) Created(val time.Time) PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(_ context.Context, o *PublicreportSubscribePhoneTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m publicreportSubscribePhoneMods) CreatedFunc(f func() time.Time) PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(_ context.Context, o *PublicreportSubscribePhoneTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m publicreportSubscribePhoneMods) UnsetCreated() PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(_ context.Context, o *PublicreportSubscribePhoneTemplate) { - 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 publicreportSubscribePhoneMods) RandomCreated(f *faker.Faker) PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(_ context.Context, o *PublicreportSubscribePhoneTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportSubscribePhoneMods) Deleted(val null.Val[time.Time]) PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(_ context.Context, o *PublicreportSubscribePhoneTemplate) { - o.Deleted = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m publicreportSubscribePhoneMods) DeletedFunc(f func() null.Val[time.Time]) PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(_ context.Context, o *PublicreportSubscribePhoneTemplate) { - o.Deleted = f - }) -} - -// Clear any values for the column -func (m publicreportSubscribePhoneMods) UnsetDeleted() PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(_ context.Context, o *PublicreportSubscribePhoneTemplate) { - 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 publicreportSubscribePhoneMods) RandomDeleted(f *faker.Faker) PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(_ context.Context, o *PublicreportSubscribePhoneTemplate) { - 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 publicreportSubscribePhoneMods) RandomDeletedNotNull(f *faker.Faker) PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(_ context.Context, o *PublicreportSubscribePhoneTemplate) { - 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 publicreportSubscribePhoneMods) ID(val int32) PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(_ context.Context, o *PublicreportSubscribePhoneTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m publicreportSubscribePhoneMods) IDFunc(f func() int32) PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(_ context.Context, o *PublicreportSubscribePhoneTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m publicreportSubscribePhoneMods) UnsetID() PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(_ context.Context, o *PublicreportSubscribePhoneTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportSubscribePhoneMods) RandomID(f *faker.Faker) PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(_ context.Context, o *PublicreportSubscribePhoneTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m publicreportSubscribePhoneMods) PhoneE164(val string) PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(_ context.Context, o *PublicreportSubscribePhoneTemplate) { - o.PhoneE164 = func() string { return val } - }) -} - -// Set the Column from the function -func (m publicreportSubscribePhoneMods) PhoneE164Func(f func() string) PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(_ context.Context, o *PublicreportSubscribePhoneTemplate) { - o.PhoneE164 = f - }) -} - -// Clear any values for the column -func (m publicreportSubscribePhoneMods) UnsetPhoneE164() PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(_ context.Context, o *PublicreportSubscribePhoneTemplate) { - o.PhoneE164 = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m publicreportSubscribePhoneMods) RandomPhoneE164(f *faker.Faker) PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(_ context.Context, o *PublicreportSubscribePhoneTemplate) { - o.PhoneE164 = func() string { - return random_string(f) - } - }) -} - -func (m publicreportSubscribePhoneMods) WithParentsCascading() PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(ctx context.Context, o *PublicreportSubscribePhoneTemplate) { - if isDone, _ := publicreportSubscribePhoneWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = publicreportSubscribePhoneWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewCommsPhoneWithContext(ctx, CommsPhoneMods.WithParentsCascading()) - m.WithPhoneE164Phone(related).Apply(ctx, o) - } - }) -} - -func (m publicreportSubscribePhoneMods) WithPhoneE164Phone(rel *CommsPhoneTemplate) PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(ctx context.Context, o *PublicreportSubscribePhoneTemplate) { - o.r.PhoneE164Phone = &publicreportSubscribePhoneRPhoneE164PhoneR{ - o: rel, - } - }) -} - -func (m publicreportSubscribePhoneMods) WithNewPhoneE164Phone(mods ...CommsPhoneMod) PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(ctx context.Context, o *PublicreportSubscribePhoneTemplate) { - related := o.f.NewCommsPhoneWithContext(ctx, mods...) - - m.WithPhoneE164Phone(related).Apply(ctx, o) - }) -} - -func (m publicreportSubscribePhoneMods) WithExistingPhoneE164Phone(em *models.CommsPhone) PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(ctx context.Context, o *PublicreportSubscribePhoneTemplate) { - o.r.PhoneE164Phone = &publicreportSubscribePhoneRPhoneE164PhoneR{ - o: o.f.FromExistingCommsPhone(em), - } - }) -} - -func (m publicreportSubscribePhoneMods) WithoutPhoneE164Phone() PublicreportSubscribePhoneMod { - return PublicreportSubscribePhoneModFunc(func(ctx context.Context, o *PublicreportSubscribePhoneTemplate) { - o.r.PhoneE164Phone = nil - }) -} diff --git a/db/factory/raster_columns.bob.go b/db/factory/raster_columns.bob.go deleted file mode 100644 index 1e8a8255..00000000 --- a/db/factory/raster_columns.bob.go +++ /dev/null @@ -1,1081 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/jaswdr/faker/v2" - "github.com/lib/pq" -) - -type RasterColumnMod interface { - Apply(context.Context, *RasterColumnTemplate) -} - -type RasterColumnModFunc func(context.Context, *RasterColumnTemplate) - -func (f RasterColumnModFunc) Apply(ctx context.Context, n *RasterColumnTemplate) { - f(ctx, n) -} - -type RasterColumnModSlice []RasterColumnMod - -func (mods RasterColumnModSlice) Apply(ctx context.Context, n *RasterColumnTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// RasterColumnTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type RasterColumnTemplate struct { - RTableCatalog func() null.Val[string] - RTableSchema func() null.Val[string] - RTableName func() null.Val[string] - RRasterColumn func() null.Val[string] - Srid func() null.Val[int32] - ScaleX func() null.Val[float64] - ScaleY func() null.Val[float64] - BlocksizeX func() null.Val[int32] - BlocksizeY func() null.Val[int32] - SameAlignment func() null.Val[bool] - RegularBlocking func() null.Val[bool] - NumBands func() null.Val[int32] - PixelTypes func() null.Val[pq.StringArray] - NodataValues func() null.Val[pq.Float64Array] - OutDB func() null.Val[pq.BoolArray] - Extent func() null.Val[string] - SpatialIndex func() null.Val[bool] - - f *Factory - - alreadyPersisted bool -} - -// Apply mods to the RasterColumnTemplate -func (o *RasterColumnTemplate) Apply(ctx context.Context, mods ...RasterColumnMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.RasterColumn -// according to the relationships in the template. Nothing is inserted into the db -func (t RasterColumnTemplate) setModelRels(o *models.RasterColumn) {} - -// Build returns an *models.RasterColumn -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use RasterColumnTemplate.Create -func (o RasterColumnTemplate) Build() *models.RasterColumn { - m := &models.RasterColumn{} - - if o.RTableCatalog != nil { - m.RTableCatalog = o.RTableCatalog() - } - if o.RTableSchema != nil { - m.RTableSchema = o.RTableSchema() - } - if o.RTableName != nil { - m.RTableName = o.RTableName() - } - if o.RRasterColumn != nil { - m.RRasterColumn = o.RRasterColumn() - } - if o.Srid != nil { - m.Srid = o.Srid() - } - if o.ScaleX != nil { - m.ScaleX = o.ScaleX() - } - if o.ScaleY != nil { - m.ScaleY = o.ScaleY() - } - if o.BlocksizeX != nil { - m.BlocksizeX = o.BlocksizeX() - } - if o.BlocksizeY != nil { - m.BlocksizeY = o.BlocksizeY() - } - if o.SameAlignment != nil { - m.SameAlignment = o.SameAlignment() - } - if o.RegularBlocking != nil { - m.RegularBlocking = o.RegularBlocking() - } - if o.NumBands != nil { - m.NumBands = o.NumBands() - } - if o.PixelTypes != nil { - m.PixelTypes = o.PixelTypes() - } - if o.NodataValues != nil { - m.NodataValues = o.NodataValues() - } - if o.OutDB != nil { - m.OutDB = o.OutDB() - } - if o.Extent != nil { - m.Extent = o.Extent() - } - if o.SpatialIndex != nil { - m.SpatialIndex = o.SpatialIndex() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.RasterColumnSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use RasterColumnTemplate.CreateMany -func (o RasterColumnTemplate) BuildMany(number int) models.RasterColumnSlice { - m := make(models.RasterColumnSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -// RasterColumn has methods that act as mods for the RasterColumnTemplate -var RasterColumnMods rasterColumnMods - -type rasterColumnMods struct{} - -func (m rasterColumnMods) RandomizeAllColumns(f *faker.Faker) RasterColumnMod { - return RasterColumnModSlice{ - RasterColumnMods.RandomRTableCatalog(f), - RasterColumnMods.RandomRTableSchema(f), - RasterColumnMods.RandomRTableName(f), - RasterColumnMods.RandomRRasterColumn(f), - RasterColumnMods.RandomSrid(f), - RasterColumnMods.RandomScaleX(f), - RasterColumnMods.RandomScaleY(f), - RasterColumnMods.RandomBlocksizeX(f), - RasterColumnMods.RandomBlocksizeY(f), - RasterColumnMods.RandomSameAlignment(f), - RasterColumnMods.RandomRegularBlocking(f), - RasterColumnMods.RandomNumBands(f), - RasterColumnMods.RandomPixelTypes(f), - RasterColumnMods.RandomNodataValues(f), - RasterColumnMods.RandomOutDB(f), - RasterColumnMods.RandomExtent(f), - RasterColumnMods.RandomSpatialIndex(f), - } -} - -// Set the model columns to this value -func (m rasterColumnMods) RTableCatalog(val null.Val[string]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RTableCatalog = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m rasterColumnMods) RTableCatalogFunc(f func() null.Val[string]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RTableCatalog = f - }) -} - -// Clear any values for the column -func (m rasterColumnMods) UnsetRTableCatalog() RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RTableCatalog = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterColumnMods) RandomRTableCatalog(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RTableCatalog = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterColumnMods) RandomRTableCatalogNotNull(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RTableCatalog = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterColumnMods) RTableSchema(val null.Val[string]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RTableSchema = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m rasterColumnMods) RTableSchemaFunc(f func() null.Val[string]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RTableSchema = f - }) -} - -// Clear any values for the column -func (m rasterColumnMods) UnsetRTableSchema() RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RTableSchema = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterColumnMods) RandomRTableSchema(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RTableSchema = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterColumnMods) RandomRTableSchemaNotNull(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RTableSchema = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterColumnMods) RTableName(val null.Val[string]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RTableName = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m rasterColumnMods) RTableNameFunc(f func() null.Val[string]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RTableName = f - }) -} - -// Clear any values for the column -func (m rasterColumnMods) UnsetRTableName() RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RTableName = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterColumnMods) RandomRTableName(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RTableName = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterColumnMods) RandomRTableNameNotNull(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RTableName = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterColumnMods) RRasterColumn(val null.Val[string]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RRasterColumn = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m rasterColumnMods) RRasterColumnFunc(f func() null.Val[string]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RRasterColumn = f - }) -} - -// Clear any values for the column -func (m rasterColumnMods) UnsetRRasterColumn() RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RRasterColumn = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterColumnMods) RandomRRasterColumn(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RRasterColumn = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterColumnMods) RandomRRasterColumnNotNull(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RRasterColumn = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterColumnMods) Srid(val null.Val[int32]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.Srid = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m rasterColumnMods) SridFunc(f func() null.Val[int32]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.Srid = f - }) -} - -// Clear any values for the column -func (m rasterColumnMods) UnsetSrid() RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.Srid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterColumnMods) RandomSrid(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.Srid = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterColumnMods) RandomSridNotNull(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.Srid = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterColumnMods) ScaleX(val null.Val[float64]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.ScaleX = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m rasterColumnMods) ScaleXFunc(f func() null.Val[float64]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.ScaleX = f - }) -} - -// Clear any values for the column -func (m rasterColumnMods) UnsetScaleX() RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.ScaleX = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterColumnMods) RandomScaleX(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.ScaleX = func() null.Val[float64] { - if f == nil { - f = &defaultFaker - } - - val := random_float64(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterColumnMods) RandomScaleXNotNull(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.ScaleX = func() null.Val[float64] { - if f == nil { - f = &defaultFaker - } - - val := random_float64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterColumnMods) ScaleY(val null.Val[float64]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.ScaleY = func() null.Val[float64] { return val } - }) -} - -// Set the Column from the function -func (m rasterColumnMods) ScaleYFunc(f func() null.Val[float64]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.ScaleY = f - }) -} - -// Clear any values for the column -func (m rasterColumnMods) UnsetScaleY() RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.ScaleY = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterColumnMods) RandomScaleY(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.ScaleY = func() null.Val[float64] { - if f == nil { - f = &defaultFaker - } - - val := random_float64(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterColumnMods) RandomScaleYNotNull(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.ScaleY = func() null.Val[float64] { - if f == nil { - f = &defaultFaker - } - - val := random_float64(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterColumnMods) BlocksizeX(val null.Val[int32]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.BlocksizeX = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m rasterColumnMods) BlocksizeXFunc(f func() null.Val[int32]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.BlocksizeX = f - }) -} - -// Clear any values for the column -func (m rasterColumnMods) UnsetBlocksizeX() RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.BlocksizeX = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterColumnMods) RandomBlocksizeX(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.BlocksizeX = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterColumnMods) RandomBlocksizeXNotNull(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.BlocksizeX = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterColumnMods) BlocksizeY(val null.Val[int32]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.BlocksizeY = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m rasterColumnMods) BlocksizeYFunc(f func() null.Val[int32]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.BlocksizeY = f - }) -} - -// Clear any values for the column -func (m rasterColumnMods) UnsetBlocksizeY() RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.BlocksizeY = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterColumnMods) RandomBlocksizeY(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.BlocksizeY = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterColumnMods) RandomBlocksizeYNotNull(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.BlocksizeY = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterColumnMods) SameAlignment(val null.Val[bool]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.SameAlignment = func() null.Val[bool] { return val } - }) -} - -// Set the Column from the function -func (m rasterColumnMods) SameAlignmentFunc(f func() null.Val[bool]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.SameAlignment = f - }) -} - -// Clear any values for the column -func (m rasterColumnMods) UnsetSameAlignment() RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.SameAlignment = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterColumnMods) RandomSameAlignment(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.SameAlignment = func() null.Val[bool] { - if f == nil { - f = &defaultFaker - } - - val := random_bool(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterColumnMods) RandomSameAlignmentNotNull(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.SameAlignment = func() null.Val[bool] { - if f == nil { - f = &defaultFaker - } - - val := random_bool(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterColumnMods) RegularBlocking(val null.Val[bool]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RegularBlocking = func() null.Val[bool] { return val } - }) -} - -// Set the Column from the function -func (m rasterColumnMods) RegularBlockingFunc(f func() null.Val[bool]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RegularBlocking = f - }) -} - -// Clear any values for the column -func (m rasterColumnMods) UnsetRegularBlocking() RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RegularBlocking = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterColumnMods) RandomRegularBlocking(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RegularBlocking = func() null.Val[bool] { - if f == nil { - f = &defaultFaker - } - - val := random_bool(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterColumnMods) RandomRegularBlockingNotNull(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.RegularBlocking = func() null.Val[bool] { - if f == nil { - f = &defaultFaker - } - - val := random_bool(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterColumnMods) NumBands(val null.Val[int32]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.NumBands = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m rasterColumnMods) NumBandsFunc(f func() null.Val[int32]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.NumBands = f - }) -} - -// Clear any values for the column -func (m rasterColumnMods) UnsetNumBands() RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.NumBands = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterColumnMods) RandomNumBands(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.NumBands = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterColumnMods) RandomNumBandsNotNull(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.NumBands = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterColumnMods) PixelTypes(val null.Val[pq.StringArray]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.PixelTypes = func() null.Val[pq.StringArray] { return val } - }) -} - -// Set the Column from the function -func (m rasterColumnMods) PixelTypesFunc(f func() null.Val[pq.StringArray]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.PixelTypes = f - }) -} - -// Clear any values for the column -func (m rasterColumnMods) UnsetPixelTypes() RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.PixelTypes = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterColumnMods) RandomPixelTypes(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.PixelTypes = func() null.Val[pq.StringArray] { - if f == nil { - f = &defaultFaker - } - - val := random_pq_StringArray(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterColumnMods) RandomPixelTypesNotNull(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.PixelTypes = func() null.Val[pq.StringArray] { - if f == nil { - f = &defaultFaker - } - - val := random_pq_StringArray(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterColumnMods) NodataValues(val null.Val[pq.Float64Array]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.NodataValues = func() null.Val[pq.Float64Array] { return val } - }) -} - -// Set the Column from the function -func (m rasterColumnMods) NodataValuesFunc(f func() null.Val[pq.Float64Array]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.NodataValues = f - }) -} - -// Clear any values for the column -func (m rasterColumnMods) UnsetNodataValues() RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.NodataValues = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterColumnMods) RandomNodataValues(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.NodataValues = func() null.Val[pq.Float64Array] { - if f == nil { - f = &defaultFaker - } - - val := random_pq_Float64Array(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterColumnMods) RandomNodataValuesNotNull(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.NodataValues = func() null.Val[pq.Float64Array] { - if f == nil { - f = &defaultFaker - } - - val := random_pq_Float64Array(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterColumnMods) OutDB(val null.Val[pq.BoolArray]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.OutDB = func() null.Val[pq.BoolArray] { return val } - }) -} - -// Set the Column from the function -func (m rasterColumnMods) OutDBFunc(f func() null.Val[pq.BoolArray]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.OutDB = f - }) -} - -// Clear any values for the column -func (m rasterColumnMods) UnsetOutDB() RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.OutDB = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterColumnMods) RandomOutDB(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.OutDB = func() null.Val[pq.BoolArray] { - if f == nil { - f = &defaultFaker - } - - val := random_pq_BoolArray(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterColumnMods) RandomOutDBNotNull(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.OutDB = func() null.Val[pq.BoolArray] { - if f == nil { - f = &defaultFaker - } - - val := random_pq_BoolArray(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterColumnMods) Extent(val null.Val[string]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.Extent = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m rasterColumnMods) ExtentFunc(f func() null.Val[string]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.Extent = f - }) -} - -// Clear any values for the column -func (m rasterColumnMods) UnsetExtent() RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.Extent = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterColumnMods) RandomExtent(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.Extent = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterColumnMods) RandomExtentNotNull(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.Extent = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterColumnMods) SpatialIndex(val null.Val[bool]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.SpatialIndex = func() null.Val[bool] { return val } - }) -} - -// Set the Column from the function -func (m rasterColumnMods) SpatialIndexFunc(f func() null.Val[bool]) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.SpatialIndex = f - }) -} - -// Clear any values for the column -func (m rasterColumnMods) UnsetSpatialIndex() RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.SpatialIndex = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterColumnMods) RandomSpatialIndex(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.SpatialIndex = func() null.Val[bool] { - if f == nil { - f = &defaultFaker - } - - val := random_bool(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterColumnMods) RandomSpatialIndexNotNull(f *faker.Faker) RasterColumnMod { - return RasterColumnModFunc(func(_ context.Context, o *RasterColumnTemplate) { - o.SpatialIndex = func() null.Val[bool] { - if f == nil { - f = &defaultFaker - } - - val := random_bool(f) - return null.From(val) - } - }) -} - -func (m rasterColumnMods) WithParentsCascading() RasterColumnMod { - return RasterColumnModFunc(func(ctx context.Context, o *RasterColumnTemplate) { - if isDone, _ := rasterColumnWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = rasterColumnWithParentsCascadingCtx.WithValue(ctx, true) - }) -} diff --git a/db/factory/raster_overviews.bob.go b/db/factory/raster_overviews.bob.go deleted file mode 100644 index 7c4bb9bf..00000000 --- a/db/factory/raster_overviews.bob.go +++ /dev/null @@ -1,616 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/null" - "github.com/jaswdr/faker/v2" -) - -type RasterOverviewMod interface { - Apply(context.Context, *RasterOverviewTemplate) -} - -type RasterOverviewModFunc func(context.Context, *RasterOverviewTemplate) - -func (f RasterOverviewModFunc) Apply(ctx context.Context, n *RasterOverviewTemplate) { - f(ctx, n) -} - -type RasterOverviewModSlice []RasterOverviewMod - -func (mods RasterOverviewModSlice) Apply(ctx context.Context, n *RasterOverviewTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// RasterOverviewTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type RasterOverviewTemplate struct { - OTableCatalog func() null.Val[string] - OTableSchema func() null.Val[string] - OTableName func() null.Val[string] - ORasterColumn func() null.Val[string] - RTableCatalog func() null.Val[string] - RTableSchema func() null.Val[string] - RTableName func() null.Val[string] - RRasterColumn func() null.Val[string] - OverviewFactor func() null.Val[int32] - - f *Factory - - alreadyPersisted bool -} - -// Apply mods to the RasterOverviewTemplate -func (o *RasterOverviewTemplate) Apply(ctx context.Context, mods ...RasterOverviewMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.RasterOverview -// according to the relationships in the template. Nothing is inserted into the db -func (t RasterOverviewTemplate) setModelRels(o *models.RasterOverview) {} - -// Build returns an *models.RasterOverview -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use RasterOverviewTemplate.Create -func (o RasterOverviewTemplate) Build() *models.RasterOverview { - m := &models.RasterOverview{} - - if o.OTableCatalog != nil { - m.OTableCatalog = o.OTableCatalog() - } - if o.OTableSchema != nil { - m.OTableSchema = o.OTableSchema() - } - if o.OTableName != nil { - m.OTableName = o.OTableName() - } - if o.ORasterColumn != nil { - m.ORasterColumn = o.ORasterColumn() - } - if o.RTableCatalog != nil { - m.RTableCatalog = o.RTableCatalog() - } - if o.RTableSchema != nil { - m.RTableSchema = o.RTableSchema() - } - if o.RTableName != nil { - m.RTableName = o.RTableName() - } - if o.RRasterColumn != nil { - m.RRasterColumn = o.RRasterColumn() - } - if o.OverviewFactor != nil { - m.OverviewFactor = o.OverviewFactor() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.RasterOverviewSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use RasterOverviewTemplate.CreateMany -func (o RasterOverviewTemplate) BuildMany(number int) models.RasterOverviewSlice { - m := make(models.RasterOverviewSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -// RasterOverview has methods that act as mods for the RasterOverviewTemplate -var RasterOverviewMods rasterOverviewMods - -type rasterOverviewMods struct{} - -func (m rasterOverviewMods) RandomizeAllColumns(f *faker.Faker) RasterOverviewMod { - return RasterOverviewModSlice{ - RasterOverviewMods.RandomOTableCatalog(f), - RasterOverviewMods.RandomOTableSchema(f), - RasterOverviewMods.RandomOTableName(f), - RasterOverviewMods.RandomORasterColumn(f), - RasterOverviewMods.RandomRTableCatalog(f), - RasterOverviewMods.RandomRTableSchema(f), - RasterOverviewMods.RandomRTableName(f), - RasterOverviewMods.RandomRRasterColumn(f), - RasterOverviewMods.RandomOverviewFactor(f), - } -} - -// Set the model columns to this value -func (m rasterOverviewMods) OTableCatalog(val null.Val[string]) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.OTableCatalog = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m rasterOverviewMods) OTableCatalogFunc(f func() null.Val[string]) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.OTableCatalog = f - }) -} - -// Clear any values for the column -func (m rasterOverviewMods) UnsetOTableCatalog() RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.OTableCatalog = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterOverviewMods) RandomOTableCatalog(f *faker.Faker) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.OTableCatalog = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterOverviewMods) RandomOTableCatalogNotNull(f *faker.Faker) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.OTableCatalog = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterOverviewMods) OTableSchema(val null.Val[string]) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.OTableSchema = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m rasterOverviewMods) OTableSchemaFunc(f func() null.Val[string]) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.OTableSchema = f - }) -} - -// Clear any values for the column -func (m rasterOverviewMods) UnsetOTableSchema() RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.OTableSchema = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterOverviewMods) RandomOTableSchema(f *faker.Faker) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.OTableSchema = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterOverviewMods) RandomOTableSchemaNotNull(f *faker.Faker) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.OTableSchema = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterOverviewMods) OTableName(val null.Val[string]) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.OTableName = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m rasterOverviewMods) OTableNameFunc(f func() null.Val[string]) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.OTableName = f - }) -} - -// Clear any values for the column -func (m rasterOverviewMods) UnsetOTableName() RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.OTableName = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterOverviewMods) RandomOTableName(f *faker.Faker) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.OTableName = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterOverviewMods) RandomOTableNameNotNull(f *faker.Faker) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.OTableName = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterOverviewMods) ORasterColumn(val null.Val[string]) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.ORasterColumn = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m rasterOverviewMods) ORasterColumnFunc(f func() null.Val[string]) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.ORasterColumn = f - }) -} - -// Clear any values for the column -func (m rasterOverviewMods) UnsetORasterColumn() RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.ORasterColumn = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterOverviewMods) RandomORasterColumn(f *faker.Faker) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.ORasterColumn = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterOverviewMods) RandomORasterColumnNotNull(f *faker.Faker) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.ORasterColumn = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterOverviewMods) RTableCatalog(val null.Val[string]) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.RTableCatalog = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m rasterOverviewMods) RTableCatalogFunc(f func() null.Val[string]) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.RTableCatalog = f - }) -} - -// Clear any values for the column -func (m rasterOverviewMods) UnsetRTableCatalog() RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.RTableCatalog = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterOverviewMods) RandomRTableCatalog(f *faker.Faker) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.RTableCatalog = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterOverviewMods) RandomRTableCatalogNotNull(f *faker.Faker) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.RTableCatalog = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterOverviewMods) RTableSchema(val null.Val[string]) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.RTableSchema = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m rasterOverviewMods) RTableSchemaFunc(f func() null.Val[string]) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.RTableSchema = f - }) -} - -// Clear any values for the column -func (m rasterOverviewMods) UnsetRTableSchema() RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.RTableSchema = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterOverviewMods) RandomRTableSchema(f *faker.Faker) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.RTableSchema = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterOverviewMods) RandomRTableSchemaNotNull(f *faker.Faker) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.RTableSchema = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterOverviewMods) RTableName(val null.Val[string]) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.RTableName = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m rasterOverviewMods) RTableNameFunc(f func() null.Val[string]) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.RTableName = f - }) -} - -// Clear any values for the column -func (m rasterOverviewMods) UnsetRTableName() RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.RTableName = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterOverviewMods) RandomRTableName(f *faker.Faker) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.RTableName = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterOverviewMods) RandomRTableNameNotNull(f *faker.Faker) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.RTableName = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterOverviewMods) RRasterColumn(val null.Val[string]) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.RRasterColumn = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m rasterOverviewMods) RRasterColumnFunc(f func() null.Val[string]) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.RRasterColumn = f - }) -} - -// Clear any values for the column -func (m rasterOverviewMods) UnsetRRasterColumn() RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.RRasterColumn = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterOverviewMods) RandomRRasterColumn(f *faker.Faker) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.RRasterColumn = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterOverviewMods) RandomRRasterColumnNotNull(f *faker.Faker) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.RRasterColumn = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m rasterOverviewMods) OverviewFactor(val null.Val[int32]) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.OverviewFactor = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m rasterOverviewMods) OverviewFactorFunc(f func() null.Val[int32]) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.OverviewFactor = f - }) -} - -// Clear any values for the column -func (m rasterOverviewMods) UnsetOverviewFactor() RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.OverviewFactor = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m rasterOverviewMods) RandomOverviewFactor(f *faker.Faker) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.OverviewFactor = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m rasterOverviewMods) RandomOverviewFactorNotNull(f *faker.Faker) RasterOverviewMod { - return RasterOverviewModFunc(func(_ context.Context, o *RasterOverviewTemplate) { - o.OverviewFactor = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -func (m rasterOverviewMods) WithParentsCascading() RasterOverviewMod { - return RasterOverviewModFunc(func(ctx context.Context, o *RasterOverviewTemplate) { - if isDone, _ := rasterOverviewWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = rasterOverviewWithParentsCascadingCtx.WithValue(ctx, true) - }) -} diff --git a/db/factory/resident.bob.go b/db/factory/resident.bob.go deleted file mode 100644 index 094a7d20..00000000 --- a/db/factory/resident.bob.go +++ /dev/null @@ -1,845 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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" -) - -type ResidentMod interface { - Apply(context.Context, *ResidentTemplate) -} - -type ResidentModFunc func(context.Context, *ResidentTemplate) - -func (f ResidentModFunc) Apply(ctx context.Context, n *ResidentTemplate) { - f(ctx, n) -} - -type ResidentModSlice []ResidentMod - -func (mods ResidentModSlice) Apply(ctx context.Context, n *ResidentTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// ResidentTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type ResidentTemplate struct { - AddressID func() int32 - Created func() time.Time - Creator func() int32 - ID func() int32 - Name func() string - PhoneMobile func() null.Val[string] - SiteID func() int32 - SiteVersion func() int32 - - r residentR - f *Factory - - alreadyPersisted bool -} - -type residentR struct { - Address *residentRAddressR - CreatorUser *residentRCreatorUserR - PhoneMobilePhone *residentRPhoneMobilePhoneR - Site *residentRSiteR -} - -type residentRAddressR struct { - o *AddressTemplate -} -type residentRCreatorUserR struct { - o *UserTemplate -} -type residentRPhoneMobilePhoneR struct { - o *CommsPhoneTemplate -} -type residentRSiteR struct { - o *SiteTemplate -} - -// Apply mods to the ResidentTemplate -func (o *ResidentTemplate) Apply(ctx context.Context, mods ...ResidentMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.Resident -// according to the relationships in the template. Nothing is inserted into the db -func (t ResidentTemplate) setModelRels(o *models.Resident) { - if t.r.Address != nil { - rel := t.r.Address.o.Build() - rel.R.Residents = append(rel.R.Residents, o) - o.AddressID = rel.ID // h2 - o.R.Address = rel - } - - if t.r.CreatorUser != nil { - rel := t.r.CreatorUser.o.Build() - rel.R.CreatorResidents = append(rel.R.CreatorResidents, o) - o.Creator = rel.ID // h2 - o.R.CreatorUser = rel - } - - if t.r.PhoneMobilePhone != nil { - rel := t.r.PhoneMobilePhone.o.Build() - rel.R.PhoneMobileResidents = append(rel.R.PhoneMobileResidents, o) - o.PhoneMobile = null.From(rel.E164) // h2 - o.R.PhoneMobilePhone = rel - } - - if t.r.Site != nil { - rel := t.r.Site.o.Build() - rel.R.Residents = append(rel.R.Residents, o) - o.SiteID = rel.ID // h2 - o.SiteVersion = rel.Version // h2 - o.R.Site = rel - } -} - -// BuildSetter returns an *models.ResidentSetter -// this does nothing with the relationship templates -func (o ResidentTemplate) BuildSetter() *models.ResidentSetter { - m := &models.ResidentSetter{} - - if o.AddressID != nil { - val := o.AddressID() - m.AddressID = omit.From(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omit.From(val) - } - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.Name != nil { - val := o.Name() - m.Name = omit.From(val) - } - if o.PhoneMobile != nil { - val := o.PhoneMobile() - m.PhoneMobile = omitnull.FromNull(val) - } - if o.SiteID != nil { - val := o.SiteID() - m.SiteID = omit.From(val) - } - if o.SiteVersion != nil { - val := o.SiteVersion() - m.SiteVersion = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.ResidentSetter -// this does nothing with the relationship templates -func (o ResidentTemplate) BuildManySetter(number int) []*models.ResidentSetter { - m := make([]*models.ResidentSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.Resident -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ResidentTemplate.Create -func (o ResidentTemplate) Build() *models.Resident { - m := &models.Resident{} - - if o.AddressID != nil { - m.AddressID = o.AddressID() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.ID != nil { - m.ID = o.ID() - } - if o.Name != nil { - m.Name = o.Name() - } - if o.PhoneMobile != nil { - m.PhoneMobile = o.PhoneMobile() - } - if o.SiteID != nil { - m.SiteID = o.SiteID() - } - if o.SiteVersion != nil { - m.SiteVersion = o.SiteVersion() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.ResidentSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use ResidentTemplate.CreateMany -func (o ResidentTemplate) BuildMany(number int) models.ResidentSlice { - m := make(models.ResidentSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableResident(m *models.ResidentSetter) { - if !(m.AddressID.IsValue()) { - val := random_int32(nil) - m.AddressID = omit.From(val) - } - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.Creator.IsValue()) { - val := random_int32(nil) - m.Creator = omit.From(val) - } - if !(m.Name.IsValue()) { - val := random_string(nil) - m.Name = omit.From(val) - } - if !(m.SiteID.IsValue()) { - val := random_int32(nil) - m.SiteID = omit.From(val) - } - if !(m.SiteVersion.IsValue()) { - val := random_int32(nil) - m.SiteVersion = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.Resident -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *ResidentTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.Resident) error { - var err error - - isPhoneMobilePhoneDone, _ := residentRelPhoneMobilePhoneCtx.Value(ctx) - if !isPhoneMobilePhoneDone && o.r.PhoneMobilePhone != nil { - ctx = residentRelPhoneMobilePhoneCtx.WithValue(ctx, true) - if o.r.PhoneMobilePhone.o.alreadyPersisted { - m.R.PhoneMobilePhone = o.r.PhoneMobilePhone.o.Build() - } else { - var rel2 *models.CommsPhone - rel2, err = o.r.PhoneMobilePhone.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachPhoneMobilePhone(ctx, exec, rel2) - if err != nil { - return err - } - } - - } - - return err -} - -// Create builds a resident and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *ResidentTemplate) Create(ctx context.Context, exec bob.Executor) (*models.Resident, error) { - var err error - opt := o.BuildSetter() - ensureCreatableResident(opt) - - if o.r.Address == nil { - ResidentMods.WithNewAddress().Apply(ctx, o) - } - - var rel0 *models.Address - - if o.r.Address.o.alreadyPersisted { - rel0 = o.r.Address.o.Build() - } else { - rel0, err = o.r.Address.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.AddressID = omit.From(rel0.ID) - - if o.r.CreatorUser == nil { - ResidentMods.WithNewCreatorUser().Apply(ctx, o) - } - - var rel1 *models.User - - if o.r.CreatorUser.o.alreadyPersisted { - rel1 = o.r.CreatorUser.o.Build() - } else { - rel1, err = o.r.CreatorUser.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.Creator = omit.From(rel1.ID) - - if o.r.Site == nil { - ResidentMods.WithNewSite().Apply(ctx, o) - } - - var rel3 *models.Site - - if o.r.Site.o.alreadyPersisted { - rel3 = o.r.Site.o.Build() - } else { - rel3, err = o.r.Site.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.SiteID = omit.From(rel3.ID) - opt.SiteVersion = omit.From(rel3.Version) - - m, err := models.Residents.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.Address = rel0 - m.R.CreatorUser = rel1 - m.R.Site = rel3 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a resident and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *ResidentTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.Resident { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a resident 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 *ResidentTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.Resident { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple residents and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o ResidentTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.ResidentSlice, error) { - var err error - m := make(models.ResidentSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple residents and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o ResidentTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.ResidentSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple residents 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 ResidentTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.ResidentSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// Resident has methods that act as mods for the ResidentTemplate -var ResidentMods residentMods - -type residentMods struct{} - -func (m residentMods) RandomizeAllColumns(f *faker.Faker) ResidentMod { - return ResidentModSlice{ - ResidentMods.RandomAddressID(f), - ResidentMods.RandomCreated(f), - ResidentMods.RandomCreator(f), - ResidentMods.RandomID(f), - ResidentMods.RandomName(f), - ResidentMods.RandomPhoneMobile(f), - ResidentMods.RandomSiteID(f), - ResidentMods.RandomSiteVersion(f), - } -} - -// Set the model columns to this value -func (m residentMods) AddressID(val int32) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.AddressID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m residentMods) AddressIDFunc(f func() int32) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.AddressID = f - }) -} - -// Clear any values for the column -func (m residentMods) UnsetAddressID() ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.AddressID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m residentMods) RandomAddressID(f *faker.Faker) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.AddressID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m residentMods) Created(val time.Time) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m residentMods) CreatedFunc(f func() time.Time) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m residentMods) UnsetCreated() ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - 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 residentMods) RandomCreated(f *faker.Faker) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m residentMods) Creator(val int32) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.Creator = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m residentMods) CreatorFunc(f func() int32) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m residentMods) UnsetCreator() ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.Creator = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m residentMods) RandomCreator(f *faker.Faker) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.Creator = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m residentMods) ID(val int32) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m residentMods) IDFunc(f func() int32) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m residentMods) UnsetID() ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m residentMods) RandomID(f *faker.Faker) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m residentMods) Name(val string) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.Name = func() string { return val } - }) -} - -// Set the Column from the function -func (m residentMods) NameFunc(f func() string) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.Name = f - }) -} - -// Clear any values for the column -func (m residentMods) UnsetName() ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.Name = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m residentMods) RandomName(f *faker.Faker) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.Name = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m residentMods) PhoneMobile(val null.Val[string]) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.PhoneMobile = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m residentMods) PhoneMobileFunc(f func() null.Val[string]) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.PhoneMobile = f - }) -} - -// Clear any values for the column -func (m residentMods) UnsetPhoneMobile() ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.PhoneMobile = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m residentMods) RandomPhoneMobile(f *faker.Faker) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.PhoneMobile = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m residentMods) RandomPhoneMobileNotNull(f *faker.Faker) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.PhoneMobile = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m residentMods) SiteID(val int32) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.SiteID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m residentMods) SiteIDFunc(f func() int32) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.SiteID = f - }) -} - -// Clear any values for the column -func (m residentMods) UnsetSiteID() ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.SiteID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m residentMods) RandomSiteID(f *faker.Faker) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.SiteID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m residentMods) SiteVersion(val int32) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.SiteVersion = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m residentMods) SiteVersionFunc(f func() int32) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.SiteVersion = f - }) -} - -// Clear any values for the column -func (m residentMods) UnsetSiteVersion() ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.SiteVersion = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m residentMods) RandomSiteVersion(f *faker.Faker) ResidentMod { - return ResidentModFunc(func(_ context.Context, o *ResidentTemplate) { - o.SiteVersion = func() int32 { - return random_int32(f) - } - }) -} - -func (m residentMods) WithParentsCascading() ResidentMod { - return ResidentModFunc(func(ctx context.Context, o *ResidentTemplate) { - if isDone, _ := residentWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = residentWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewAddressWithContext(ctx, AddressMods.WithParentsCascading()) - m.WithAddress(related).Apply(ctx, o) - } - { - - related := o.f.NewUserWithContext(ctx, UserMods.WithParentsCascading()) - m.WithCreatorUser(related).Apply(ctx, o) - } - { - - related := o.f.NewCommsPhoneWithContext(ctx, CommsPhoneMods.WithParentsCascading()) - m.WithPhoneMobilePhone(related).Apply(ctx, o) - } - { - - related := o.f.NewSiteWithContext(ctx, SiteMods.WithParentsCascading()) - m.WithSite(related).Apply(ctx, o) - } - }) -} - -func (m residentMods) WithAddress(rel *AddressTemplate) ResidentMod { - return ResidentModFunc(func(ctx context.Context, o *ResidentTemplate) { - o.r.Address = &residentRAddressR{ - o: rel, - } - }) -} - -func (m residentMods) WithNewAddress(mods ...AddressMod) ResidentMod { - return ResidentModFunc(func(ctx context.Context, o *ResidentTemplate) { - related := o.f.NewAddressWithContext(ctx, mods...) - - m.WithAddress(related).Apply(ctx, o) - }) -} - -func (m residentMods) WithExistingAddress(em *models.Address) ResidentMod { - return ResidentModFunc(func(ctx context.Context, o *ResidentTemplate) { - o.r.Address = &residentRAddressR{ - o: o.f.FromExistingAddress(em), - } - }) -} - -func (m residentMods) WithoutAddress() ResidentMod { - return ResidentModFunc(func(ctx context.Context, o *ResidentTemplate) { - o.r.Address = nil - }) -} - -func (m residentMods) WithCreatorUser(rel *UserTemplate) ResidentMod { - return ResidentModFunc(func(ctx context.Context, o *ResidentTemplate) { - o.r.CreatorUser = &residentRCreatorUserR{ - o: rel, - } - }) -} - -func (m residentMods) WithNewCreatorUser(mods ...UserMod) ResidentMod { - return ResidentModFunc(func(ctx context.Context, o *ResidentTemplate) { - related := o.f.NewUserWithContext(ctx, mods...) - - m.WithCreatorUser(related).Apply(ctx, o) - }) -} - -func (m residentMods) WithExistingCreatorUser(em *models.User) ResidentMod { - return ResidentModFunc(func(ctx context.Context, o *ResidentTemplate) { - o.r.CreatorUser = &residentRCreatorUserR{ - o: o.f.FromExistingUser(em), - } - }) -} - -func (m residentMods) WithoutCreatorUser() ResidentMod { - return ResidentModFunc(func(ctx context.Context, o *ResidentTemplate) { - o.r.CreatorUser = nil - }) -} - -func (m residentMods) WithPhoneMobilePhone(rel *CommsPhoneTemplate) ResidentMod { - return ResidentModFunc(func(ctx context.Context, o *ResidentTemplate) { - o.r.PhoneMobilePhone = &residentRPhoneMobilePhoneR{ - o: rel, - } - }) -} - -func (m residentMods) WithNewPhoneMobilePhone(mods ...CommsPhoneMod) ResidentMod { - return ResidentModFunc(func(ctx context.Context, o *ResidentTemplate) { - related := o.f.NewCommsPhoneWithContext(ctx, mods...) - - m.WithPhoneMobilePhone(related).Apply(ctx, o) - }) -} - -func (m residentMods) WithExistingPhoneMobilePhone(em *models.CommsPhone) ResidentMod { - return ResidentModFunc(func(ctx context.Context, o *ResidentTemplate) { - o.r.PhoneMobilePhone = &residentRPhoneMobilePhoneR{ - o: o.f.FromExistingCommsPhone(em), - } - }) -} - -func (m residentMods) WithoutPhoneMobilePhone() ResidentMod { - return ResidentModFunc(func(ctx context.Context, o *ResidentTemplate) { - o.r.PhoneMobilePhone = nil - }) -} - -func (m residentMods) WithSite(rel *SiteTemplate) ResidentMod { - return ResidentModFunc(func(ctx context.Context, o *ResidentTemplate) { - o.r.Site = &residentRSiteR{ - o: rel, - } - }) -} - -func (m residentMods) WithNewSite(mods ...SiteMod) ResidentMod { - return ResidentModFunc(func(ctx context.Context, o *ResidentTemplate) { - related := o.f.NewSiteWithContext(ctx, mods...) - - m.WithSite(related).Apply(ctx, o) - }) -} - -func (m residentMods) WithExistingSite(em *models.Site) ResidentMod { - return ResidentModFunc(func(ctx context.Context, o *ResidentTemplate) { - o.r.Site = &residentRSiteR{ - o: o.f.FromExistingSite(em), - } - }) -} - -func (m residentMods) WithoutSite() ResidentMod { - return ResidentModFunc(func(ctx context.Context, o *ResidentTemplate) { - o.r.Site = nil - }) -} diff --git a/db/factory/sessions.bob.go b/db/factory/sessions.bob.go deleted file mode 100644 index 562aed8a..00000000 --- a/db/factory/sessions.bob.go +++ /dev/null @@ -1,344 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/aarondl/opt/omit" - "github.com/jaswdr/faker/v2" -) - -type SessionMod interface { - Apply(context.Context, *SessionTemplate) -} - -type SessionModFunc func(context.Context, *SessionTemplate) - -func (f SessionModFunc) Apply(ctx context.Context, n *SessionTemplate) { - f(ctx, n) -} - -type SessionModSlice []SessionMod - -func (mods SessionModSlice) Apply(ctx context.Context, n *SessionTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// SessionTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type SessionTemplate struct { - Token func() string - Data func() []byte - Expiry func() time.Time - - f *Factory - - alreadyPersisted bool -} - -// Apply mods to the SessionTemplate -func (o *SessionTemplate) Apply(ctx context.Context, mods ...SessionMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.Session -// according to the relationships in the template. Nothing is inserted into the db -func (t SessionTemplate) setModelRels(o *models.Session) {} - -// BuildSetter returns an *models.SessionSetter -// this does nothing with the relationship templates -func (o SessionTemplate) BuildSetter() *models.SessionSetter { - m := &models.SessionSetter{} - - if o.Token != nil { - val := o.Token() - m.Token = omit.From(val) - } - if o.Data != nil { - val := o.Data() - m.Data = omit.From(val) - } - if o.Expiry != nil { - val := o.Expiry() - m.Expiry = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.SessionSetter -// this does nothing with the relationship templates -func (o SessionTemplate) BuildManySetter(number int) []*models.SessionSetter { - m := make([]*models.SessionSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.Session -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use SessionTemplate.Create -func (o SessionTemplate) Build() *models.Session { - m := &models.Session{} - - if o.Token != nil { - m.Token = o.Token() - } - if o.Data != nil { - m.Data = o.Data() - } - if o.Expiry != nil { - m.Expiry = o.Expiry() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.SessionSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use SessionTemplate.CreateMany -func (o SessionTemplate) BuildMany(number int) models.SessionSlice { - m := make(models.SessionSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableSession(m *models.SessionSetter) { - if !(m.Token.IsValue()) { - val := random_string(nil) - m.Token = omit.From(val) - } - if !(m.Data.IsValue()) { - val := random___byte(nil) - m.Data = omit.From(val) - } - if !(m.Expiry.IsValue()) { - val := random_time_Time(nil) - m.Expiry = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.Session -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *SessionTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.Session) error { - var err error - - return err -} - -// Create builds a session and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *SessionTemplate) Create(ctx context.Context, exec bob.Executor) (*models.Session, error) { - var err error - opt := o.BuildSetter() - ensureCreatableSession(opt) - - m, err := models.Sessions.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a session and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *SessionTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.Session { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a session 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 *SessionTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.Session { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple sessions and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o SessionTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.SessionSlice, error) { - var err error - m := make(models.SessionSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple sessions and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o SessionTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.SessionSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple sessions 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 SessionTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.SessionSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// Session has methods that act as mods for the SessionTemplate -var SessionMods sessionMods - -type sessionMods struct{} - -func (m sessionMods) RandomizeAllColumns(f *faker.Faker) SessionMod { - return SessionModSlice{ - SessionMods.RandomToken(f), - SessionMods.RandomData(f), - SessionMods.RandomExpiry(f), - } -} - -// Set the model columns to this value -func (m sessionMods) Token(val string) SessionMod { - return SessionModFunc(func(_ context.Context, o *SessionTemplate) { - o.Token = func() string { return val } - }) -} - -// Set the Column from the function -func (m sessionMods) TokenFunc(f func() string) SessionMod { - return SessionModFunc(func(_ context.Context, o *SessionTemplate) { - o.Token = f - }) -} - -// Clear any values for the column -func (m sessionMods) UnsetToken() SessionMod { - return SessionModFunc(func(_ context.Context, o *SessionTemplate) { - o.Token = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m sessionMods) RandomToken(f *faker.Faker) SessionMod { - return SessionModFunc(func(_ context.Context, o *SessionTemplate) { - o.Token = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m sessionMods) Data(val []byte) SessionMod { - return SessionModFunc(func(_ context.Context, o *SessionTemplate) { - o.Data = func() []byte { return val } - }) -} - -// Set the Column from the function -func (m sessionMods) DataFunc(f func() []byte) SessionMod { - return SessionModFunc(func(_ context.Context, o *SessionTemplate) { - o.Data = f - }) -} - -// Clear any values for the column -func (m sessionMods) UnsetData() SessionMod { - return SessionModFunc(func(_ context.Context, o *SessionTemplate) { - o.Data = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m sessionMods) RandomData(f *faker.Faker) SessionMod { - return SessionModFunc(func(_ context.Context, o *SessionTemplate) { - o.Data = func() []byte { - return random___byte(f) - } - }) -} - -// Set the model columns to this value -func (m sessionMods) Expiry(val time.Time) SessionMod { - return SessionModFunc(func(_ context.Context, o *SessionTemplate) { - o.Expiry = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m sessionMods) ExpiryFunc(f func() time.Time) SessionMod { - return SessionModFunc(func(_ context.Context, o *SessionTemplate) { - o.Expiry = f - }) -} - -// Clear any values for the column -func (m sessionMods) UnsetExpiry() SessionMod { - return SessionModFunc(func(_ context.Context, o *SessionTemplate) { - o.Expiry = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m sessionMods) RandomExpiry(f *faker.Faker) SessionMod { - return SessionModFunc(func(_ context.Context, o *SessionTemplate) { - o.Expiry = func() time.Time { - return random_time_Time(f) - } - }) -} - -func (m sessionMods) WithParentsCascading() SessionMod { - return SessionModFunc(func(ctx context.Context, o *SessionTemplate) { - if isDone, _ := sessionWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = sessionWithParentsCascadingCtx.WithValue(ctx, true) - }) -} diff --git a/db/factory/signal.bob.go b/db/factory/signal.bob.go deleted file mode 100644 index 16befe7e..00000000 --- a/db/factory/signal.bob.go +++ /dev/null @@ -1,926 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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/jaswdr/faker/v2" -) - -type SignalMod interface { - Apply(context.Context, *SignalTemplate) -} - -type SignalModFunc func(context.Context, *SignalTemplate) - -func (f SignalModFunc) Apply(ctx context.Context, n *SignalTemplate) { - f(ctx, n) -} - -type SignalModSlice []SignalMod - -func (mods SignalModSlice) Apply(ctx context.Context, n *SignalTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// SignalTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type SignalTemplate struct { - Addressed func() null.Val[time.Time] - Addressor func() null.Val[int32] - Created func() time.Time - Creator func() int32 - ID func() int32 - OrganizationID func() int32 - Species func() null.Val[enums.Mosquitospecies] - Title func() string - Type func() enums.Signaltype - - r signalR - f *Factory - - alreadyPersisted bool -} - -type signalR struct { - AddressorUser *signalRAddressorUserR - CreatorUser *signalRCreatorUserR - Organization *signalROrganizationR - SignalPools []*signalRSignalPoolsR -} - -type signalRAddressorUserR struct { - o *UserTemplate -} -type signalRCreatorUserR struct { - o *UserTemplate -} -type signalROrganizationR struct { - o *OrganizationTemplate -} -type signalRSignalPoolsR struct { - number int - o *SignalPoolTemplate -} - -// Apply mods to the SignalTemplate -func (o *SignalTemplate) Apply(ctx context.Context, mods ...SignalMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.Signal -// according to the relationships in the template. Nothing is inserted into the db -func (t SignalTemplate) setModelRels(o *models.Signal) { - if t.r.AddressorUser != nil { - rel := t.r.AddressorUser.o.Build() - rel.R.AddressorSignals = append(rel.R.AddressorSignals, o) - o.Addressor = null.From(rel.ID) // h2 - o.R.AddressorUser = rel - } - - if t.r.CreatorUser != nil { - rel := t.r.CreatorUser.o.Build() - rel.R.CreatorSignals = append(rel.R.CreatorSignals, o) - o.Creator = rel.ID // h2 - o.R.CreatorUser = rel - } - - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.Signals = append(rel.R.Signals, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } - - if t.r.SignalPools != nil { - rel := models.SignalPoolSlice{} - for _, r := range t.r.SignalPools { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.SignalID = o.ID // h2 - rel.R.Signal = o - } - rel = append(rel, related...) - } - o.R.SignalPools = rel - } -} - -// BuildSetter returns an *models.SignalSetter -// this does nothing with the relationship templates -func (o SignalTemplate) BuildSetter() *models.SignalSetter { - m := &models.SignalSetter{} - - if o.Addressed != nil { - val := o.Addressed() - m.Addressed = omitnull.FromNull(val) - } - if o.Addressor != nil { - val := o.Addressor() - m.Addressor = omitnull.FromNull(val) - } - if o.Created != nil { - val := o.Created() - m.Created = omit.From(val) - } - if o.Creator != nil { - val := o.Creator() - m.Creator = omit.From(val) - } - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Species != nil { - val := o.Species() - m.Species = omitnull.FromNull(val) - } - if o.Title != nil { - val := o.Title() - m.Title = omit.From(val) - } - if o.Type != nil { - val := o.Type() - m.Type = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.SignalSetter -// this does nothing with the relationship templates -func (o SignalTemplate) BuildManySetter(number int) []*models.SignalSetter { - m := make([]*models.SignalSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.Signal -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use SignalTemplate.Create -func (o SignalTemplate) Build() *models.Signal { - m := &models.Signal{} - - if o.Addressed != nil { - m.Addressed = o.Addressed() - } - if o.Addressor != nil { - m.Addressor = o.Addressor() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.Creator != nil { - m.Creator = o.Creator() - } - if o.ID != nil { - m.ID = o.ID() - } - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Species != nil { - m.Species = o.Species() - } - if o.Title != nil { - m.Title = o.Title() - } - if o.Type != nil { - m.Type = o.Type() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.SignalSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use SignalTemplate.CreateMany -func (o SignalTemplate) BuildMany(number int) models.SignalSlice { - m := make(models.SignalSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableSignal(m *models.SignalSetter) { - if !(m.Created.IsValue()) { - val := random_time_Time(nil) - m.Created = omit.From(val) - } - if !(m.Creator.IsValue()) { - val := random_int32(nil) - m.Creator = omit.From(val) - } - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Title.IsValue()) { - val := random_string(nil) - m.Title = omit.From(val) - } - if !(m.Type.IsValue()) { - val := random_enums_Signaltype(nil) - m.Type = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.Signal -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *SignalTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.Signal) error { - var err error - - isAddressorUserDone, _ := signalRelAddressorUserCtx.Value(ctx) - if !isAddressorUserDone && o.r.AddressorUser != nil { - ctx = signalRelAddressorUserCtx.WithValue(ctx, true) - if o.r.AddressorUser.o.alreadyPersisted { - m.R.AddressorUser = o.r.AddressorUser.o.Build() - } else { - var rel0 *models.User - rel0, err = o.r.AddressorUser.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachAddressorUser(ctx, exec, rel0) - if err != nil { - return err - } - } - - } - - return err -} - -// Create builds a signal and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *SignalTemplate) Create(ctx context.Context, exec bob.Executor) (*models.Signal, error) { - var err error - opt := o.BuildSetter() - ensureCreatableSignal(opt) - - if o.r.CreatorUser == nil { - SignalMods.WithNewCreatorUser().Apply(ctx, o) - } - - var rel1 *models.User - - if o.r.CreatorUser.o.alreadyPersisted { - rel1 = o.r.CreatorUser.o.Build() - } else { - rel1, err = o.r.CreatorUser.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.Creator = omit.From(rel1.ID) - - if o.r.Organization == nil { - SignalMods.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.Signals.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.CreatorUser = rel1 - m.R.Organization = rel2 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a signal and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *SignalTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.Signal { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a signal 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 *SignalTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.Signal { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple signals and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o SignalTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.SignalSlice, error) { - var err error - m := make(models.SignalSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple signals and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o SignalTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.SignalSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple signals 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 SignalTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.SignalSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// Signal has methods that act as mods for the SignalTemplate -var SignalMods signalMods - -type signalMods struct{} - -func (m signalMods) RandomizeAllColumns(f *faker.Faker) SignalMod { - return SignalModSlice{ - SignalMods.RandomAddressed(f), - SignalMods.RandomAddressor(f), - SignalMods.RandomCreated(f), - SignalMods.RandomCreator(f), - SignalMods.RandomID(f), - SignalMods.RandomOrganizationID(f), - SignalMods.RandomSpecies(f), - SignalMods.RandomTitle(f), - SignalMods.RandomType(f), - } -} - -// Set the model columns to this value -func (m signalMods) Addressed(val null.Val[time.Time]) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Addressed = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m signalMods) AddressedFunc(f func() null.Val[time.Time]) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Addressed = f - }) -} - -// Clear any values for the column -func (m signalMods) UnsetAddressed() SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Addressed = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m signalMods) RandomAddressed(f *faker.Faker) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Addressed = 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 signalMods) RandomAddressedNotNull(f *faker.Faker) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Addressed = 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 signalMods) Addressor(val null.Val[int32]) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Addressor = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m signalMods) AddressorFunc(f func() null.Val[int32]) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Addressor = f - }) -} - -// Clear any values for the column -func (m signalMods) UnsetAddressor() SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Addressor = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m signalMods) RandomAddressor(f *faker.Faker) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Addressor = 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 signalMods) RandomAddressorNotNull(f *faker.Faker) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Addressor = 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 signalMods) Created(val time.Time) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m signalMods) CreatedFunc(f func() time.Time) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m signalMods) UnsetCreated() SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - 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 signalMods) RandomCreated(f *faker.Faker) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m signalMods) Creator(val int32) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Creator = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m signalMods) CreatorFunc(f func() int32) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Creator = f - }) -} - -// Clear any values for the column -func (m signalMods) UnsetCreator() SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Creator = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m signalMods) RandomCreator(f *faker.Faker) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Creator = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m signalMods) ID(val int32) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m signalMods) IDFunc(f func() int32) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m signalMods) UnsetID() SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m signalMods) RandomID(f *faker.Faker) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m signalMods) OrganizationID(val int32) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m signalMods) OrganizationIDFunc(f func() int32) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m signalMods) UnsetOrganizationID() SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - 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 signalMods) RandomOrganizationID(f *faker.Faker) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m signalMods) Species(val null.Val[enums.Mosquitospecies]) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Species = func() null.Val[enums.Mosquitospecies] { return val } - }) -} - -// Set the Column from the function -func (m signalMods) SpeciesFunc(f func() null.Val[enums.Mosquitospecies]) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Species = f - }) -} - -// Clear any values for the column -func (m signalMods) UnsetSpecies() SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - 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 signalMods) RandomSpecies(f *faker.Faker) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Species = func() null.Val[enums.Mosquitospecies] { - if f == nil { - f = &defaultFaker - } - - val := random_enums_Mosquitospecies(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m signalMods) RandomSpeciesNotNull(f *faker.Faker) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Species = func() null.Val[enums.Mosquitospecies] { - if f == nil { - f = &defaultFaker - } - - val := random_enums_Mosquitospecies(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m signalMods) Title(val string) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Title = func() string { return val } - }) -} - -// Set the Column from the function -func (m signalMods) TitleFunc(f func() string) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Title = f - }) -} - -// Clear any values for the column -func (m signalMods) UnsetTitle() SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Title = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m signalMods) RandomTitle(f *faker.Faker) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Title = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m signalMods) Type(val enums.Signaltype) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Type = func() enums.Signaltype { return val } - }) -} - -// Set the Column from the function -func (m signalMods) TypeFunc(f func() enums.Signaltype) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Type = f - }) -} - -// Clear any values for the column -func (m signalMods) UnsetType() SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - 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 signalMods) RandomType(f *faker.Faker) SignalMod { - return SignalModFunc(func(_ context.Context, o *SignalTemplate) { - o.Type = func() enums.Signaltype { - return random_enums_Signaltype(f) - } - }) -} - -func (m signalMods) WithParentsCascading() SignalMod { - return SignalModFunc(func(ctx context.Context, o *SignalTemplate) { - if isDone, _ := signalWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = signalWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewUserWithContext(ctx, UserMods.WithParentsCascading()) - m.WithAddressorUser(related).Apply(ctx, o) - } - { - - related := o.f.NewUserWithContext(ctx, UserMods.WithParentsCascading()) - m.WithCreatorUser(related).Apply(ctx, o) - } - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m signalMods) WithAddressorUser(rel *UserTemplate) SignalMod { - return SignalModFunc(func(ctx context.Context, o *SignalTemplate) { - o.r.AddressorUser = &signalRAddressorUserR{ - o: rel, - } - }) -} - -func (m signalMods) WithNewAddressorUser(mods ...UserMod) SignalMod { - return SignalModFunc(func(ctx context.Context, o *SignalTemplate) { - related := o.f.NewUserWithContext(ctx, mods...) - - m.WithAddressorUser(related).Apply(ctx, o) - }) -} - -func (m signalMods) WithExistingAddressorUser(em *models.User) SignalMod { - return SignalModFunc(func(ctx context.Context, o *SignalTemplate) { - o.r.AddressorUser = &signalRAddressorUserR{ - o: o.f.FromExistingUser(em), - } - }) -} - -func (m signalMods) WithoutAddressorUser() SignalMod { - return SignalModFunc(func(ctx context.Context, o *SignalTemplate) { - o.r.AddressorUser = nil - }) -} - -func (m signalMods) WithCreatorUser(rel *UserTemplate) SignalMod { - return SignalModFunc(func(ctx context.Context, o *SignalTemplate) { - o.r.CreatorUser = &signalRCreatorUserR{ - o: rel, - } - }) -} - -func (m signalMods) WithNewCreatorUser(mods ...UserMod) SignalMod { - return SignalModFunc(func(ctx context.Context, o *SignalTemplate) { - related := o.f.NewUserWithContext(ctx, mods...) - - m.WithCreatorUser(related).Apply(ctx, o) - }) -} - -func (m signalMods) WithExistingCreatorUser(em *models.User) SignalMod { - return SignalModFunc(func(ctx context.Context, o *SignalTemplate) { - o.r.CreatorUser = &signalRCreatorUserR{ - o: o.f.FromExistingUser(em), - } - }) -} - -func (m signalMods) WithoutCreatorUser() SignalMod { - return SignalModFunc(func(ctx context.Context, o *SignalTemplate) { - o.r.CreatorUser = nil - }) -} - -func (m signalMods) WithOrganization(rel *OrganizationTemplate) SignalMod { - return SignalModFunc(func(ctx context.Context, o *SignalTemplate) { - o.r.Organization = &signalROrganizationR{ - o: rel, - } - }) -} - -func (m signalMods) WithNewOrganization(mods ...OrganizationMod) SignalMod { - return SignalModFunc(func(ctx context.Context, o *SignalTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m signalMods) WithExistingOrganization(em *models.Organization) SignalMod { - return SignalModFunc(func(ctx context.Context, o *SignalTemplate) { - o.r.Organization = &signalROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m signalMods) WithoutOrganization() SignalMod { - return SignalModFunc(func(ctx context.Context, o *SignalTemplate) { - o.r.Organization = nil - }) -} - -func (m signalMods) WithSignalPools(number int, related *SignalPoolTemplate) SignalMod { - return SignalModFunc(func(ctx context.Context, o *SignalTemplate) { - o.r.SignalPools = []*signalRSignalPoolsR{{ - number: number, - o: related, - }} - }) -} - -func (m signalMods) WithNewSignalPools(number int, mods ...SignalPoolMod) SignalMod { - return SignalModFunc(func(ctx context.Context, o *SignalTemplate) { - related := o.f.NewSignalPoolWithContext(ctx, mods...) - m.WithSignalPools(number, related).Apply(ctx, o) - }) -} - -func (m signalMods) AddSignalPools(number int, related *SignalPoolTemplate) SignalMod { - return SignalModFunc(func(ctx context.Context, o *SignalTemplate) { - o.r.SignalPools = append(o.r.SignalPools, &signalRSignalPoolsR{ - number: number, - o: related, - }) - }) -} - -func (m signalMods) AddNewSignalPools(number int, mods ...SignalPoolMod) SignalMod { - return SignalModFunc(func(ctx context.Context, o *SignalTemplate) { - related := o.f.NewSignalPoolWithContext(ctx, mods...) - m.AddSignalPools(number, related).Apply(ctx, o) - }) -} - -func (m signalMods) AddExistingSignalPools(existingModels ...*models.SignalPool) SignalMod { - return SignalModFunc(func(ctx context.Context, o *SignalTemplate) { - for _, em := range existingModels { - o.r.SignalPools = append(o.r.SignalPools, &signalRSignalPoolsR{ - o: o.f.FromExistingSignalPool(em), - }) - } - }) -} - -func (m signalMods) WithoutSignalPools() SignalMod { - return SignalModFunc(func(ctx context.Context, o *SignalTemplate) { - o.r.SignalPools = nil - }) -} diff --git a/db/factory/signal_pool.bob.go b/db/factory/signal_pool.bob.go deleted file mode 100644 index 4d2aeff6..00000000 --- a/db/factory/signal_pool.bob.go +++ /dev/null @@ -1,262 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - - models "github.com/Gleipnir-Technology/nidus-sync/db/models" - "github.com/jaswdr/faker/v2" -) - -type SignalPoolMod interface { - Apply(context.Context, *SignalPoolTemplate) -} - -type SignalPoolModFunc func(context.Context, *SignalPoolTemplate) - -func (f SignalPoolModFunc) Apply(ctx context.Context, n *SignalPoolTemplate) { - f(ctx, n) -} - -type SignalPoolModSlice []SignalPoolMod - -func (mods SignalPoolModSlice) Apply(ctx context.Context, n *SignalPoolTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// SignalPoolTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type SignalPoolTemplate struct { - PoolID func() int32 - SignalID func() int32 - - r signalPoolR - f *Factory - - alreadyPersisted bool -} - -type signalPoolR struct { - Pool *signalPoolRPoolR - Signal *signalPoolRSignalR -} - -type signalPoolRPoolR struct { - o *PoolTemplate -} -type signalPoolRSignalR struct { - o *SignalTemplate -} - -// Apply mods to the SignalPoolTemplate -func (o *SignalPoolTemplate) Apply(ctx context.Context, mods ...SignalPoolMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.SignalPool -// according to the relationships in the template. Nothing is inserted into the db -func (t SignalPoolTemplate) setModelRels(o *models.SignalPool) { - if t.r.Pool != nil { - rel := t.r.Pool.o.Build() - rel.R.SignalPools = append(rel.R.SignalPools, o) - o.PoolID = rel.ID // h2 - o.R.Pool = rel - } - - if t.r.Signal != nil { - rel := t.r.Signal.o.Build() - rel.R.SignalPools = append(rel.R.SignalPools, o) - o.SignalID = rel.ID // h2 - o.R.Signal = rel - } -} - -// Build returns an *models.SignalPool -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use SignalPoolTemplate.Create -func (o SignalPoolTemplate) Build() *models.SignalPool { - m := &models.SignalPool{} - - if o.PoolID != nil { - m.PoolID = o.PoolID() - } - if o.SignalID != nil { - m.SignalID = o.SignalID() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.SignalPoolSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use SignalPoolTemplate.CreateMany -func (o SignalPoolTemplate) BuildMany(number int) models.SignalPoolSlice { - m := make(models.SignalPoolSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -// SignalPool has methods that act as mods for the SignalPoolTemplate -var SignalPoolMods signalPoolMods - -type signalPoolMods struct{} - -func (m signalPoolMods) RandomizeAllColumns(f *faker.Faker) SignalPoolMod { - return SignalPoolModSlice{ - SignalPoolMods.RandomPoolID(f), - SignalPoolMods.RandomSignalID(f), - } -} - -// Set the model columns to this value -func (m signalPoolMods) PoolID(val int32) SignalPoolMod { - return SignalPoolModFunc(func(_ context.Context, o *SignalPoolTemplate) { - o.PoolID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m signalPoolMods) PoolIDFunc(f func() int32) SignalPoolMod { - return SignalPoolModFunc(func(_ context.Context, o *SignalPoolTemplate) { - o.PoolID = f - }) -} - -// Clear any values for the column -func (m signalPoolMods) UnsetPoolID() SignalPoolMod { - return SignalPoolModFunc(func(_ context.Context, o *SignalPoolTemplate) { - o.PoolID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m signalPoolMods) RandomPoolID(f *faker.Faker) SignalPoolMod { - return SignalPoolModFunc(func(_ context.Context, o *SignalPoolTemplate) { - o.PoolID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m signalPoolMods) SignalID(val int32) SignalPoolMod { - return SignalPoolModFunc(func(_ context.Context, o *SignalPoolTemplate) { - o.SignalID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m signalPoolMods) SignalIDFunc(f func() int32) SignalPoolMod { - return SignalPoolModFunc(func(_ context.Context, o *SignalPoolTemplate) { - o.SignalID = f - }) -} - -// Clear any values for the column -func (m signalPoolMods) UnsetSignalID() SignalPoolMod { - return SignalPoolModFunc(func(_ context.Context, o *SignalPoolTemplate) { - o.SignalID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m signalPoolMods) RandomSignalID(f *faker.Faker) SignalPoolMod { - return SignalPoolModFunc(func(_ context.Context, o *SignalPoolTemplate) { - o.SignalID = func() int32 { - return random_int32(f) - } - }) -} - -func (m signalPoolMods) WithParentsCascading() SignalPoolMod { - return SignalPoolModFunc(func(ctx context.Context, o *SignalPoolTemplate) { - if isDone, _ := signalPoolWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = signalPoolWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewPoolWithContext(ctx, PoolMods.WithParentsCascading()) - m.WithPool(related).Apply(ctx, o) - } - { - - related := o.f.NewSignalWithContext(ctx, SignalMods.WithParentsCascading()) - m.WithSignal(related).Apply(ctx, o) - } - }) -} - -func (m signalPoolMods) WithPool(rel *PoolTemplate) SignalPoolMod { - return SignalPoolModFunc(func(ctx context.Context, o *SignalPoolTemplate) { - o.r.Pool = &signalPoolRPoolR{ - o: rel, - } - }) -} - -func (m signalPoolMods) WithNewPool(mods ...PoolMod) SignalPoolMod { - return SignalPoolModFunc(func(ctx context.Context, o *SignalPoolTemplate) { - related := o.f.NewPoolWithContext(ctx, mods...) - - m.WithPool(related).Apply(ctx, o) - }) -} - -func (m signalPoolMods) WithExistingPool(em *models.Pool) SignalPoolMod { - return SignalPoolModFunc(func(ctx context.Context, o *SignalPoolTemplate) { - o.r.Pool = &signalPoolRPoolR{ - o: o.f.FromExistingPool(em), - } - }) -} - -func (m signalPoolMods) WithoutPool() SignalPoolMod { - return SignalPoolModFunc(func(ctx context.Context, o *SignalPoolTemplate) { - o.r.Pool = nil - }) -} - -func (m signalPoolMods) WithSignal(rel *SignalTemplate) SignalPoolMod { - return SignalPoolModFunc(func(ctx context.Context, o *SignalPoolTemplate) { - o.r.Signal = &signalPoolRSignalR{ - o: rel, - } - }) -} - -func (m signalPoolMods) WithNewSignal(mods ...SignalMod) SignalPoolMod { - return SignalPoolModFunc(func(ctx context.Context, o *SignalPoolTemplate) { - related := o.f.NewSignalWithContext(ctx, mods...) - - m.WithSignal(related).Apply(ctx, o) - }) -} - -func (m signalPoolMods) WithExistingSignal(em *models.Signal) SignalPoolMod { - return SignalPoolModFunc(func(ctx context.Context, o *SignalPoolTemplate) { - o.r.Signal = &signalPoolRSignalR{ - o: o.f.FromExistingSignal(em), - } - }) -} - -func (m signalPoolMods) WithoutSignal() SignalPoolMod { - return SignalPoolModFunc(func(ctx context.Context, o *SignalPoolTemplate) { - o.r.Signal = nil - }) -} diff --git a/db/factory/site.bob.go b/db/factory/site.bob.go deleted file mode 100644 index 7f62bbb5..00000000 --- a/db/factory/site.bob.go +++ /dev/null @@ -1,1380 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/types/pgtypes" - 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" -) - -type SiteMod interface { - Apply(context.Context, *SiteTemplate) -} - -type SiteModFunc func(context.Context, *SiteTemplate) - -func (f SiteModFunc) Apply(ctx context.Context, n *SiteTemplate) { - f(ctx, n) -} - -type SiteModSlice []SiteMod - -func (mods SiteModSlice) Apply(ctx context.Context, n *SiteTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// SiteTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type SiteTemplate struct { - AddressID func() int32 - Created func() time.Time - CreatorID func() int32 - FileID func() null.Val[int32] - ID func() int32 - Notes func() string - OrganizationID func() int32 - OwnerName func() string - OwnerPhoneE164 func() null.Val[string] - ParcelID func() null.Val[int32] - ResidentOwned func() null.Val[bool] - Tags func() pgtypes.HStore - Version func() int32 - - r siteR - f *Factory - - alreadyPersisted bool -} - -type siteR struct { - Leads []*siteRLeadsR - Pools []*siteRPoolsR - Residents []*siteRResidentsR - Address *siteRAddressR - CreatorUser *siteRCreatorUserR - File *siteRFileR - Parcel *siteRParcelR -} - -type siteRLeadsR struct { - number int - o *LeadTemplate -} -type siteRPoolsR struct { - number int - o *PoolTemplate -} -type siteRResidentsR struct { - number int - o *ResidentTemplate -} -type siteRAddressR struct { - o *AddressTemplate -} -type siteRCreatorUserR struct { - o *UserTemplate -} -type siteRFileR struct { - o *FileuploadFileTemplate -} -type siteRParcelR struct { - o *ParcelTemplate -} - -// Apply mods to the SiteTemplate -func (o *SiteTemplate) Apply(ctx context.Context, mods ...SiteMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.Site -// according to the relationships in the template. Nothing is inserted into the db -func (t SiteTemplate) setModelRels(o *models.Site) { - if t.r.Leads != nil { - rel := models.LeadSlice{} - for _, r := range t.r.Leads { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.SiteID = null.From(o.ID) // h2 - rel.SiteVersion = null.From(o.Version) // h2 - rel.R.Site = o - } - rel = append(rel, related...) - } - o.R.Leads = rel - } - - if t.r.Pools != nil { - rel := models.PoolSlice{} - for _, r := range t.r.Pools { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.SiteID = o.ID // h2 - rel.SiteVersion = o.Version // h2 - rel.R.Site = o - } - rel = append(rel, related...) - } - o.R.Pools = rel - } - - if t.r.Residents != nil { - rel := models.ResidentSlice{} - for _, r := range t.r.Residents { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.SiteID = o.ID // h2 - rel.SiteVersion = o.Version // h2 - rel.R.Site = o - } - rel = append(rel, related...) - } - o.R.Residents = rel - } - - if t.r.Address != nil { - rel := t.r.Address.o.Build() - rel.R.Site = o - o.AddressID = rel.ID // h2 - o.R.Address = rel - } - - if t.r.CreatorUser != nil { - rel := t.r.CreatorUser.o.Build() - rel.R.CreatorSites = append(rel.R.CreatorSites, o) - o.CreatorID = rel.ID // h2 - o.R.CreatorUser = rel - } - - if t.r.File != nil { - rel := t.r.File.o.Build() - rel.R.Sites = append(rel.R.Sites, o) - o.FileID = null.From(rel.ID) // h2 - o.R.File = rel - } - - if t.r.Parcel != nil { - rel := t.r.Parcel.o.Build() - rel.R.Sites = append(rel.R.Sites, o) - o.ParcelID = null.From(rel.ID) // h2 - o.R.Parcel = rel - } -} - -// BuildSetter returns an *models.SiteSetter -// this does nothing with the relationship templates -func (o SiteTemplate) BuildSetter() *models.SiteSetter { - m := &models.SiteSetter{} - - if o.AddressID != nil { - val := o.AddressID() - m.AddressID = omit.From(val) - } - 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.FileID != nil { - val := o.FileID() - m.FileID = omitnull.FromNull(val) - } - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.Notes != nil { - val := o.Notes() - m.Notes = omit.From(val) - } - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.OwnerName != nil { - val := o.OwnerName() - m.OwnerName = omit.From(val) - } - if o.OwnerPhoneE164 != nil { - val := o.OwnerPhoneE164() - m.OwnerPhoneE164 = omitnull.FromNull(val) - } - if o.ParcelID != nil { - val := o.ParcelID() - m.ParcelID = omitnull.FromNull(val) - } - if o.ResidentOwned != nil { - val := o.ResidentOwned() - m.ResidentOwned = omitnull.FromNull(val) - } - if o.Tags != nil { - val := o.Tags() - m.Tags = omit.From(val) - } - if o.Version != nil { - val := o.Version() - m.Version = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.SiteSetter -// this does nothing with the relationship templates -func (o SiteTemplate) BuildManySetter(number int) []*models.SiteSetter { - m := make([]*models.SiteSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.Site -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use SiteTemplate.Create -func (o SiteTemplate) Build() *models.Site { - m := &models.Site{} - - if o.AddressID != nil { - m.AddressID = o.AddressID() - } - if o.Created != nil { - m.Created = o.Created() - } - if o.CreatorID != nil { - m.CreatorID = o.CreatorID() - } - if o.FileID != nil { - m.FileID = o.FileID() - } - if o.ID != nil { - m.ID = o.ID() - } - if o.Notes != nil { - m.Notes = o.Notes() - } - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.OwnerName != nil { - m.OwnerName = o.OwnerName() - } - if o.OwnerPhoneE164 != nil { - m.OwnerPhoneE164 = o.OwnerPhoneE164() - } - if o.ParcelID != nil { - m.ParcelID = o.ParcelID() - } - if o.ResidentOwned != nil { - m.ResidentOwned = o.ResidentOwned() - } - if o.Tags != nil { - m.Tags = o.Tags() - } - if o.Version != nil { - m.Version = o.Version() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.SiteSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use SiteTemplate.CreateMany -func (o SiteTemplate) BuildMany(number int) models.SiteSlice { - m := make(models.SiteSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableSite(m *models.SiteSetter) { - if !(m.AddressID.IsValue()) { - val := random_int32(nil) - m.AddressID = omit.From(val) - } - 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.Notes.IsValue()) { - val := random_string(nil) - m.Notes = omit.From(val) - } - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.OwnerName.IsValue()) { - val := random_string(nil) - m.OwnerName = omit.From(val) - } - if !(m.Tags.IsValue()) { - val := random_pgtypes_HStore(nil) - m.Tags = 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.Site -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *SiteTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.Site) error { - var err error - - isLeadsDone, _ := siteRelLeadsCtx.Value(ctx) - if !isLeadsDone && o.r.Leads != nil { - ctx = siteRelLeadsCtx.WithValue(ctx, true) - for _, r := range o.r.Leads { - if r.o.alreadyPersisted { - m.R.Leads = append(m.R.Leads, r.o.Build()) - } else { - rel0, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachLeads(ctx, exec, rel0...) - if err != nil { - return err - } - } - } - } - - isPoolsDone, _ := siteRelPoolsCtx.Value(ctx) - if !isPoolsDone && o.r.Pools != nil { - ctx = siteRelPoolsCtx.WithValue(ctx, true) - for _, r := range o.r.Pools { - if r.o.alreadyPersisted { - m.R.Pools = append(m.R.Pools, r.o.Build()) - } else { - rel1, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachPools(ctx, exec, rel1...) - if err != nil { - return err - } - } - } - } - - isResidentsDone, _ := siteRelResidentsCtx.Value(ctx) - if !isResidentsDone && o.r.Residents != nil { - ctx = siteRelResidentsCtx.WithValue(ctx, true) - for _, r := range o.r.Residents { - if r.o.alreadyPersisted { - m.R.Residents = append(m.R.Residents, r.o.Build()) - } else { - rel2, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachResidents(ctx, exec, rel2...) - if err != nil { - return err - } - } - } - } - - isFileDone, _ := siteRelFileCtx.Value(ctx) - if !isFileDone && o.r.File != nil { - ctx = siteRelFileCtx.WithValue(ctx, true) - if o.r.File.o.alreadyPersisted { - m.R.File = o.r.File.o.Build() - } else { - var rel5 *models.FileuploadFile - rel5, err = o.r.File.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachFile(ctx, exec, rel5) - if err != nil { - return err - } - } - - } - - isParcelDone, _ := siteRelParcelCtx.Value(ctx) - if !isParcelDone && o.r.Parcel != nil { - ctx = siteRelParcelCtx.WithValue(ctx, true) - if o.r.Parcel.o.alreadyPersisted { - m.R.Parcel = o.r.Parcel.o.Build() - } else { - var rel6 *models.Parcel - rel6, err = o.r.Parcel.o.Create(ctx, exec) - if err != nil { - return err - } - err = m.AttachParcel(ctx, exec, rel6) - if err != nil { - return err - } - } - - } - - return err -} - -// Create builds a site and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *SiteTemplate) Create(ctx context.Context, exec bob.Executor) (*models.Site, error) { - var err error - opt := o.BuildSetter() - ensureCreatableSite(opt) - - if o.r.Address == nil { - SiteMods.WithNewAddress().Apply(ctx, o) - } - - var rel3 *models.Address - - if o.r.Address.o.alreadyPersisted { - rel3 = o.r.Address.o.Build() - } else { - rel3, err = o.r.Address.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.AddressID = omit.From(rel3.ID) - - if o.r.CreatorUser == nil { - SiteMods.WithNewCreatorUser().Apply(ctx, o) - } - - var rel4 *models.User - - if o.r.CreatorUser.o.alreadyPersisted { - rel4 = o.r.CreatorUser.o.Build() - } else { - rel4, err = o.r.CreatorUser.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.CreatorID = omit.From(rel4.ID) - - m, err := models.Sites.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.Address = rel3 - m.R.CreatorUser = rel4 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a site and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *SiteTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.Site { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a site 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 *SiteTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.Site { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple sites and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o SiteTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.SiteSlice, error) { - var err error - m := make(models.SiteSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple sites and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o SiteTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.SiteSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple sites 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 SiteTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.SiteSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// Site has methods that act as mods for the SiteTemplate -var SiteMods siteMods - -type siteMods struct{} - -func (m siteMods) RandomizeAllColumns(f *faker.Faker) SiteMod { - return SiteModSlice{ - SiteMods.RandomAddressID(f), - SiteMods.RandomCreated(f), - SiteMods.RandomCreatorID(f), - SiteMods.RandomFileID(f), - SiteMods.RandomID(f), - SiteMods.RandomNotes(f), - SiteMods.RandomOrganizationID(f), - SiteMods.RandomOwnerName(f), - SiteMods.RandomOwnerPhoneE164(f), - SiteMods.RandomParcelID(f), - SiteMods.RandomResidentOwned(f), - SiteMods.RandomTags(f), - SiteMods.RandomVersion(f), - } -} - -// Set the model columns to this value -func (m siteMods) AddressID(val int32) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.AddressID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m siteMods) AddressIDFunc(f func() int32) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.AddressID = f - }) -} - -// Clear any values for the column -func (m siteMods) UnsetAddressID() SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.AddressID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m siteMods) RandomAddressID(f *faker.Faker) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.AddressID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m siteMods) Created(val time.Time) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.Created = func() time.Time { return val } - }) -} - -// Set the Column from the function -func (m siteMods) CreatedFunc(f func() time.Time) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.Created = f - }) -} - -// Clear any values for the column -func (m siteMods) UnsetCreated() SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - 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 siteMods) RandomCreated(f *faker.Faker) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.Created = func() time.Time { - return random_time_Time(f) - } - }) -} - -// Set the model columns to this value -func (m siteMods) CreatorID(val int32) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.CreatorID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m siteMods) CreatorIDFunc(f func() int32) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.CreatorID = f - }) -} - -// Clear any values for the column -func (m siteMods) UnsetCreatorID() SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - 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 siteMods) RandomCreatorID(f *faker.Faker) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.CreatorID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m siteMods) FileID(val null.Val[int32]) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.FileID = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m siteMods) FileIDFunc(f func() null.Val[int32]) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.FileID = f - }) -} - -// Clear any values for the column -func (m siteMods) UnsetFileID() SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.FileID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m siteMods) RandomFileID(f *faker.Faker) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.FileID = 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 siteMods) RandomFileIDNotNull(f *faker.Faker) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.FileID = 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 siteMods) ID(val int32) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m siteMods) IDFunc(f func() int32) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m siteMods) UnsetID() SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m siteMods) RandomID(f *faker.Faker) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m siteMods) Notes(val string) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.Notes = func() string { return val } - }) -} - -// Set the Column from the function -func (m siteMods) NotesFunc(f func() string) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.Notes = f - }) -} - -// Clear any values for the column -func (m siteMods) UnsetNotes() SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.Notes = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m siteMods) RandomNotes(f *faker.Faker) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.Notes = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m siteMods) OrganizationID(val int32) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m siteMods) OrganizationIDFunc(f func() int32) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m siteMods) UnsetOrganizationID() SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - 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 siteMods) RandomOrganizationID(f *faker.Faker) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m siteMods) OwnerName(val string) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.OwnerName = func() string { return val } - }) -} - -// Set the Column from the function -func (m siteMods) OwnerNameFunc(f func() string) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.OwnerName = f - }) -} - -// Clear any values for the column -func (m siteMods) UnsetOwnerName() SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.OwnerName = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m siteMods) RandomOwnerName(f *faker.Faker) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.OwnerName = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m siteMods) OwnerPhoneE164(val null.Val[string]) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.OwnerPhoneE164 = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m siteMods) OwnerPhoneE164Func(f func() null.Val[string]) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.OwnerPhoneE164 = f - }) -} - -// Clear any values for the column -func (m siteMods) UnsetOwnerPhoneE164() SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.OwnerPhoneE164 = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m siteMods) RandomOwnerPhoneE164(f *faker.Faker) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.OwnerPhoneE164 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m siteMods) RandomOwnerPhoneE164NotNull(f *faker.Faker) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.OwnerPhoneE164 = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m siteMods) ParcelID(val null.Val[int32]) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.ParcelID = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m siteMods) ParcelIDFunc(f func() null.Val[int32]) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.ParcelID = f - }) -} - -// Clear any values for the column -func (m siteMods) UnsetParcelID() SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.ParcelID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m siteMods) RandomParcelID(f *faker.Faker) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.ParcelID = 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 siteMods) RandomParcelIDNotNull(f *faker.Faker) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.ParcelID = 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 siteMods) ResidentOwned(val null.Val[bool]) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.ResidentOwned = func() null.Val[bool] { return val } - }) -} - -// Set the Column from the function -func (m siteMods) ResidentOwnedFunc(f func() null.Val[bool]) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.ResidentOwned = f - }) -} - -// Clear any values for the column -func (m siteMods) UnsetResidentOwned() SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.ResidentOwned = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m siteMods) RandomResidentOwned(f *faker.Faker) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.ResidentOwned = func() null.Val[bool] { - if f == nil { - f = &defaultFaker - } - - val := random_bool(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m siteMods) RandomResidentOwnedNotNull(f *faker.Faker) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.ResidentOwned = func() null.Val[bool] { - if f == nil { - f = &defaultFaker - } - - val := random_bool(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m siteMods) Tags(val pgtypes.HStore) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.Tags = func() pgtypes.HStore { return val } - }) -} - -// Set the Column from the function -func (m siteMods) TagsFunc(f func() pgtypes.HStore) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.Tags = f - }) -} - -// Clear any values for the column -func (m siteMods) UnsetTags() SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.Tags = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m siteMods) RandomTags(f *faker.Faker) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.Tags = func() pgtypes.HStore { - return random_pgtypes_HStore(f) - } - }) -} - -// Set the model columns to this value -func (m siteMods) Version(val int32) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.Version = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m siteMods) VersionFunc(f func() int32) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.Version = f - }) -} - -// Clear any values for the column -func (m siteMods) UnsetVersion() SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - 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 siteMods) RandomVersion(f *faker.Faker) SiteMod { - return SiteModFunc(func(_ context.Context, o *SiteTemplate) { - o.Version = func() int32 { - return random_int32(f) - } - }) -} - -func (m siteMods) WithParentsCascading() SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - if isDone, _ := siteWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = siteWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewAddressWithContext(ctx, AddressMods.WithParentsCascading()) - m.WithAddress(related).Apply(ctx, o) - } - { - - related := o.f.NewUserWithContext(ctx, UserMods.WithParentsCascading()) - m.WithCreatorUser(related).Apply(ctx, o) - } - { - - related := o.f.NewFileuploadFileWithContext(ctx, FileuploadFileMods.WithParentsCascading()) - m.WithFile(related).Apply(ctx, o) - } - { - - related := o.f.NewParcelWithContext(ctx, ParcelMods.WithParentsCascading()) - m.WithParcel(related).Apply(ctx, o) - } - }) -} - -func (m siteMods) WithAddress(rel *AddressTemplate) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - o.r.Address = &siteRAddressR{ - o: rel, - } - }) -} - -func (m siteMods) WithNewAddress(mods ...AddressMod) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - related := o.f.NewAddressWithContext(ctx, mods...) - - m.WithAddress(related).Apply(ctx, o) - }) -} - -func (m siteMods) WithExistingAddress(em *models.Address) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - o.r.Address = &siteRAddressR{ - o: o.f.FromExistingAddress(em), - } - }) -} - -func (m siteMods) WithoutAddress() SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - o.r.Address = nil - }) -} - -func (m siteMods) WithCreatorUser(rel *UserTemplate) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - o.r.CreatorUser = &siteRCreatorUserR{ - o: rel, - } - }) -} - -func (m siteMods) WithNewCreatorUser(mods ...UserMod) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - related := o.f.NewUserWithContext(ctx, mods...) - - m.WithCreatorUser(related).Apply(ctx, o) - }) -} - -func (m siteMods) WithExistingCreatorUser(em *models.User) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - o.r.CreatorUser = &siteRCreatorUserR{ - o: o.f.FromExistingUser(em), - } - }) -} - -func (m siteMods) WithoutCreatorUser() SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - o.r.CreatorUser = nil - }) -} - -func (m siteMods) WithFile(rel *FileuploadFileTemplate) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - o.r.File = &siteRFileR{ - o: rel, - } - }) -} - -func (m siteMods) WithNewFile(mods ...FileuploadFileMod) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - related := o.f.NewFileuploadFileWithContext(ctx, mods...) - - m.WithFile(related).Apply(ctx, o) - }) -} - -func (m siteMods) WithExistingFile(em *models.FileuploadFile) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - o.r.File = &siteRFileR{ - o: o.f.FromExistingFileuploadFile(em), - } - }) -} - -func (m siteMods) WithoutFile() SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - o.r.File = nil - }) -} - -func (m siteMods) WithParcel(rel *ParcelTemplate) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - o.r.Parcel = &siteRParcelR{ - o: rel, - } - }) -} - -func (m siteMods) WithNewParcel(mods ...ParcelMod) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - related := o.f.NewParcelWithContext(ctx, mods...) - - m.WithParcel(related).Apply(ctx, o) - }) -} - -func (m siteMods) WithExistingParcel(em *models.Parcel) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - o.r.Parcel = &siteRParcelR{ - o: o.f.FromExistingParcel(em), - } - }) -} - -func (m siteMods) WithoutParcel() SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - o.r.Parcel = nil - }) -} - -func (m siteMods) WithLeads(number int, related *LeadTemplate) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - o.r.Leads = []*siteRLeadsR{{ - number: number, - o: related, - }} - }) -} - -func (m siteMods) WithNewLeads(number int, mods ...LeadMod) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - related := o.f.NewLeadWithContext(ctx, mods...) - m.WithLeads(number, related).Apply(ctx, o) - }) -} - -func (m siteMods) AddLeads(number int, related *LeadTemplate) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - o.r.Leads = append(o.r.Leads, &siteRLeadsR{ - number: number, - o: related, - }) - }) -} - -func (m siteMods) AddNewLeads(number int, mods ...LeadMod) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - related := o.f.NewLeadWithContext(ctx, mods...) - m.AddLeads(number, related).Apply(ctx, o) - }) -} - -func (m siteMods) AddExistingLeads(existingModels ...*models.Lead) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - for _, em := range existingModels { - o.r.Leads = append(o.r.Leads, &siteRLeadsR{ - o: o.f.FromExistingLead(em), - }) - } - }) -} - -func (m siteMods) WithoutLeads() SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - o.r.Leads = nil - }) -} - -func (m siteMods) WithPools(number int, related *PoolTemplate) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - o.r.Pools = []*siteRPoolsR{{ - number: number, - o: related, - }} - }) -} - -func (m siteMods) WithNewPools(number int, mods ...PoolMod) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - related := o.f.NewPoolWithContext(ctx, mods...) - m.WithPools(number, related).Apply(ctx, o) - }) -} - -func (m siteMods) AddPools(number int, related *PoolTemplate) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - o.r.Pools = append(o.r.Pools, &siteRPoolsR{ - number: number, - o: related, - }) - }) -} - -func (m siteMods) AddNewPools(number int, mods ...PoolMod) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - related := o.f.NewPoolWithContext(ctx, mods...) - m.AddPools(number, related).Apply(ctx, o) - }) -} - -func (m siteMods) AddExistingPools(existingModels ...*models.Pool) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - for _, em := range existingModels { - o.r.Pools = append(o.r.Pools, &siteRPoolsR{ - o: o.f.FromExistingPool(em), - }) - } - }) -} - -func (m siteMods) WithoutPools() SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - o.r.Pools = nil - }) -} - -func (m siteMods) WithResidents(number int, related *ResidentTemplate) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - o.r.Residents = []*siteRResidentsR{{ - number: number, - o: related, - }} - }) -} - -func (m siteMods) WithNewResidents(number int, mods ...ResidentMod) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - related := o.f.NewResidentWithContext(ctx, mods...) - m.WithResidents(number, related).Apply(ctx, o) - }) -} - -func (m siteMods) AddResidents(number int, related *ResidentTemplate) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - o.r.Residents = append(o.r.Residents, &siteRResidentsR{ - number: number, - o: related, - }) - }) -} - -func (m siteMods) AddNewResidents(number int, mods ...ResidentMod) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - related := o.f.NewResidentWithContext(ctx, mods...) - m.AddResidents(number, related).Apply(ctx, o) - }) -} - -func (m siteMods) AddExistingResidents(existingModels ...*models.Resident) SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - for _, em := range existingModels { - o.r.Residents = append(o.r.Residents, &siteRResidentsR{ - o: o.f.FromExistingResident(em), - }) - } - }) -} - -func (m siteMods) WithoutResidents() SiteMod { - return SiteModFunc(func(ctx context.Context, o *SiteTemplate) { - o.r.Residents = nil - }) -} diff --git a/db/factory/spatial_ref_sys.bob.go b/db/factory/spatial_ref_sys.bob.go deleted file mode 100644 index f59a43da..00000000 --- a/db/factory/spatial_ref_sys.bob.go +++ /dev/null @@ -1,505 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package factory - -import ( - "context" - "testing" - - "github.com/Gleipnir-Technology/bob" - 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" -) - -type SpatialRefSyMod interface { - Apply(context.Context, *SpatialRefSyTemplate) -} - -type SpatialRefSyModFunc func(context.Context, *SpatialRefSyTemplate) - -func (f SpatialRefSyModFunc) Apply(ctx context.Context, n *SpatialRefSyTemplate) { - f(ctx, n) -} - -type SpatialRefSyModSlice []SpatialRefSyMod - -func (mods SpatialRefSyModSlice) Apply(ctx context.Context, n *SpatialRefSyTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// SpatialRefSyTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type SpatialRefSyTemplate struct { - Srid func() int32 - AuthName func() null.Val[string] - AuthSrid func() null.Val[int32] - Srtext func() null.Val[string] - Proj4text func() null.Val[string] - - f *Factory - - alreadyPersisted bool -} - -// Apply mods to the SpatialRefSyTemplate -func (o *SpatialRefSyTemplate) Apply(ctx context.Context, mods ...SpatialRefSyMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// setModelRels creates and sets the relationships on *models.SpatialRefSy -// according to the relationships in the template. Nothing is inserted into the db -func (t SpatialRefSyTemplate) setModelRels(o *models.SpatialRefSy) {} - -// BuildSetter returns an *models.SpatialRefSySetter -// this does nothing with the relationship templates -func (o SpatialRefSyTemplate) BuildSetter() *models.SpatialRefSySetter { - m := &models.SpatialRefSySetter{} - - if o.Srid != nil { - val := o.Srid() - m.Srid = omit.From(val) - } - if o.AuthName != nil { - val := o.AuthName() - m.AuthName = omitnull.FromNull(val) - } - if o.AuthSrid != nil { - val := o.AuthSrid() - m.AuthSrid = omitnull.FromNull(val) - } - if o.Srtext != nil { - val := o.Srtext() - m.Srtext = omitnull.FromNull(val) - } - if o.Proj4text != nil { - val := o.Proj4text() - m.Proj4text = omitnull.FromNull(val) - } - - return m -} - -// BuildManySetter returns an []*models.SpatialRefSySetter -// this does nothing with the relationship templates -func (o SpatialRefSyTemplate) BuildManySetter(number int) []*models.SpatialRefSySetter { - m := make([]*models.SpatialRefSySetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.SpatialRefSy -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use SpatialRefSyTemplate.Create -func (o SpatialRefSyTemplate) Build() *models.SpatialRefSy { - m := &models.SpatialRefSy{} - - if o.Srid != nil { - m.Srid = o.Srid() - } - if o.AuthName != nil { - m.AuthName = o.AuthName() - } - if o.AuthSrid != nil { - m.AuthSrid = o.AuthSrid() - } - if o.Srtext != nil { - m.Srtext = o.Srtext() - } - if o.Proj4text != nil { - m.Proj4text = o.Proj4text() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.SpatialRefSySlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use SpatialRefSyTemplate.CreateMany -func (o SpatialRefSyTemplate) BuildMany(number int) models.SpatialRefSySlice { - m := make(models.SpatialRefSySlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableSpatialRefSy(m *models.SpatialRefSySetter) { - if !(m.Srid.IsValue()) { - val := random_int32(nil) - m.Srid = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.SpatialRefSy -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *SpatialRefSyTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.SpatialRefSy) error { - var err error - - return err -} - -// Create builds a spatialRefSy and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *SpatialRefSyTemplate) Create(ctx context.Context, exec bob.Executor) (*models.SpatialRefSy, error) { - var err error - opt := o.BuildSetter() - ensureCreatableSpatialRefSy(opt) - - m, err := models.SpatialRefSys.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a spatialRefSy and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *SpatialRefSyTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.SpatialRefSy { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a spatialRefSy and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// It calls `tb.Fatal(err)` on the test/benchmark if an error occurs -func (o *SpatialRefSyTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.SpatialRefSy { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple spatialRefSys and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o SpatialRefSyTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.SpatialRefSySlice, error) { - var err error - m := make(models.SpatialRefSySlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple spatialRefSys and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o SpatialRefSyTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.SpatialRefSySlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple spatialRefSys and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// It calls `tb.Fatal(err)` on the test/benchmark if an error occurs -func (o SpatialRefSyTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.SpatialRefSySlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// SpatialRefSy has methods that act as mods for the SpatialRefSyTemplate -var SpatialRefSyMods spatialRefSyMods - -type spatialRefSyMods struct{} - -func (m spatialRefSyMods) RandomizeAllColumns(f *faker.Faker) SpatialRefSyMod { - return SpatialRefSyModSlice{ - SpatialRefSyMods.RandomSrid(f), - SpatialRefSyMods.RandomAuthName(f), - SpatialRefSyMods.RandomAuthSrid(f), - SpatialRefSyMods.RandomSrtext(f), - SpatialRefSyMods.RandomProj4text(f), - } -} - -// Set the model columns to this value -func (m spatialRefSyMods) Srid(val int32) SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.Srid = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m spatialRefSyMods) SridFunc(f func() int32) SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.Srid = f - }) -} - -// Clear any values for the column -func (m spatialRefSyMods) UnsetSrid() SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.Srid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m spatialRefSyMods) RandomSrid(f *faker.Faker) SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.Srid = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m spatialRefSyMods) AuthName(val null.Val[string]) SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.AuthName = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m spatialRefSyMods) AuthNameFunc(f func() null.Val[string]) SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.AuthName = f - }) -} - -// Clear any values for the column -func (m spatialRefSyMods) UnsetAuthName() SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.AuthName = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m spatialRefSyMods) RandomAuthName(f *faker.Faker) SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.AuthName = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "256") - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m spatialRefSyMods) RandomAuthNameNotNull(f *faker.Faker) SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.AuthName = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "256") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m spatialRefSyMods) AuthSrid(val null.Val[int32]) SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.AuthSrid = func() null.Val[int32] { return val } - }) -} - -// Set the Column from the function -func (m spatialRefSyMods) AuthSridFunc(f func() null.Val[int32]) SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.AuthSrid = f - }) -} - -// Clear any values for the column -func (m spatialRefSyMods) UnsetAuthSrid() SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.AuthSrid = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m spatialRefSyMods) RandomAuthSrid(f *faker.Faker) SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.AuthSrid = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m spatialRefSyMods) RandomAuthSridNotNull(f *faker.Faker) SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.AuthSrid = func() null.Val[int32] { - if f == nil { - f = &defaultFaker - } - - val := random_int32(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m spatialRefSyMods) Srtext(val null.Val[string]) SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.Srtext = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m spatialRefSyMods) SrtextFunc(f func() null.Val[string]) SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.Srtext = f - }) -} - -// Clear any values for the column -func (m spatialRefSyMods) UnsetSrtext() SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.Srtext = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m spatialRefSyMods) RandomSrtext(f *faker.Faker) SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.Srtext = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "2048") - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m spatialRefSyMods) RandomSrtextNotNull(f *faker.Faker) SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.Srtext = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "2048") - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m spatialRefSyMods) Proj4text(val null.Val[string]) SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.Proj4text = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m spatialRefSyMods) Proj4textFunc(f func() null.Val[string]) SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.Proj4text = f - }) -} - -// Clear any values for the column -func (m spatialRefSyMods) UnsetProj4text() SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.Proj4text = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m spatialRefSyMods) RandomProj4text(f *faker.Faker) SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.Proj4text = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "2048") - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m spatialRefSyMods) RandomProj4textNotNull(f *faker.Faker) SpatialRefSyMod { - return SpatialRefSyModFunc(func(_ context.Context, o *SpatialRefSyTemplate) { - o.Proj4text = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f, "2048") - return null.From(val) - } - }) -} - -func (m spatialRefSyMods) WithParentsCascading() SpatialRefSyMod { - return SpatialRefSyModFunc(func(ctx context.Context, o *SpatialRefSyTemplate) { - if isDone, _ := spatialRefSyWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = spatialRefSyWithParentsCascadingCtx.WithValue(ctx, true) - }) -} diff --git a/db/factory/user_.bob.go b/db/factory/user_.bob.go deleted file mode 100644 index 761ff2e1..00000000 --- a/db/factory/user_.bob.go +++ /dev/null @@ -1,2423 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - 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/jaswdr/faker/v2" -) - -type UserMod interface { - Apply(context.Context, *UserTemplate) -} - -type UserModFunc func(context.Context, *UserTemplate) - -func (f UserModFunc) Apply(ctx context.Context, n *UserTemplate) { - f(ctx, n) -} - -type UserModSlice []UserMod - -func (mods UserModSlice) Apply(ctx context.Context, n *UserTemplate) { - for _, f := range mods { - f.Apply(ctx, n) - } -} - -// UserTemplate is an object representing the database table. -// all columns are optional and should be set by mods -type UserTemplate struct { - ID func() int32 - ArcgisAccessToken func() null.Val[string] - ArcgisLicense func() null.Val[enums.Arcgislicensetype] - ArcgisRefreshToken func() null.Val[string] - ArcgisRefreshTokenExpires func() null.Val[time.Time] - ArcgisRole func() null.Val[string] - DisplayName func() string - Email func() null.Val[string] - OrganizationID func() int32 - Username func() string - PasswordHashType func() enums.Hashtype - PasswordHash func() string - Role func() enums.Userrole - - r userR - f *Factory - - alreadyPersisted bool -} - -type userR struct { - UserOauthTokens []*userRUserOauthTokensR - PublicUserUser []*userRPublicUserUserR - CreatorComplianceReportRequests []*userRCreatorComplianceReportRequestsR - CommitterFiles []*userRCommitterFilesR - CreatorFiles []*userRCreatorFilesR - FileuploadPool []*userRFileuploadPoolR - CreatorLeads []*userRCreatorLeadsR - CreatorNoteAudios []*userRCreatorNoteAudiosR - DeletorNoteAudios []*userRDeletorNoteAudiosR - CreatorNoteImages []*userRCreatorNoteImagesR - DeletorNoteImages []*userRDeletorNoteImagesR - UserNotifications []*userRUserNotificationsR - CreatorPools []*userRCreatorPoolsR - CreatorResidents []*userRCreatorResidentsR - AddressorSignals []*userRAddressorSignalsR - CreatorSignals []*userRCreatorSignalsR - CreatorSites []*userRCreatorSitesR - Organization *userROrganizationR -} - -type userRUserOauthTokensR struct { - number int - o *ArcgisOauthTokenTemplate -} -type userRPublicUserUserR struct { - number int - o *ArcgisUserTemplate -} -type userRCreatorComplianceReportRequestsR struct { - number int - o *ComplianceReportRequestTemplate -} -type userRCommitterFilesR struct { - number int - o *FileuploadFileTemplate -} -type userRCreatorFilesR struct { - number int - o *FileuploadFileTemplate -} -type userRFileuploadPoolR struct { - number int - o *FileuploadPoolTemplate -} -type userRCreatorLeadsR struct { - number int - o *LeadTemplate -} -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 -} -type userRCreatorPoolsR struct { - number int - o *PoolTemplate -} -type userRCreatorResidentsR struct { - number int - o *ResidentTemplate -} -type userRAddressorSignalsR struct { - number int - o *SignalTemplate -} -type userRCreatorSignalsR struct { - number int - o *SignalTemplate -} -type userRCreatorSitesR struct { - number int - o *SiteTemplate -} -type userROrganizationR struct { - o *OrganizationTemplate -} - -// Apply mods to the UserTemplate -func (o *UserTemplate) Apply(ctx context.Context, mods ...UserMod) { - for _, mod := range mods { - mod.Apply(ctx, o) - } -} - -// 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.UserOauthTokens != nil { - rel := models.ArcgisOauthTokenSlice{} - for _, r := range t.r.UserOauthTokens { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.UserID = o.ID // h2 - rel.R.UserUser = o - } - rel = append(rel, related...) - } - o.R.UserOauthTokens = rel - } - - if t.r.PublicUserUser != nil { - rel := models.ArcgisUserSlice{} - for _, r := range t.r.PublicUserUser { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.PublicUserID = o.ID // h2 - rel.R.PublicUserUser = o - } - rel = append(rel, related...) - } - o.R.PublicUserUser = rel - } - - if t.r.CreatorComplianceReportRequests != nil { - rel := models.ComplianceReportRequestSlice{} - for _, r := range t.r.CreatorComplianceReportRequests { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.Creator = o.ID // h2 - rel.R.CreatorUser = o - } - rel = append(rel, related...) - } - o.R.CreatorComplianceReportRequests = rel - } - - if t.r.CommitterFiles != nil { - rel := models.FileuploadFileSlice{} - for _, r := range t.r.CommitterFiles { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.Committer = null.From(o.ID) // h2 - rel.R.CommitterUser = o - } - rel = append(rel, related...) - } - o.R.CommitterFiles = rel - } - - if t.r.CreatorFiles != nil { - rel := models.FileuploadFileSlice{} - for _, r := range t.r.CreatorFiles { - 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.CreatorFiles = rel - } - - if t.r.FileuploadPool != nil { - rel := models.FileuploadPoolSlice{} - for _, r := range t.r.FileuploadPool { - 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.FileuploadPool = rel - } - - if t.r.CreatorLeads != nil { - rel := models.LeadSlice{} - for _, r := range t.r.CreatorLeads { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.Creator = o.ID // h2 - rel.R.CreatorUser = o - } - rel = append(rel, related...) - } - o.R.CreatorLeads = rel - } - - 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 { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.UserID = o.ID // h2 - rel.R.UserUser = o - } - rel = append(rel, related...) - } - o.R.UserNotifications = rel - } - - if t.r.CreatorPools != nil { - rel := models.PoolSlice{} - for _, r := range t.r.CreatorPools { - 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.CreatorPools = rel - } - - if t.r.CreatorResidents != nil { - rel := models.ResidentSlice{} - for _, r := range t.r.CreatorResidents { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.Creator = o.ID // h2 - rel.R.CreatorUser = o - } - rel = append(rel, related...) - } - o.R.CreatorResidents = rel - } - - if t.r.AddressorSignals != nil { - rel := models.SignalSlice{} - for _, r := range t.r.AddressorSignals { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.Addressor = null.From(o.ID) // h2 - rel.R.AddressorUser = o - } - rel = append(rel, related...) - } - o.R.AddressorSignals = rel - } - - if t.r.CreatorSignals != nil { - rel := models.SignalSlice{} - for _, r := range t.r.CreatorSignals { - related := r.o.BuildMany(r.number) - for _, rel := range related { - rel.Creator = o.ID // h2 - rel.R.CreatorUser = o - } - rel = append(rel, related...) - } - o.R.CreatorSignals = rel - } - - if t.r.CreatorSites != nil { - rel := models.SiteSlice{} - for _, r := range t.r.CreatorSites { - 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.CreatorSites = rel - } - - if t.r.Organization != nil { - rel := t.r.Organization.o.Build() - rel.R.User = append(rel.R.User, o) - o.OrganizationID = rel.ID // h2 - o.R.Organization = rel - } -} - -// BuildSetter returns an *models.UserSetter -// this does nothing with the relationship templates -func (o UserTemplate) BuildSetter() *models.UserSetter { - m := &models.UserSetter{} - - if o.ID != nil { - val := o.ID() - m.ID = omit.From(val) - } - if o.ArcgisAccessToken != nil { - val := o.ArcgisAccessToken() - m.ArcgisAccessToken = omitnull.FromNull(val) - } - if o.ArcgisLicense != nil { - val := o.ArcgisLicense() - m.ArcgisLicense = omitnull.FromNull(val) - } - if o.ArcgisRefreshToken != nil { - val := o.ArcgisRefreshToken() - m.ArcgisRefreshToken = omitnull.FromNull(val) - } - if o.ArcgisRefreshTokenExpires != nil { - val := o.ArcgisRefreshTokenExpires() - m.ArcgisRefreshTokenExpires = omitnull.FromNull(val) - } - if o.ArcgisRole != nil { - val := o.ArcgisRole() - m.ArcgisRole = omitnull.FromNull(val) - } - if o.DisplayName != nil { - val := o.DisplayName() - m.DisplayName = omit.From(val) - } - if o.Email != nil { - val := o.Email() - m.Email = omitnull.FromNull(val) - } - if o.OrganizationID != nil { - val := o.OrganizationID() - m.OrganizationID = omit.From(val) - } - if o.Username != nil { - val := o.Username() - m.Username = omit.From(val) - } - if o.PasswordHashType != nil { - val := o.PasswordHashType() - m.PasswordHashType = omit.From(val) - } - if o.PasswordHash != nil { - val := o.PasswordHash() - m.PasswordHash = omit.From(val) - } - if o.Role != nil { - val := o.Role() - m.Role = omit.From(val) - } - - return m -} - -// BuildManySetter returns an []*models.UserSetter -// this does nothing with the relationship templates -func (o UserTemplate) BuildManySetter(number int) []*models.UserSetter { - m := make([]*models.UserSetter, number) - - for i := range m { - m[i] = o.BuildSetter() - } - - return m -} - -// Build returns an *models.User -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use UserTemplate.Create -func (o UserTemplate) Build() *models.User { - m := &models.User{} - - if o.ID != nil { - m.ID = o.ID() - } - if o.ArcgisAccessToken != nil { - m.ArcgisAccessToken = o.ArcgisAccessToken() - } - if o.ArcgisLicense != nil { - m.ArcgisLicense = o.ArcgisLicense() - } - if o.ArcgisRefreshToken != nil { - m.ArcgisRefreshToken = o.ArcgisRefreshToken() - } - if o.ArcgisRefreshTokenExpires != nil { - m.ArcgisRefreshTokenExpires = o.ArcgisRefreshTokenExpires() - } - if o.ArcgisRole != nil { - m.ArcgisRole = o.ArcgisRole() - } - if o.DisplayName != nil { - m.DisplayName = o.DisplayName() - } - if o.Email != nil { - m.Email = o.Email() - } - if o.OrganizationID != nil { - m.OrganizationID = o.OrganizationID() - } - if o.Username != nil { - m.Username = o.Username() - } - if o.PasswordHashType != nil { - m.PasswordHashType = o.PasswordHashType() - } - if o.PasswordHash != nil { - m.PasswordHash = o.PasswordHash() - } - if o.Role != nil { - m.Role = o.Role() - } - - o.setModelRels(m) - - return m -} - -// BuildMany returns an models.UserSlice -// Related objects are also created and placed in the .R field -// NOTE: Objects are not inserted into the database. Use UserTemplate.CreateMany -func (o UserTemplate) BuildMany(number int) models.UserSlice { - m := make(models.UserSlice, number) - - for i := range m { - m[i] = o.Build() - } - - return m -} - -func ensureCreatableUser(m *models.UserSetter) { - if !(m.DisplayName.IsValue()) { - val := random_string(nil, "200") - m.DisplayName = omit.From(val) - } - if !(m.OrganizationID.IsValue()) { - val := random_int32(nil) - m.OrganizationID = omit.From(val) - } - if !(m.Username.IsValue()) { - val := random_string(nil) - m.Username = omit.From(val) - } - if !(m.PasswordHashType.IsValue()) { - val := random_enums_Hashtype(nil) - m.PasswordHashType = omit.From(val) - } - if !(m.PasswordHash.IsValue()) { - val := random_string(nil) - m.PasswordHash = omit.From(val) - } - if !(m.Role.IsValue()) { - val := random_enums_Userrole(nil) - m.Role = omit.From(val) - } -} - -// insertOptRels creates and inserts any optional the relationships on *models.User -// according to the relationships in the template. -// any required relationship should have already exist on the model -func (o *UserTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.User) error { - var err error - - isUserOauthTokensDone, _ := userRelUserOauthTokensCtx.Value(ctx) - if !isUserOauthTokensDone && o.r.UserOauthTokens != nil { - ctx = userRelUserOauthTokensCtx.WithValue(ctx, true) - for _, r := range o.r.UserOauthTokens { - if r.o.alreadyPersisted { - m.R.UserOauthTokens = append(m.R.UserOauthTokens, r.o.Build()) - } else { - rel0, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachUserOauthTokens(ctx, exec, rel0...) - if err != nil { - return err - } - } - } - } - - isPublicUserUserDone, _ := userRelPublicUserUserCtx.Value(ctx) - if !isPublicUserUserDone && o.r.PublicUserUser != nil { - ctx = userRelPublicUserUserCtx.WithValue(ctx, true) - for _, r := range o.r.PublicUserUser { - if r.o.alreadyPersisted { - m.R.PublicUserUser = append(m.R.PublicUserUser, r.o.Build()) - } else { - rel1, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachPublicUserUser(ctx, exec, rel1...) - if err != nil { - return err - } - } - } - } - - isCreatorComplianceReportRequestsDone, _ := userRelCreatorComplianceReportRequestsCtx.Value(ctx) - if !isCreatorComplianceReportRequestsDone && o.r.CreatorComplianceReportRequests != nil { - ctx = userRelCreatorComplianceReportRequestsCtx.WithValue(ctx, true) - for _, r := range o.r.CreatorComplianceReportRequests { - if r.o.alreadyPersisted { - m.R.CreatorComplianceReportRequests = append(m.R.CreatorComplianceReportRequests, r.o.Build()) - } else { - rel2, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachCreatorComplianceReportRequests(ctx, exec, rel2...) - if err != nil { - return err - } - } - } - } - - isCommitterFilesDone, _ := userRelCommitterFilesCtx.Value(ctx) - if !isCommitterFilesDone && o.r.CommitterFiles != nil { - ctx = userRelCommitterFilesCtx.WithValue(ctx, true) - for _, r := range o.r.CommitterFiles { - if r.o.alreadyPersisted { - m.R.CommitterFiles = append(m.R.CommitterFiles, r.o.Build()) - } else { - rel3, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachCommitterFiles(ctx, exec, rel3...) - if err != nil { - return err - } - } - } - } - - isCreatorFilesDone, _ := userRelCreatorFilesCtx.Value(ctx) - if !isCreatorFilesDone && o.r.CreatorFiles != nil { - ctx = userRelCreatorFilesCtx.WithValue(ctx, true) - for _, r := range o.r.CreatorFiles { - if r.o.alreadyPersisted { - m.R.CreatorFiles = append(m.R.CreatorFiles, r.o.Build()) - } else { - rel4, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachCreatorFiles(ctx, exec, rel4...) - if err != nil { - return err - } - } - } - } - - isFileuploadPoolDone, _ := userRelFileuploadPoolCtx.Value(ctx) - if !isFileuploadPoolDone && o.r.FileuploadPool != nil { - ctx = userRelFileuploadPoolCtx.WithValue(ctx, true) - for _, r := range o.r.FileuploadPool { - if r.o.alreadyPersisted { - m.R.FileuploadPool = append(m.R.FileuploadPool, r.o.Build()) - } else { - rel5, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachFileuploadPool(ctx, exec, rel5...) - if err != nil { - return err - } - } - } - } - - isCreatorLeadsDone, _ := userRelCreatorLeadsCtx.Value(ctx) - if !isCreatorLeadsDone && o.r.CreatorLeads != nil { - ctx = userRelCreatorLeadsCtx.WithValue(ctx, true) - for _, r := range o.r.CreatorLeads { - if r.o.alreadyPersisted { - m.R.CreatorLeads = append(m.R.CreatorLeads, r.o.Build()) - } else { - rel6, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachCreatorLeads(ctx, exec, rel6...) - if err != nil { - return err - } - } - } - } - - 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 { - rel7, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachCreatorNoteAudios(ctx, exec, rel7...) - 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 { - rel8, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachDeletorNoteAudios(ctx, exec, rel8...) - 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 { - rel9, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachCreatorNoteImages(ctx, exec, rel9...) - 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 { - rel10, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachDeletorNoteImages(ctx, exec, rel10...) - if err != nil { - return err - } - } - } - } - - isUserNotificationsDone, _ := userRelUserNotificationsCtx.Value(ctx) - if !isUserNotificationsDone && o.r.UserNotifications != nil { - ctx = userRelUserNotificationsCtx.WithValue(ctx, true) - for _, r := range o.r.UserNotifications { - if r.o.alreadyPersisted { - m.R.UserNotifications = append(m.R.UserNotifications, r.o.Build()) - } else { - rel11, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachUserNotifications(ctx, exec, rel11...) - if err != nil { - return err - } - } - } - } - - isCreatorPoolsDone, _ := userRelCreatorPoolsCtx.Value(ctx) - if !isCreatorPoolsDone && o.r.CreatorPools != nil { - ctx = userRelCreatorPoolsCtx.WithValue(ctx, true) - for _, r := range o.r.CreatorPools { - if r.o.alreadyPersisted { - m.R.CreatorPools = append(m.R.CreatorPools, r.o.Build()) - } else { - rel12, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachCreatorPools(ctx, exec, rel12...) - if err != nil { - return err - } - } - } - } - - isCreatorResidentsDone, _ := userRelCreatorResidentsCtx.Value(ctx) - if !isCreatorResidentsDone && o.r.CreatorResidents != nil { - ctx = userRelCreatorResidentsCtx.WithValue(ctx, true) - for _, r := range o.r.CreatorResidents { - if r.o.alreadyPersisted { - m.R.CreatorResidents = append(m.R.CreatorResidents, r.o.Build()) - } else { - rel13, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachCreatorResidents(ctx, exec, rel13...) - if err != nil { - return err - } - } - } - } - - isAddressorSignalsDone, _ := userRelAddressorSignalsCtx.Value(ctx) - if !isAddressorSignalsDone && o.r.AddressorSignals != nil { - ctx = userRelAddressorSignalsCtx.WithValue(ctx, true) - for _, r := range o.r.AddressorSignals { - if r.o.alreadyPersisted { - m.R.AddressorSignals = append(m.R.AddressorSignals, r.o.Build()) - } else { - rel14, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachAddressorSignals(ctx, exec, rel14...) - if err != nil { - return err - } - } - } - } - - isCreatorSignalsDone, _ := userRelCreatorSignalsCtx.Value(ctx) - if !isCreatorSignalsDone && o.r.CreatorSignals != nil { - ctx = userRelCreatorSignalsCtx.WithValue(ctx, true) - for _, r := range o.r.CreatorSignals { - if r.o.alreadyPersisted { - m.R.CreatorSignals = append(m.R.CreatorSignals, r.o.Build()) - } else { - rel15, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachCreatorSignals(ctx, exec, rel15...) - if err != nil { - return err - } - } - } - } - - isCreatorSitesDone, _ := userRelCreatorSitesCtx.Value(ctx) - if !isCreatorSitesDone && o.r.CreatorSites != nil { - ctx = userRelCreatorSitesCtx.WithValue(ctx, true) - for _, r := range o.r.CreatorSites { - if r.o.alreadyPersisted { - m.R.CreatorSites = append(m.R.CreatorSites, r.o.Build()) - } else { - rel16, err := r.o.CreateMany(ctx, exec, r.number) - if err != nil { - return err - } - - err = m.AttachCreatorSites(ctx, exec, rel16...) - if err != nil { - return err - } - } - } - } - - return err -} - -// Create builds a user and inserts it into the database -// Relations objects are also inserted and placed in the .R field -func (o *UserTemplate) Create(ctx context.Context, exec bob.Executor) (*models.User, error) { - var err error - opt := o.BuildSetter() - ensureCreatableUser(opt) - - if o.r.Organization == nil { - UserMods.WithNewOrganization().Apply(ctx, o) - } - - var rel17 *models.Organization - - if o.r.Organization.o.alreadyPersisted { - rel17 = o.r.Organization.o.Build() - } else { - rel17, err = o.r.Organization.o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - opt.OrganizationID = omit.From(rel17.ID) - - m, err := models.Users.Insert(opt).One(ctx, exec) - if err != nil { - return nil, err - } - - m.R.Organization = rel17 - - if err := o.insertOptRels(ctx, exec, m); err != nil { - return nil, err - } - return m, err -} - -// MustCreate builds a user and inserts it into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o *UserTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.User { - m, err := o.Create(ctx, exec) - if err != nil { - panic(err) - } - return m -} - -// CreateOrFail builds a user 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 *UserTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.User { - tb.Helper() - m, err := o.Create(ctx, exec) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// CreateMany builds multiple users and inserts them into the database -// Relations objects are also inserted and placed in the .R field -func (o UserTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.UserSlice, error) { - var err error - m := make(models.UserSlice, number) - - for i := range m { - m[i], err = o.Create(ctx, exec) - if err != nil { - return nil, err - } - } - - return m, nil -} - -// MustCreateMany builds multiple users and inserts them into the database -// Relations objects are also inserted and placed in the .R field -// panics if an error occurs -func (o UserTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.UserSlice { - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - panic(err) - } - return m -} - -// CreateManyOrFail builds multiple users 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 UserTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.UserSlice { - tb.Helper() - m, err := o.CreateMany(ctx, exec, number) - if err != nil { - tb.Fatal(err) - return nil - } - return m -} - -// User has methods that act as mods for the UserTemplate -var UserMods userMods - -type userMods struct{} - -func (m userMods) RandomizeAllColumns(f *faker.Faker) UserMod { - return UserModSlice{ - UserMods.RandomID(f), - UserMods.RandomArcgisAccessToken(f), - UserMods.RandomArcgisLicense(f), - UserMods.RandomArcgisRefreshToken(f), - UserMods.RandomArcgisRefreshTokenExpires(f), - UserMods.RandomArcgisRole(f), - UserMods.RandomDisplayName(f), - UserMods.RandomEmail(f), - UserMods.RandomOrganizationID(f), - UserMods.RandomUsername(f), - UserMods.RandomPasswordHashType(f), - UserMods.RandomPasswordHash(f), - UserMods.RandomRole(f), - } -} - -// Set the model columns to this value -func (m userMods) ID(val int32) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m userMods) IDFunc(f func() int32) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ID = f - }) -} - -// Clear any values for the column -func (m userMods) UnsetID() UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ID = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m userMods) RandomID(f *faker.Faker) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m userMods) ArcgisAccessToken(val null.Val[string]) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisAccessToken = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m userMods) ArcgisAccessTokenFunc(f func() null.Val[string]) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisAccessToken = f - }) -} - -// Clear any values for the column -func (m userMods) UnsetArcgisAccessToken() UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisAccessToken = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m userMods) RandomArcgisAccessToken(f *faker.Faker) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisAccessToken = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m userMods) RandomArcgisAccessTokenNotNull(f *faker.Faker) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisAccessToken = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m userMods) ArcgisLicense(val null.Val[enums.Arcgislicensetype]) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisLicense = func() null.Val[enums.Arcgislicensetype] { return val } - }) -} - -// Set the Column from the function -func (m userMods) ArcgisLicenseFunc(f func() null.Val[enums.Arcgislicensetype]) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisLicense = f - }) -} - -// Clear any values for the column -func (m userMods) UnsetArcgisLicense() UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisLicense = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m userMods) RandomArcgisLicense(f *faker.Faker) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisLicense = func() null.Val[enums.Arcgislicensetype] { - if f == nil { - f = &defaultFaker - } - - val := random_enums_Arcgislicensetype(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m userMods) RandomArcgisLicenseNotNull(f *faker.Faker) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisLicense = func() null.Val[enums.Arcgislicensetype] { - if f == nil { - f = &defaultFaker - } - - val := random_enums_Arcgislicensetype(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m userMods) ArcgisRefreshToken(val null.Val[string]) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisRefreshToken = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m userMods) ArcgisRefreshTokenFunc(f func() null.Val[string]) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisRefreshToken = f - }) -} - -// Clear any values for the column -func (m userMods) UnsetArcgisRefreshToken() UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisRefreshToken = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m userMods) RandomArcgisRefreshToken(f *faker.Faker) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisRefreshToken = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m userMods) RandomArcgisRefreshTokenNotNull(f *faker.Faker) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisRefreshToken = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m userMods) ArcgisRefreshTokenExpires(val null.Val[time.Time]) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisRefreshTokenExpires = func() null.Val[time.Time] { return val } - }) -} - -// Set the Column from the function -func (m userMods) ArcgisRefreshTokenExpiresFunc(f func() null.Val[time.Time]) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisRefreshTokenExpires = f - }) -} - -// Clear any values for the column -func (m userMods) UnsetArcgisRefreshTokenExpires() UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisRefreshTokenExpires = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m userMods) RandomArcgisRefreshTokenExpires(f *faker.Faker) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisRefreshTokenExpires = 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 userMods) RandomArcgisRefreshTokenExpiresNotNull(f *faker.Faker) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisRefreshTokenExpires = 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 userMods) ArcgisRole(val null.Val[string]) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisRole = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m userMods) ArcgisRoleFunc(f func() null.Val[string]) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisRole = f - }) -} - -// Clear any values for the column -func (m userMods) UnsetArcgisRole() UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisRole = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m userMods) RandomArcgisRole(f *faker.Faker) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisRole = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m userMods) RandomArcgisRoleNotNull(f *faker.Faker) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.ArcgisRole = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m userMods) DisplayName(val string) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.DisplayName = func() string { return val } - }) -} - -// Set the Column from the function -func (m userMods) DisplayNameFunc(f func() string) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.DisplayName = f - }) -} - -// Clear any values for the column -func (m userMods) UnsetDisplayName() UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.DisplayName = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m userMods) RandomDisplayName(f *faker.Faker) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.DisplayName = func() string { - return random_string(f, "200") - } - }) -} - -// Set the model columns to this value -func (m userMods) Email(val null.Val[string]) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.Email = func() null.Val[string] { return val } - }) -} - -// Set the Column from the function -func (m userMods) EmailFunc(f func() null.Val[string]) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.Email = f - }) -} - -// Clear any values for the column -func (m userMods) UnsetEmail() UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.Email = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is sometimes null -func (m userMods) RandomEmail(f *faker.Faker) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.Email = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -// The generated value is never null -func (m userMods) RandomEmailNotNull(f *faker.Faker) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.Email = func() null.Val[string] { - if f == nil { - f = &defaultFaker - } - - val := random_string(f) - return null.From(val) - } - }) -} - -// Set the model columns to this value -func (m userMods) OrganizationID(val int32) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.OrganizationID = func() int32 { return val } - }) -} - -// Set the Column from the function -func (m userMods) OrganizationIDFunc(f func() int32) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.OrganizationID = f - }) -} - -// Clear any values for the column -func (m userMods) UnsetOrganizationID() UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - 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 userMods) RandomOrganizationID(f *faker.Faker) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.OrganizationID = func() int32 { - return random_int32(f) - } - }) -} - -// Set the model columns to this value -func (m userMods) Username(val string) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.Username = func() string { return val } - }) -} - -// Set the Column from the function -func (m userMods) UsernameFunc(f func() string) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.Username = f - }) -} - -// Clear any values for the column -func (m userMods) UnsetUsername() UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.Username = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m userMods) RandomUsername(f *faker.Faker) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.Username = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m userMods) PasswordHashType(val enums.Hashtype) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.PasswordHashType = func() enums.Hashtype { return val } - }) -} - -// Set the Column from the function -func (m userMods) PasswordHashTypeFunc(f func() enums.Hashtype) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.PasswordHashType = f - }) -} - -// Clear any values for the column -func (m userMods) UnsetPasswordHashType() UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.PasswordHashType = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m userMods) RandomPasswordHashType(f *faker.Faker) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.PasswordHashType = func() enums.Hashtype { - return random_enums_Hashtype(f) - } - }) -} - -// Set the model columns to this value -func (m userMods) PasswordHash(val string) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.PasswordHash = func() string { return val } - }) -} - -// Set the Column from the function -func (m userMods) PasswordHashFunc(f func() string) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.PasswordHash = f - }) -} - -// Clear any values for the column -func (m userMods) UnsetPasswordHash() UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.PasswordHash = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m userMods) RandomPasswordHash(f *faker.Faker) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.PasswordHash = func() string { - return random_string(f) - } - }) -} - -// Set the model columns to this value -func (m userMods) Role(val enums.Userrole) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.Role = func() enums.Userrole { return val } - }) -} - -// Set the Column from the function -func (m userMods) RoleFunc(f func() enums.Userrole) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.Role = f - }) -} - -// Clear any values for the column -func (m userMods) UnsetRole() UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.Role = nil - }) -} - -// Generates a random value for the column using the given faker -// if faker is nil, a default faker is used -func (m userMods) RandomRole(f *faker.Faker) UserMod { - return UserModFunc(func(_ context.Context, o *UserTemplate) { - o.Role = func() enums.Userrole { - return random_enums_Userrole(f) - } - }) -} - -func (m userMods) WithParentsCascading() UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - if isDone, _ := userWithParentsCascadingCtx.Value(ctx); isDone { - return - } - ctx = userWithParentsCascadingCtx.WithValue(ctx, true) - { - - related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading()) - m.WithOrganization(related).Apply(ctx, o) - } - }) -} - -func (m userMods) WithOrganization(rel *OrganizationTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.Organization = &userROrganizationR{ - o: rel, - } - }) -} - -func (m userMods) WithNewOrganization(mods ...OrganizationMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewOrganizationWithContext(ctx, mods...) - - m.WithOrganization(related).Apply(ctx, o) - }) -} - -func (m userMods) WithExistingOrganization(em *models.Organization) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.Organization = &userROrganizationR{ - o: o.f.FromExistingOrganization(em), - } - }) -} - -func (m userMods) WithoutOrganization() UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.Organization = nil - }) -} - -func (m userMods) WithUserOauthTokens(number int, related *ArcgisOauthTokenTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.UserOauthTokens = []*userRUserOauthTokensR{{ - number: number, - o: related, - }} - }) -} - -func (m userMods) WithNewUserOauthTokens(number int, mods ...ArcgisOauthTokenMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewArcgisOauthTokenWithContext(ctx, mods...) - m.WithUserOauthTokens(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddUserOauthTokens(number int, related *ArcgisOauthTokenTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.UserOauthTokens = append(o.r.UserOauthTokens, &userRUserOauthTokensR{ - number: number, - o: related, - }) - }) -} - -func (m userMods) AddNewUserOauthTokens(number int, mods ...ArcgisOauthTokenMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewArcgisOauthTokenWithContext(ctx, mods...) - m.AddUserOauthTokens(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddExistingUserOauthTokens(existingModels ...*models.ArcgisOauthToken) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - for _, em := range existingModels { - o.r.UserOauthTokens = append(o.r.UserOauthTokens, &userRUserOauthTokensR{ - o: o.f.FromExistingArcgisOauthToken(em), - }) - } - }) -} - -func (m userMods) WithoutUserOauthTokens() UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.UserOauthTokens = nil - }) -} - -func (m userMods) WithPublicUserUser(number int, related *ArcgisUserTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.PublicUserUser = []*userRPublicUserUserR{{ - number: number, - o: related, - }} - }) -} - -func (m userMods) WithNewPublicUserUser(number int, mods ...ArcgisUserMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewArcgisUserWithContext(ctx, mods...) - m.WithPublicUserUser(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddPublicUserUser(number int, related *ArcgisUserTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.PublicUserUser = append(o.r.PublicUserUser, &userRPublicUserUserR{ - number: number, - o: related, - }) - }) -} - -func (m userMods) AddNewPublicUserUser(number int, mods ...ArcgisUserMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewArcgisUserWithContext(ctx, mods...) - m.AddPublicUserUser(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddExistingPublicUserUser(existingModels ...*models.ArcgisUser) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - for _, em := range existingModels { - o.r.PublicUserUser = append(o.r.PublicUserUser, &userRPublicUserUserR{ - o: o.f.FromExistingArcgisUser(em), - }) - } - }) -} - -func (m userMods) WithoutPublicUserUser() UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.PublicUserUser = nil - }) -} - -func (m userMods) WithCreatorComplianceReportRequests(number int, related *ComplianceReportRequestTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CreatorComplianceReportRequests = []*userRCreatorComplianceReportRequestsR{{ - number: number, - o: related, - }} - }) -} - -func (m userMods) WithNewCreatorComplianceReportRequests(number int, mods ...ComplianceReportRequestMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewComplianceReportRequestWithContext(ctx, mods...) - m.WithCreatorComplianceReportRequests(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddCreatorComplianceReportRequests(number int, related *ComplianceReportRequestTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CreatorComplianceReportRequests = append(o.r.CreatorComplianceReportRequests, &userRCreatorComplianceReportRequestsR{ - number: number, - o: related, - }) - }) -} - -func (m userMods) AddNewCreatorComplianceReportRequests(number int, mods ...ComplianceReportRequestMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewComplianceReportRequestWithContext(ctx, mods...) - m.AddCreatorComplianceReportRequests(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddExistingCreatorComplianceReportRequests(existingModels ...*models.ComplianceReportRequest) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - for _, em := range existingModels { - o.r.CreatorComplianceReportRequests = append(o.r.CreatorComplianceReportRequests, &userRCreatorComplianceReportRequestsR{ - o: o.f.FromExistingComplianceReportRequest(em), - }) - } - }) -} - -func (m userMods) WithoutCreatorComplianceReportRequests() UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CreatorComplianceReportRequests = nil - }) -} - -func (m userMods) WithCommitterFiles(number int, related *FileuploadFileTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CommitterFiles = []*userRCommitterFilesR{{ - number: number, - o: related, - }} - }) -} - -func (m userMods) WithNewCommitterFiles(number int, mods ...FileuploadFileMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewFileuploadFileWithContext(ctx, mods...) - m.WithCommitterFiles(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddCommitterFiles(number int, related *FileuploadFileTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CommitterFiles = append(o.r.CommitterFiles, &userRCommitterFilesR{ - number: number, - o: related, - }) - }) -} - -func (m userMods) AddNewCommitterFiles(number int, mods ...FileuploadFileMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewFileuploadFileWithContext(ctx, mods...) - m.AddCommitterFiles(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddExistingCommitterFiles(existingModels ...*models.FileuploadFile) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - for _, em := range existingModels { - o.r.CommitterFiles = append(o.r.CommitterFiles, &userRCommitterFilesR{ - o: o.f.FromExistingFileuploadFile(em), - }) - } - }) -} - -func (m userMods) WithoutCommitterFiles() UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CommitterFiles = nil - }) -} - -func (m userMods) WithCreatorFiles(number int, related *FileuploadFileTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CreatorFiles = []*userRCreatorFilesR{{ - number: number, - o: related, - }} - }) -} - -func (m userMods) WithNewCreatorFiles(number int, mods ...FileuploadFileMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewFileuploadFileWithContext(ctx, mods...) - m.WithCreatorFiles(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddCreatorFiles(number int, related *FileuploadFileTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CreatorFiles = append(o.r.CreatorFiles, &userRCreatorFilesR{ - number: number, - o: related, - }) - }) -} - -func (m userMods) AddNewCreatorFiles(number int, mods ...FileuploadFileMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewFileuploadFileWithContext(ctx, mods...) - m.AddCreatorFiles(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddExistingCreatorFiles(existingModels ...*models.FileuploadFile) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - for _, em := range existingModels { - o.r.CreatorFiles = append(o.r.CreatorFiles, &userRCreatorFilesR{ - o: o.f.FromExistingFileuploadFile(em), - }) - } - }) -} - -func (m userMods) WithoutCreatorFiles() UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CreatorFiles = nil - }) -} - -func (m userMods) WithFileuploadPool(number int, related *FileuploadPoolTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.FileuploadPool = []*userRFileuploadPoolR{{ - number: number, - o: related, - }} - }) -} - -func (m userMods) WithNewFileuploadPool(number int, mods ...FileuploadPoolMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewFileuploadPoolWithContext(ctx, mods...) - m.WithFileuploadPool(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddFileuploadPool(number int, related *FileuploadPoolTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.FileuploadPool = append(o.r.FileuploadPool, &userRFileuploadPoolR{ - number: number, - o: related, - }) - }) -} - -func (m userMods) AddNewFileuploadPool(number int, mods ...FileuploadPoolMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewFileuploadPoolWithContext(ctx, mods...) - m.AddFileuploadPool(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddExistingFileuploadPool(existingModels ...*models.FileuploadPool) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - for _, em := range existingModels { - o.r.FileuploadPool = append(o.r.FileuploadPool, &userRFileuploadPoolR{ - o: o.f.FromExistingFileuploadPool(em), - }) - } - }) -} - -func (m userMods) WithoutFileuploadPool() UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.FileuploadPool = nil - }) -} - -func (m userMods) WithCreatorLeads(number int, related *LeadTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CreatorLeads = []*userRCreatorLeadsR{{ - number: number, - o: related, - }} - }) -} - -func (m userMods) WithNewCreatorLeads(number int, mods ...LeadMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewLeadWithContext(ctx, mods...) - m.WithCreatorLeads(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddCreatorLeads(number int, related *LeadTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CreatorLeads = append(o.r.CreatorLeads, &userRCreatorLeadsR{ - number: number, - o: related, - }) - }) -} - -func (m userMods) AddNewCreatorLeads(number int, mods ...LeadMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewLeadWithContext(ctx, mods...) - m.AddCreatorLeads(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddExistingCreatorLeads(existingModels ...*models.Lead) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - for _, em := range existingModels { - o.r.CreatorLeads = append(o.r.CreatorLeads, &userRCreatorLeadsR{ - o: o.f.FromExistingLead(em), - }) - } - }) -} - -func (m userMods) WithoutCreatorLeads() UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CreatorLeads = nil - }) -} - -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{{ - number: number, - o: related, - }} - }) -} - -func (m userMods) WithNewUserNotifications(number int, mods ...NotificationMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewNotificationWithContext(ctx, mods...) - m.WithUserNotifications(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddUserNotifications(number int, related *NotificationTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.UserNotifications = append(o.r.UserNotifications, &userRUserNotificationsR{ - number: number, - o: related, - }) - }) -} - -func (m userMods) AddNewUserNotifications(number int, mods ...NotificationMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewNotificationWithContext(ctx, mods...) - m.AddUserNotifications(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddExistingUserNotifications(existingModels ...*models.Notification) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - for _, em := range existingModels { - o.r.UserNotifications = append(o.r.UserNotifications, &userRUserNotificationsR{ - o: o.f.FromExistingNotification(em), - }) - } - }) -} - -func (m userMods) WithoutUserNotifications() UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.UserNotifications = nil - }) -} - -func (m userMods) WithCreatorPools(number int, related *PoolTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CreatorPools = []*userRCreatorPoolsR{{ - number: number, - o: related, - }} - }) -} - -func (m userMods) WithNewCreatorPools(number int, mods ...PoolMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewPoolWithContext(ctx, mods...) - m.WithCreatorPools(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddCreatorPools(number int, related *PoolTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CreatorPools = append(o.r.CreatorPools, &userRCreatorPoolsR{ - number: number, - o: related, - }) - }) -} - -func (m userMods) AddNewCreatorPools(number int, mods ...PoolMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewPoolWithContext(ctx, mods...) - m.AddCreatorPools(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddExistingCreatorPools(existingModels ...*models.Pool) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - for _, em := range existingModels { - o.r.CreatorPools = append(o.r.CreatorPools, &userRCreatorPoolsR{ - o: o.f.FromExistingPool(em), - }) - } - }) -} - -func (m userMods) WithoutCreatorPools() UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CreatorPools = nil - }) -} - -func (m userMods) WithCreatorResidents(number int, related *ResidentTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CreatorResidents = []*userRCreatorResidentsR{{ - number: number, - o: related, - }} - }) -} - -func (m userMods) WithNewCreatorResidents(number int, mods ...ResidentMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewResidentWithContext(ctx, mods...) - m.WithCreatorResidents(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddCreatorResidents(number int, related *ResidentTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CreatorResidents = append(o.r.CreatorResidents, &userRCreatorResidentsR{ - number: number, - o: related, - }) - }) -} - -func (m userMods) AddNewCreatorResidents(number int, mods ...ResidentMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewResidentWithContext(ctx, mods...) - m.AddCreatorResidents(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddExistingCreatorResidents(existingModels ...*models.Resident) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - for _, em := range existingModels { - o.r.CreatorResidents = append(o.r.CreatorResidents, &userRCreatorResidentsR{ - o: o.f.FromExistingResident(em), - }) - } - }) -} - -func (m userMods) WithoutCreatorResidents() UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CreatorResidents = nil - }) -} - -func (m userMods) WithAddressorSignals(number int, related *SignalTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.AddressorSignals = []*userRAddressorSignalsR{{ - number: number, - o: related, - }} - }) -} - -func (m userMods) WithNewAddressorSignals(number int, mods ...SignalMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewSignalWithContext(ctx, mods...) - m.WithAddressorSignals(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddAddressorSignals(number int, related *SignalTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.AddressorSignals = append(o.r.AddressorSignals, &userRAddressorSignalsR{ - number: number, - o: related, - }) - }) -} - -func (m userMods) AddNewAddressorSignals(number int, mods ...SignalMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewSignalWithContext(ctx, mods...) - m.AddAddressorSignals(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddExistingAddressorSignals(existingModels ...*models.Signal) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - for _, em := range existingModels { - o.r.AddressorSignals = append(o.r.AddressorSignals, &userRAddressorSignalsR{ - o: o.f.FromExistingSignal(em), - }) - } - }) -} - -func (m userMods) WithoutAddressorSignals() UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.AddressorSignals = nil - }) -} - -func (m userMods) WithCreatorSignals(number int, related *SignalTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CreatorSignals = []*userRCreatorSignalsR{{ - number: number, - o: related, - }} - }) -} - -func (m userMods) WithNewCreatorSignals(number int, mods ...SignalMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewSignalWithContext(ctx, mods...) - m.WithCreatorSignals(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddCreatorSignals(number int, related *SignalTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CreatorSignals = append(o.r.CreatorSignals, &userRCreatorSignalsR{ - number: number, - o: related, - }) - }) -} - -func (m userMods) AddNewCreatorSignals(number int, mods ...SignalMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewSignalWithContext(ctx, mods...) - m.AddCreatorSignals(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddExistingCreatorSignals(existingModels ...*models.Signal) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - for _, em := range existingModels { - o.r.CreatorSignals = append(o.r.CreatorSignals, &userRCreatorSignalsR{ - o: o.f.FromExistingSignal(em), - }) - } - }) -} - -func (m userMods) WithoutCreatorSignals() UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CreatorSignals = nil - }) -} - -func (m userMods) WithCreatorSites(number int, related *SiteTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CreatorSites = []*userRCreatorSitesR{{ - number: number, - o: related, - }} - }) -} - -func (m userMods) WithNewCreatorSites(number int, mods ...SiteMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewSiteWithContext(ctx, mods...) - m.WithCreatorSites(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddCreatorSites(number int, related *SiteTemplate) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CreatorSites = append(o.r.CreatorSites, &userRCreatorSitesR{ - number: number, - o: related, - }) - }) -} - -func (m userMods) AddNewCreatorSites(number int, mods ...SiteMod) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - related := o.f.NewSiteWithContext(ctx, mods...) - m.AddCreatorSites(number, related).Apply(ctx, o) - }) -} - -func (m userMods) AddExistingCreatorSites(existingModels ...*models.Site) UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - for _, em := range existingModels { - o.r.CreatorSites = append(o.r.CreatorSites, &userRCreatorSitesR{ - o: o.f.FromExistingSite(em), - }) - } - }) -} - -func (m userMods) WithoutCreatorSites() UserMod { - return UserModFunc(func(ctx context.Context, o *UserTemplate) { - o.r.CreatorSites = nil - }) -} diff --git a/db/migrations/00089_feature.sql b/db/migrations/00089_feature.sql new file mode 100644 index 00000000..8f19d51b --- /dev/null +++ b/db/migrations/00089_feature.sql @@ -0,0 +1,36 @@ +-- +goose Up +CREATE TABLE feature ( + created TIMESTAMP WITHOUT TIME ZONE NOT NULL, + creator_id INTEGER NOT NULL REFERENCES user_(id), + id SERIAL NOT NULL, + organization_id INTEGER NOT NULL REFERENCES organization(id), + site_id INTEGER NOT NULL, + site_version INTEGER NOT NULL, + geometry geometry(Point,4326), + FOREIGN KEY (site_id, site_version) REFERENCES site(id, version), + PRIMARY KEY(id) +); + +CREATE TABLE feature_pool ( + feature_id INTEGER REFERENCES feature(id) NOT NULL, + condition PoolConditionType NOT NULL, + depth_meters FLOAT, + geometry geometry(Polygon, 4326), + PRIMARY KEY(feature_id) +); + +DROP TABLE signal_pool; +DROP TABLE pool; + +-- +goose Down + +CREATE TABLE pool( + id SERIAL, + PRIMARY KEY(id) +); +CREATE TABLE signal_pool( + id SERIAL, + PRIMARY KEY(id) +); +DROP TABLE feature_pool; +DROP TABLE feature; diff --git a/db/migrations/00090_review_task.sql b/db/migrations/00090_review_task.sql new file mode 100644 index 00000000..a9106076 --- /dev/null +++ b/db/migrations/00090_review_task.sql @@ -0,0 +1,20 @@ +-- +goose Up +CREATE TABLE review_task ( + created TIMESTAMP WITHOUT TIME ZONE NOT NULL, + creator_id INTEGER REFERENCES user_(id), + id SERIAL NOT NULL, + organization_id INTEGER NOT NULL REFERENCES organization(id), + reviewed TIMESTAMP WITHOUT TIME ZONE, + reviewer_id INTEGER REFERENCES user_(id), + PRIMARY KEY(id) +); +CREATE TABLE review_task_pool ( + feature_pool INTEGER NOT NULL REFERENCES feature_pool(feature_id), + location geometry(Point, 4326), + geometry geometry(Polygon, 4326), + review_task_id INTEGER NOT NULL REFERENCES review_task(id), + PRIMARY KEY(review_task_id) +); +-- +goose Down +DROP TABLE review_task_pool; +DROP TABLE review_task; diff --git a/db/models/address.bob.go b/db/models/address.bob.go index bd983915..f973ea69 100644 --- a/db/models/address.bob.go +++ b/db/models/address.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -38,8 +37,6 @@ type Address struct { Number string `db:"number_" ` R addressR `db:"-" ` - - C addressC `db:"-" ` } // AddressSlice is an alias for a slice of pointers to Address. @@ -1162,216 +1159,3 @@ func (os AddressSlice) LoadSite(ctx context.Context, exec bob.Executor, mods ... return nil } - -// addressC is where relationship counts are stored. -type addressC struct { - Mailers *int64 - Residents *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *Address) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "Mailers": - o.C.Mailers = &count - case "Residents": - o.C.Residents = &count - } - return nil -} - -type addressCountPreloader struct { - Mailers func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Residents func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildAddressCountPreloader() addressCountPreloader { - return addressCountPreloader{ - Mailers: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Address]("Mailers", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Addresses.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(CommsMailers.Name()), - sm.Where(psql.Quote(CommsMailers.Alias(), "address_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Residents: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Address]("Residents", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Addresses.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(Residents.Name()), - sm.Where(psql.Quote(Residents.Alias(), "address_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type addressCountThenLoader[Q orm.Loadable] struct { - Mailers func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - Residents func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildAddressCountThenLoader[Q orm.Loadable]() addressCountThenLoader[Q] { - type MailersCountInterface interface { - LoadCountMailers(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type ResidentsCountInterface interface { - LoadCountResidents(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return addressCountThenLoader[Q]{ - Mailers: countThenLoadBuilder[Q]( - "Mailers", - func(ctx context.Context, exec bob.Executor, retrieved MailersCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountMailers(ctx, exec, mods...) - }, - ), - Residents: countThenLoadBuilder[Q]( - "Residents", - func(ctx context.Context, exec bob.Executor, retrieved ResidentsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountResidents(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountMailers loads the count of Mailers into the C struct -func (o *Address) LoadCountMailers(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Mailers(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Mailers = &count - return nil -} - -// LoadCountMailers loads the count of Mailers for a slice -func (os AddressSlice) LoadCountMailers(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountMailers(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountResidents loads the count of Residents into the C struct -func (o *Address) LoadCountResidents(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Residents(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Residents = &count - return nil -} - -// LoadCountResidents loads the count of Residents for a slice -func (os AddressSlice) LoadCountResidents(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountResidents(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type addressJoins[Q dialect.Joinable] struct { - typ string - Mailers modAs[Q, commsMailerColumns] - Residents modAs[Q, residentColumns] - Site modAs[Q, siteColumns] -} - -func (j addressJoins[Q]) aliasedAs(alias string) addressJoins[Q] { - return buildAddressJoins[Q](buildAddressColumns(alias), j.typ) -} - -func buildAddressJoins[Q dialect.Joinable](cols addressColumns, typ string) addressJoins[Q] { - return addressJoins[Q]{ - typ: typ, - Mailers: modAs[Q, commsMailerColumns]{ - c: CommsMailers.Columns, - f: func(to commsMailerColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsMailers.Name().As(to.Alias())).On( - to.AddressID.EQ(cols.ID), - )) - } - - return mods - }, - }, - Residents: modAs[Q, residentColumns]{ - c: Residents.Columns, - f: func(to residentColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Residents.Name().As(to.Alias())).On( - to.AddressID.EQ(cols.ID), - )) - } - - return mods - }, - }, - Site: modAs[Q, siteColumns]{ - c: Sites.Columns, - f: func(to siteColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Sites.Name().As(to.Alias())).On( - to.AddressID.EQ(cols.ID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/arcgis.account.bob.go b/db/models/arcgis.account.bob.go index 64b2d08b..17a78c0e 100644 --- a/db/models/arcgis.account.bob.go +++ b/db/models/arcgis.account.bob.go @@ -15,7 +15,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/null" @@ -35,8 +34,6 @@ type ArcgisAccount struct { URLTiles null.Val[string] `db:"url_tiles" ` R arcgisAccountR `db:"-" ` - - C arcgisAccountC `db:"-" ` } // ArcgisAccountSlice is an alias for a slice of pointers to ArcgisAccount. @@ -1446,368 +1443,3 @@ func (os ArcgisAccountSlice) LoadArcgisAccountOrganizations(ctx context.Context, return nil } - -// arcgisAccountC is where relationship counts are stored. -type arcgisAccountC struct { - ArcgisAccountOauthTokens *int64 - ServiceFeatures *int64 - ServiceMaps *int64 - ArcgisAccountOrganizations *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *ArcgisAccount) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "ArcgisAccountOauthTokens": - o.C.ArcgisAccountOauthTokens = &count - case "ServiceFeatures": - o.C.ServiceFeatures = &count - case "ServiceMaps": - o.C.ServiceMaps = &count - case "ArcgisAccountOrganizations": - o.C.ArcgisAccountOrganizations = &count - } - return nil -} - -type arcgisAccountCountPreloader struct { - ArcgisAccountOauthTokens func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - ServiceFeatures func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - ServiceMaps func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - ArcgisAccountOrganizations func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildArcgisAccountCountPreloader() arcgisAccountCountPreloader { - return arcgisAccountCountPreloader{ - ArcgisAccountOauthTokens: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*ArcgisAccount]("ArcgisAccountOauthTokens", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = ArcgisAccounts.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(ArcgisOauthTokens.Name()), - sm.Where(psql.Quote(ArcgisOauthTokens.Alias(), "arcgis_account_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - ServiceFeatures: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*ArcgisAccount]("ServiceFeatures", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = ArcgisAccounts.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(ArcgisServiceFeatures.Name()), - sm.Where(psql.Quote(ArcgisServiceFeatures.Alias(), "account_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - ServiceMaps: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*ArcgisAccount]("ServiceMaps", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = ArcgisAccounts.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(ArcgisServiceMaps.Name()), - sm.Where(psql.Quote(ArcgisServiceMaps.Alias(), "account_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - ArcgisAccountOrganizations: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*ArcgisAccount]("ArcgisAccountOrganizations", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = ArcgisAccounts.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(Organizations.Name()), - sm.Where(psql.Quote(Organizations.Alias(), "arcgis_account_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type arcgisAccountCountThenLoader[Q orm.Loadable] struct { - ArcgisAccountOauthTokens func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - ServiceFeatures func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - ServiceMaps func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - ArcgisAccountOrganizations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildArcgisAccountCountThenLoader[Q orm.Loadable]() arcgisAccountCountThenLoader[Q] { - type ArcgisAccountOauthTokensCountInterface interface { - LoadCountArcgisAccountOauthTokens(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type ServiceFeaturesCountInterface interface { - LoadCountServiceFeatures(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type ServiceMapsCountInterface interface { - LoadCountServiceMaps(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type ArcgisAccountOrganizationsCountInterface interface { - LoadCountArcgisAccountOrganizations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return arcgisAccountCountThenLoader[Q]{ - ArcgisAccountOauthTokens: countThenLoadBuilder[Q]( - "ArcgisAccountOauthTokens", - func(ctx context.Context, exec bob.Executor, retrieved ArcgisAccountOauthTokensCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountArcgisAccountOauthTokens(ctx, exec, mods...) - }, - ), - ServiceFeatures: countThenLoadBuilder[Q]( - "ServiceFeatures", - func(ctx context.Context, exec bob.Executor, retrieved ServiceFeaturesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountServiceFeatures(ctx, exec, mods...) - }, - ), - ServiceMaps: countThenLoadBuilder[Q]( - "ServiceMaps", - func(ctx context.Context, exec bob.Executor, retrieved ServiceMapsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountServiceMaps(ctx, exec, mods...) - }, - ), - ArcgisAccountOrganizations: countThenLoadBuilder[Q]( - "ArcgisAccountOrganizations", - func(ctx context.Context, exec bob.Executor, retrieved ArcgisAccountOrganizationsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountArcgisAccountOrganizations(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountArcgisAccountOauthTokens loads the count of ArcgisAccountOauthTokens into the C struct -func (o *ArcgisAccount) LoadCountArcgisAccountOauthTokens(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.ArcgisAccountOauthTokens(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.ArcgisAccountOauthTokens = &count - return nil -} - -// LoadCountArcgisAccountOauthTokens loads the count of ArcgisAccountOauthTokens for a slice -func (os ArcgisAccountSlice) LoadCountArcgisAccountOauthTokens(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountArcgisAccountOauthTokens(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountServiceFeatures loads the count of ServiceFeatures into the C struct -func (o *ArcgisAccount) LoadCountServiceFeatures(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.ServiceFeatures(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.ServiceFeatures = &count - return nil -} - -// LoadCountServiceFeatures loads the count of ServiceFeatures for a slice -func (os ArcgisAccountSlice) LoadCountServiceFeatures(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountServiceFeatures(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountServiceMaps loads the count of ServiceMaps into the C struct -func (o *ArcgisAccount) LoadCountServiceMaps(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.ServiceMaps(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.ServiceMaps = &count - return nil -} - -// LoadCountServiceMaps loads the count of ServiceMaps for a slice -func (os ArcgisAccountSlice) LoadCountServiceMaps(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountServiceMaps(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountArcgisAccountOrganizations loads the count of ArcgisAccountOrganizations into the C struct -func (o *ArcgisAccount) LoadCountArcgisAccountOrganizations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.ArcgisAccountOrganizations(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.ArcgisAccountOrganizations = &count - return nil -} - -// LoadCountArcgisAccountOrganizations loads the count of ArcgisAccountOrganizations for a slice -func (os ArcgisAccountSlice) LoadCountArcgisAccountOrganizations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountArcgisAccountOrganizations(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type arcgisAccountJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] - ArcgisAccountOauthTokens modAs[Q, arcgisOauthTokenColumns] - ServiceFeatures modAs[Q, arcgisServiceFeatureColumns] - ServiceMaps modAs[Q, arcgisServiceMapColumns] - ArcgisAccountOrganizations modAs[Q, organizationColumns] -} - -func (j arcgisAccountJoins[Q]) aliasedAs(alias string) arcgisAccountJoins[Q] { - return buildArcgisAccountJoins[Q](buildArcgisAccountColumns(alias), j.typ) -} - -func buildArcgisAccountJoins[Q dialect.Joinable](cols arcgisAccountColumns, typ string) arcgisAccountJoins[Q] { - return arcgisAccountJoins[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 - }, - }, - ArcgisAccountOauthTokens: modAs[Q, arcgisOauthTokenColumns]{ - c: ArcgisOauthTokens.Columns, - f: func(to arcgisOauthTokenColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisOauthTokens.Name().As(to.Alias())).On( - to.ArcgisAccountID.EQ(cols.ID), - )) - } - - return mods - }, - }, - ServiceFeatures: modAs[Q, arcgisServiceFeatureColumns]{ - c: ArcgisServiceFeatures.Columns, - f: func(to arcgisServiceFeatureColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisServiceFeatures.Name().As(to.Alias())).On( - to.AccountID.EQ(cols.ID), - )) - } - - return mods - }, - }, - ServiceMaps: modAs[Q, arcgisServiceMapColumns]{ - c: ArcgisServiceMaps.Columns, - f: func(to arcgisServiceMapColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisServiceMaps.Name().As(to.Alias())).On( - to.AccountID.EQ(cols.ID), - )) - } - - return mods - }, - }, - ArcgisAccountOrganizations: 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.ArcgisAccountID.EQ(cols.ID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/arcgis.address_mapping.bob.go b/db/models/arcgis.address_mapping.bob.go index 2f47f37c..f62de49e 100644 --- a/db/models/arcgis.address_mapping.bob.go +++ b/db/models/arcgis.address_mapping.bob.go @@ -15,7 +15,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -836,47 +835,3 @@ func (os ArcgisAddressMappingSlice) LoadOrganization(ctx context.Context, exec b return nil } - -type arcgisAddressMappingJoins[Q dialect.Joinable] struct { - typ string - LayerField modAs[Q, arcgisLayerFieldColumns] - Organization modAs[Q, organizationColumns] -} - -func (j arcgisAddressMappingJoins[Q]) aliasedAs(alias string) arcgisAddressMappingJoins[Q] { - return buildArcgisAddressMappingJoins[Q](buildArcgisAddressMappingColumns(alias), j.typ) -} - -func buildArcgisAddressMappingJoins[Q dialect.Joinable](cols arcgisAddressMappingColumns, typ string) arcgisAddressMappingJoins[Q] { - return arcgisAddressMappingJoins[Q]{ - typ: typ, - LayerField: modAs[Q, arcgisLayerFieldColumns]{ - c: ArcgisLayerFields.Columns, - f: func(to arcgisLayerFieldColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisLayerFields.Name().As(to.Alias())).On( - to.LayerFeatureServiceItemID.EQ(cols.LayerFeatureServiceItemID), to.LayerIndex.EQ(cols.LayerIndex), to.Name.EQ(cols.LayerFieldName), - )) - } - - 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 - }, - }, - } -} diff --git a/db/models/arcgis.layer.bob.go b/db/models/arcgis.layer.bob.go index 0aa7ee5c..b9757a26 100644 --- a/db/models/arcgis.layer.bob.go +++ b/db/models/arcgis.layer.bob.go @@ -15,7 +15,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/omit" @@ -28,8 +27,6 @@ type ArcgisLayer struct { Index int32 `db:"index_,pk" ` R arcgisLayerR `db:"-" ` - - C arcgisLayerC `db:"-" ` } // ArcgisLayerSlice is an alias for a slice of pointers to ArcgisLayer. @@ -796,141 +793,3 @@ func (os ArcgisLayerSlice) LoadLayerFields(ctx context.Context, exec bob.Executo return nil } - -// arcgisLayerC is where relationship counts are stored. -type arcgisLayerC struct { - LayerFields *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *ArcgisLayer) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "LayerFields": - o.C.LayerFields = &count - } - return nil -} - -type arcgisLayerCountPreloader struct { - LayerFields func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildArcgisLayerCountPreloader() arcgisLayerCountPreloader { - return arcgisLayerCountPreloader{ - LayerFields: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*ArcgisLayer]("LayerFields", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = ArcgisLayers.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(ArcgisLayerFields.Name()), - sm.Where(psql.Quote(ArcgisLayerFields.Alias(), "layer_feature_service_item_id").EQ(psql.Quote(parent, "feature_service_item_id"))), - sm.Where(psql.Quote(ArcgisLayerFields.Alias(), "layer_index").EQ(psql.Quote(parent, "index_"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type arcgisLayerCountThenLoader[Q orm.Loadable] struct { - LayerFields func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildArcgisLayerCountThenLoader[Q orm.Loadable]() arcgisLayerCountThenLoader[Q] { - type LayerFieldsCountInterface interface { - LoadCountLayerFields(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return arcgisLayerCountThenLoader[Q]{ - LayerFields: countThenLoadBuilder[Q]( - "LayerFields", - func(ctx context.Context, exec bob.Executor, retrieved LayerFieldsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountLayerFields(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountLayerFields loads the count of LayerFields into the C struct -func (o *ArcgisLayer) LoadCountLayerFields(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.LayerFields(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.LayerFields = &count - return nil -} - -// LoadCountLayerFields loads the count of LayerFields for a slice -func (os ArcgisLayerSlice) LoadCountLayerFields(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountLayerFields(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type arcgisLayerJoins[Q dialect.Joinable] struct { - typ string - FeatureServiceItemServiceFeature modAs[Q, arcgisServiceFeatureColumns] - LayerFields modAs[Q, arcgisLayerFieldColumns] -} - -func (j arcgisLayerJoins[Q]) aliasedAs(alias string) arcgisLayerJoins[Q] { - return buildArcgisLayerJoins[Q](buildArcgisLayerColumns(alias), j.typ) -} - -func buildArcgisLayerJoins[Q dialect.Joinable](cols arcgisLayerColumns, typ string) arcgisLayerJoins[Q] { - return arcgisLayerJoins[Q]{ - typ: typ, - FeatureServiceItemServiceFeature: modAs[Q, arcgisServiceFeatureColumns]{ - c: ArcgisServiceFeatures.Columns, - f: func(to arcgisServiceFeatureColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisServiceFeatures.Name().As(to.Alias())).On( - to.ItemID.EQ(cols.FeatureServiceItemID), - )) - } - - return mods - }, - }, - LayerFields: modAs[Q, arcgisLayerFieldColumns]{ - c: ArcgisLayerFields.Columns, - f: func(to arcgisLayerFieldColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisLayerFields.Name().As(to.Alias())).On( - to.LayerFeatureServiceItemID.EQ(cols.FeatureServiceItemID), to.LayerIndex.EQ(cols.Index), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/arcgis.layer_field.bob.go b/db/models/arcgis.layer_field.bob.go index 8fe37f55..760fc564 100644 --- a/db/models/arcgis.layer_field.bob.go +++ b/db/models/arcgis.layer_field.bob.go @@ -15,7 +15,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -30,8 +29,6 @@ type ArcgisLayerField struct { Type enums.ArcgisFieldtype `db:"type_" ` R arcgisLayerFieldR `db:"-" ` - - C arcgisLayerFieldC `db:"-" ` } // ArcgisLayerFieldSlice is an alias for a slice of pointers to ArcgisLayerField. @@ -1047,220 +1044,3 @@ func (os ArcgisLayerFieldSlice) LoadParcelMappings(ctx context.Context, exec bob return nil } - -// arcgisLayerFieldC is where relationship counts are stored. -type arcgisLayerFieldC struct { - AddressMappings *int64 - ParcelMappings *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *ArcgisLayerField) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "AddressMappings": - o.C.AddressMappings = &count - case "ParcelMappings": - o.C.ParcelMappings = &count - } - return nil -} - -type arcgisLayerFieldCountPreloader struct { - AddressMappings func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - ParcelMappings func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildArcgisLayerFieldCountPreloader() arcgisLayerFieldCountPreloader { - return arcgisLayerFieldCountPreloader{ - AddressMappings: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*ArcgisLayerField]("AddressMappings", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = ArcgisLayerFields.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(ArcgisAddressMappings.Name()), - sm.Where(psql.Quote(ArcgisAddressMappings.Alias(), "layer_feature_service_item_id").EQ(psql.Quote(parent, "layer_feature_service_item_id"))), - sm.Where(psql.Quote(ArcgisAddressMappings.Alias(), "layer_index").EQ(psql.Quote(parent, "layer_index"))), - sm.Where(psql.Quote(ArcgisAddressMappings.Alias(), "layer_field_name").EQ(psql.Quote(parent, "name"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - ParcelMappings: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*ArcgisLayerField]("ParcelMappings", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = ArcgisLayerFields.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(ArcgisParcelMappings.Name()), - sm.Where(psql.Quote(ArcgisParcelMappings.Alias(), "layer_feature_service_item_id").EQ(psql.Quote(parent, "layer_feature_service_item_id"))), - sm.Where(psql.Quote(ArcgisParcelMappings.Alias(), "layer_index").EQ(psql.Quote(parent, "layer_index"))), - sm.Where(psql.Quote(ArcgisParcelMappings.Alias(), "layer_field_name").EQ(psql.Quote(parent, "name"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type arcgisLayerFieldCountThenLoader[Q orm.Loadable] struct { - AddressMappings func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - ParcelMappings func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildArcgisLayerFieldCountThenLoader[Q orm.Loadable]() arcgisLayerFieldCountThenLoader[Q] { - type AddressMappingsCountInterface interface { - LoadCountAddressMappings(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type ParcelMappingsCountInterface interface { - LoadCountParcelMappings(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return arcgisLayerFieldCountThenLoader[Q]{ - AddressMappings: countThenLoadBuilder[Q]( - "AddressMappings", - func(ctx context.Context, exec bob.Executor, retrieved AddressMappingsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountAddressMappings(ctx, exec, mods...) - }, - ), - ParcelMappings: countThenLoadBuilder[Q]( - "ParcelMappings", - func(ctx context.Context, exec bob.Executor, retrieved ParcelMappingsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountParcelMappings(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountAddressMappings loads the count of AddressMappings into the C struct -func (o *ArcgisLayerField) LoadCountAddressMappings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.AddressMappings(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.AddressMappings = &count - return nil -} - -// LoadCountAddressMappings loads the count of AddressMappings for a slice -func (os ArcgisLayerFieldSlice) LoadCountAddressMappings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountAddressMappings(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountParcelMappings loads the count of ParcelMappings into the C struct -func (o *ArcgisLayerField) LoadCountParcelMappings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.ParcelMappings(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.ParcelMappings = &count - return nil -} - -// LoadCountParcelMappings loads the count of ParcelMappings for a slice -func (os ArcgisLayerFieldSlice) LoadCountParcelMappings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountParcelMappings(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type arcgisLayerFieldJoins[Q dialect.Joinable] struct { - typ string - AddressMappings modAs[Q, arcgisAddressMappingColumns] - Layer modAs[Q, arcgisLayerColumns] - ParcelMappings modAs[Q, arcgisParcelMappingColumns] -} - -func (j arcgisLayerFieldJoins[Q]) aliasedAs(alias string) arcgisLayerFieldJoins[Q] { - return buildArcgisLayerFieldJoins[Q](buildArcgisLayerFieldColumns(alias), j.typ) -} - -func buildArcgisLayerFieldJoins[Q dialect.Joinable](cols arcgisLayerFieldColumns, typ string) arcgisLayerFieldJoins[Q] { - return arcgisLayerFieldJoins[Q]{ - typ: typ, - AddressMappings: modAs[Q, arcgisAddressMappingColumns]{ - c: ArcgisAddressMappings.Columns, - f: func(to arcgisAddressMappingColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisAddressMappings.Name().As(to.Alias())).On( - to.LayerFeatureServiceItemID.EQ(cols.LayerFeatureServiceItemID), to.LayerIndex.EQ(cols.LayerIndex), to.LayerFieldName.EQ(cols.Name), - )) - } - - return mods - }, - }, - Layer: modAs[Q, arcgisLayerColumns]{ - c: ArcgisLayers.Columns, - f: func(to arcgisLayerColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisLayers.Name().As(to.Alias())).On( - to.FeatureServiceItemID.EQ(cols.LayerFeatureServiceItemID), to.Index.EQ(cols.LayerIndex), - )) - } - - return mods - }, - }, - ParcelMappings: modAs[Q, arcgisParcelMappingColumns]{ - c: ArcgisParcelMappings.Columns, - f: func(to arcgisParcelMappingColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisParcelMappings.Name().As(to.Alias())).On( - to.LayerFeatureServiceItemID.EQ(cols.LayerFeatureServiceItemID), to.LayerIndex.EQ(cols.LayerIndex), to.LayerFieldName.EQ(cols.Name), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/arcgis.oauth_token.bob.go b/db/models/arcgis.oauth_token.bob.go index 564686a2..233eddd3 100644 --- a/db/models/arcgis.oauth_token.bob.go +++ b/db/models/arcgis.oauth_token.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/null" @@ -988,47 +987,3 @@ func (os ArcgisOauthTokenSlice) LoadUserUser(ctx context.Context, exec bob.Execu return nil } - -type arcgisOauthTokenJoins[Q dialect.Joinable] struct { - typ string - ArcgisAccountAccount modAs[Q, arcgisAccountColumns] - UserUser modAs[Q, userColumns] -} - -func (j arcgisOauthTokenJoins[Q]) aliasedAs(alias string) arcgisOauthTokenJoins[Q] { - return buildArcgisOauthTokenJoins[Q](buildArcgisOauthTokenColumns(alias), j.typ) -} - -func buildArcgisOauthTokenJoins[Q dialect.Joinable](cols arcgisOauthTokenColumns, typ string) arcgisOauthTokenJoins[Q] { - return arcgisOauthTokenJoins[Q]{ - typ: typ, - ArcgisAccountAccount: modAs[Q, arcgisAccountColumns]{ - c: ArcgisAccounts.Columns, - f: func(to arcgisAccountColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisAccounts.Name().As(to.Alias())).On( - to.ID.EQ(cols.ArcgisAccountID), - )) - } - - return mods - }, - }, - UserUser: 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.UserID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/arcgis.parcel_mapping.bob.go b/db/models/arcgis.parcel_mapping.bob.go index 251a5ee7..8b7a8081 100644 --- a/db/models/arcgis.parcel_mapping.bob.go +++ b/db/models/arcgis.parcel_mapping.bob.go @@ -15,7 +15,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -836,47 +835,3 @@ func (os ArcgisParcelMappingSlice) LoadOrganization(ctx context.Context, exec bo return nil } - -type arcgisParcelMappingJoins[Q dialect.Joinable] struct { - typ string - LayerField modAs[Q, arcgisLayerFieldColumns] - Organization modAs[Q, organizationColumns] -} - -func (j arcgisParcelMappingJoins[Q]) aliasedAs(alias string) arcgisParcelMappingJoins[Q] { - return buildArcgisParcelMappingJoins[Q](buildArcgisParcelMappingColumns(alias), j.typ) -} - -func buildArcgisParcelMappingJoins[Q dialect.Joinable](cols arcgisParcelMappingColumns, typ string) arcgisParcelMappingJoins[Q] { - return arcgisParcelMappingJoins[Q]{ - typ: typ, - LayerField: modAs[Q, arcgisLayerFieldColumns]{ - c: ArcgisLayerFields.Columns, - f: func(to arcgisLayerFieldColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisLayerFields.Name().As(to.Alias())).On( - to.LayerFeatureServiceItemID.EQ(cols.LayerFeatureServiceItemID), to.LayerIndex.EQ(cols.LayerIndex), to.Name.EQ(cols.LayerFieldName), - )) - } - - 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 - }, - }, - } -} diff --git a/db/models/arcgis.service_feature.bob.go b/db/models/arcgis.service_feature.bob.go index 7bf06f66..f39485ca 100644 --- a/db/models/arcgis.service_feature.bob.go +++ b/db/models/arcgis.service_feature.bob.go @@ -15,7 +15,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/null" @@ -32,8 +31,6 @@ type ArcgisServiceFeature struct { AccountID null.Val[string] `db:"account_id" ` R arcgisServiceFeatureR `db:"-" ` - - C arcgisServiceFeatureC `db:"-" ` } // ArcgisServiceFeatureSlice is an alias for a slice of pointers to ArcgisServiceFeature. @@ -1012,216 +1009,3 @@ func (os ArcgisServiceFeatureSlice) LoadFieldseekerServiceFeatureItemOrganizatio return nil } - -// arcgisServiceFeatureC is where relationship counts are stored. -type arcgisServiceFeatureC struct { - FeatureServiceItemLayers *int64 - FieldseekerServiceFeatureItemOrganizations *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *ArcgisServiceFeature) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "FeatureServiceItemLayers": - o.C.FeatureServiceItemLayers = &count - case "FieldseekerServiceFeatureItemOrganizations": - o.C.FieldseekerServiceFeatureItemOrganizations = &count - } - return nil -} - -type arcgisServiceFeatureCountPreloader struct { - FeatureServiceItemLayers func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - FieldseekerServiceFeatureItemOrganizations func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildArcgisServiceFeatureCountPreloader() arcgisServiceFeatureCountPreloader { - return arcgisServiceFeatureCountPreloader{ - FeatureServiceItemLayers: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*ArcgisServiceFeature]("FeatureServiceItemLayers", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = ArcgisServiceFeatures.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(ArcgisLayers.Name()), - sm.Where(psql.Quote(ArcgisLayers.Alias(), "feature_service_item_id").EQ(psql.Quote(parent, "item_id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - FieldseekerServiceFeatureItemOrganizations: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*ArcgisServiceFeature]("FieldseekerServiceFeatureItemOrganizations", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = ArcgisServiceFeatures.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(Organizations.Name()), - sm.Where(psql.Quote(Organizations.Alias(), "fieldseeker_service_feature_item_id").EQ(psql.Quote(parent, "item_id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type arcgisServiceFeatureCountThenLoader[Q orm.Loadable] struct { - FeatureServiceItemLayers func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FieldseekerServiceFeatureItemOrganizations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildArcgisServiceFeatureCountThenLoader[Q orm.Loadable]() arcgisServiceFeatureCountThenLoader[Q] { - type FeatureServiceItemLayersCountInterface interface { - LoadCountFeatureServiceItemLayers(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FieldseekerServiceFeatureItemOrganizationsCountInterface interface { - LoadCountFieldseekerServiceFeatureItemOrganizations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return arcgisServiceFeatureCountThenLoader[Q]{ - FeatureServiceItemLayers: countThenLoadBuilder[Q]( - "FeatureServiceItemLayers", - func(ctx context.Context, exec bob.Executor, retrieved FeatureServiceItemLayersCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountFeatureServiceItemLayers(ctx, exec, mods...) - }, - ), - FieldseekerServiceFeatureItemOrganizations: countThenLoadBuilder[Q]( - "FieldseekerServiceFeatureItemOrganizations", - func(ctx context.Context, exec bob.Executor, retrieved FieldseekerServiceFeatureItemOrganizationsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountFieldseekerServiceFeatureItemOrganizations(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountFeatureServiceItemLayers loads the count of FeatureServiceItemLayers into the C struct -func (o *ArcgisServiceFeature) LoadCountFeatureServiceItemLayers(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.FeatureServiceItemLayers(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.FeatureServiceItemLayers = &count - return nil -} - -// LoadCountFeatureServiceItemLayers loads the count of FeatureServiceItemLayers for a slice -func (os ArcgisServiceFeatureSlice) LoadCountFeatureServiceItemLayers(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountFeatureServiceItemLayers(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountFieldseekerServiceFeatureItemOrganizations loads the count of FieldseekerServiceFeatureItemOrganizations into the C struct -func (o *ArcgisServiceFeature) LoadCountFieldseekerServiceFeatureItemOrganizations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.FieldseekerServiceFeatureItemOrganizations(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.FieldseekerServiceFeatureItemOrganizations = &count - return nil -} - -// LoadCountFieldseekerServiceFeatureItemOrganizations loads the count of FieldseekerServiceFeatureItemOrganizations for a slice -func (os ArcgisServiceFeatureSlice) LoadCountFieldseekerServiceFeatureItemOrganizations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountFieldseekerServiceFeatureItemOrganizations(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type arcgisServiceFeatureJoins[Q dialect.Joinable] struct { - typ string - FeatureServiceItemLayers modAs[Q, arcgisLayerColumns] - Account modAs[Q, arcgisAccountColumns] - FieldseekerServiceFeatureItemOrganizations modAs[Q, organizationColumns] -} - -func (j arcgisServiceFeatureJoins[Q]) aliasedAs(alias string) arcgisServiceFeatureJoins[Q] { - return buildArcgisServiceFeatureJoins[Q](buildArcgisServiceFeatureColumns(alias), j.typ) -} - -func buildArcgisServiceFeatureJoins[Q dialect.Joinable](cols arcgisServiceFeatureColumns, typ string) arcgisServiceFeatureJoins[Q] { - return arcgisServiceFeatureJoins[Q]{ - typ: typ, - FeatureServiceItemLayers: modAs[Q, arcgisLayerColumns]{ - c: ArcgisLayers.Columns, - f: func(to arcgisLayerColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisLayers.Name().As(to.Alias())).On( - to.FeatureServiceItemID.EQ(cols.ItemID), - )) - } - - return mods - }, - }, - Account: modAs[Q, arcgisAccountColumns]{ - c: ArcgisAccounts.Columns, - f: func(to arcgisAccountColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisAccounts.Name().As(to.Alias())).On( - to.ID.EQ(cols.AccountID), - )) - } - - return mods - }, - }, - FieldseekerServiceFeatureItemOrganizations: 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.FieldseekerServiceFeatureItemID.EQ(cols.ItemID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/arcgis.service_map.bob.go b/db/models/arcgis.service_map.bob.go index 2f64922a..49695249 100644 --- a/db/models/arcgis.service_map.bob.go +++ b/db/models/arcgis.service_map.bob.go @@ -15,7 +15,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/omit" @@ -646,32 +645,3 @@ func (os ArcgisServiceMapSlice) LoadAccount(ctx context.Context, exec bob.Execut return nil } - -type arcgisServiceMapJoins[Q dialect.Joinable] struct { - typ string - Account modAs[Q, arcgisAccountColumns] -} - -func (j arcgisServiceMapJoins[Q]) aliasedAs(alias string) arcgisServiceMapJoins[Q] { - return buildArcgisServiceMapJoins[Q](buildArcgisServiceMapColumns(alias), j.typ) -} - -func buildArcgisServiceMapJoins[Q dialect.Joinable](cols arcgisServiceMapColumns, typ string) arcgisServiceMapJoins[Q] { - return arcgisServiceMapJoins[Q]{ - typ: typ, - Account: modAs[Q, arcgisAccountColumns]{ - c: ArcgisAccounts.Columns, - f: func(to arcgisAccountColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisAccounts.Name().As(to.Alias())).On( - to.ID.EQ(cols.AccountID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/arcgis.user_.bob.go b/db/models/arcgis.user_.bob.go index 3796abf0..6a60b461 100644 --- a/db/models/arcgis.user_.bob.go +++ b/db/models/arcgis.user_.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/omit" @@ -40,8 +39,6 @@ type ArcgisUser struct { UserType string `db:"user_type" ` R arcgisuserR `db:"-" ` - - C arcgisuserC `db:"-" ` } // ArcgisUserSlice is an alias for a slice of pointers to ArcgisUser. @@ -1052,140 +1049,3 @@ func (os ArcgisUserSlice) LoadUserUserPrivileges(ctx context.Context, exec bob.E return nil } - -// arcgisuserC is where relationship counts are stored. -type arcgisuserC struct { - UserUserPrivileges *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *ArcgisUser) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "UserUserPrivileges": - o.C.UserUserPrivileges = &count - } - return nil -} - -type arcgisuserCountPreloader struct { - UserUserPrivileges func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildArcgisUserCountPreloader() arcgisuserCountPreloader { - return arcgisuserCountPreloader{ - UserUserPrivileges: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*ArcgisUser]("UserUserPrivileges", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = ArcgisUsers.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(ArcgisUserPrivileges.Name()), - sm.Where(psql.Quote(ArcgisUserPrivileges.Alias(), "user_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type arcgisuserCountThenLoader[Q orm.Loadable] struct { - UserUserPrivileges func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildArcgisUserCountThenLoader[Q orm.Loadable]() arcgisuserCountThenLoader[Q] { - type UserUserPrivilegesCountInterface interface { - LoadCountUserUserPrivileges(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return arcgisuserCountThenLoader[Q]{ - UserUserPrivileges: countThenLoadBuilder[Q]( - "UserUserPrivileges", - func(ctx context.Context, exec bob.Executor, retrieved UserUserPrivilegesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountUserUserPrivileges(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountUserUserPrivileges loads the count of UserUserPrivileges into the C struct -func (o *ArcgisUser) LoadCountUserUserPrivileges(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.UserUserPrivileges(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.UserUserPrivileges = &count - return nil -} - -// LoadCountUserUserPrivileges loads the count of UserUserPrivileges for a slice -func (os ArcgisUserSlice) LoadCountUserUserPrivileges(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountUserUserPrivileges(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type arcgisuserJoins[Q dialect.Joinable] struct { - typ string - PublicUserUser modAs[Q, userColumns] - UserUserPrivileges modAs[Q, arcgisUserPrivilegeColumns] -} - -func (j arcgisuserJoins[Q]) aliasedAs(alias string) arcgisuserJoins[Q] { - return buildArcgisUserJoins[Q](buildArcgisUserColumns(alias), j.typ) -} - -func buildArcgisUserJoins[Q dialect.Joinable](cols arcgisuserColumns, typ string) arcgisuserJoins[Q] { - return arcgisuserJoins[Q]{ - typ: typ, - PublicUserUser: 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.PublicUserID), - )) - } - - return mods - }, - }, - UserUserPrivileges: modAs[Q, arcgisUserPrivilegeColumns]{ - c: ArcgisUserPrivileges.Columns, - f: func(to arcgisUserPrivilegeColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisUserPrivileges.Name().As(to.Alias())).On( - to.UserID.EQ(cols.ID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/arcgis.user_privilege.bob.go b/db/models/arcgis.user_privilege.bob.go index 00b0a456..7573f0dd 100644 --- a/db/models/arcgis.user_privilege.bob.go +++ b/db/models/arcgis.user_privilege.bob.go @@ -15,7 +15,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/omit" @@ -581,32 +580,3 @@ func (os ArcgisUserPrivilegeSlice) LoadUserUser(ctx context.Context, exec bob.Ex return nil } - -type arcgisUserPrivilegeJoins[Q dialect.Joinable] struct { - typ string - UserUser modAs[Q, arcgisuserColumns] -} - -func (j arcgisUserPrivilegeJoins[Q]) aliasedAs(alias string) arcgisUserPrivilegeJoins[Q] { - return buildArcgisUserPrivilegeJoins[Q](buildArcgisUserPrivilegeColumns(alias), j.typ) -} - -func buildArcgisUserPrivilegeJoins[Q dialect.Joinable](cols arcgisUserPrivilegeColumns, typ string) arcgisUserPrivilegeJoins[Q] { - return arcgisUserPrivilegeJoins[Q]{ - typ: typ, - UserUser: modAs[Q, arcgisuserColumns]{ - c: ArcgisUsers.Columns, - f: func(to arcgisuserColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisUsers.Name().As(to.Alias())).On( - to.ID.EQ(cols.UserID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/bob_counts.bob.go b/db/models/bob_counts.bob.go deleted file mode 100644 index 23b567d0..00000000 --- a/db/models/bob_counts.bob.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package models - -import ( - "context" - "io" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/dialect/psql" - "github.com/Gleipnir-Technology/bob/dialect/psql/dialect" - "github.com/Gleipnir-Technology/bob/orm" - "github.com/stephenafamo/scan" -) - -var ( - PreloadCount = getPreloadCount() - ThenLoadCount = getThenLoadCount[*dialect.SelectQuery]() - InsertThenLoadCount = getThenLoadCount[*dialect.InsertQuery]() -) - -type preloadCounts struct { - Address addressCountPreloader - ArcgisAccount arcgisAccountCountPreloader - ArcgisLayer arcgisLayerCountPreloader - ArcgisLayerField arcgisLayerFieldCountPreloader - ArcgisServiceFeature arcgisServiceFeatureCountPreloader - ArcgisUser arcgisuserCountPreloader - CommsEmailContact commsEmailContactCountPreloader - CommsEmailTemplate commsEmailTemplateCountPreloader - CommsMailer commsMailerCountPreloader - CommsPhone commsPhoneCountPreloader - ComplianceReportRequest complianceReportRequestCountPreloader - FileuploadCSV fileuploadCSVCountPreloader - FileuploadFile fileuploadFileCountPreloader - Lead leadCountPreloader - NoteAudio noteAudioCountPreloader - NoteImage noteImageCountPreloader - Organization organizationCountPreloader - Parcel parcelCountPreloader - Pool poolCountPreloader - PublicreportImage publicreportImageCountPreloader - PublicreportNuisance publicreportNuisanceCountPreloader - PublicreportPool publicreportPoolCountPreloader - PublicreportQuick publicreportQuickCountPreloader - Signal signalCountPreloader - Site siteCountPreloader - User userCountPreloader -} - -func getPreloadCount() preloadCounts { - return preloadCounts{ - Address: buildAddressCountPreloader(), - ArcgisAccount: buildArcgisAccountCountPreloader(), - ArcgisLayer: buildArcgisLayerCountPreloader(), - ArcgisLayerField: buildArcgisLayerFieldCountPreloader(), - ArcgisServiceFeature: buildArcgisServiceFeatureCountPreloader(), - ArcgisUser: buildArcgisUserCountPreloader(), - CommsEmailContact: buildCommsEmailContactCountPreloader(), - CommsEmailTemplate: buildCommsEmailTemplateCountPreloader(), - CommsMailer: buildCommsMailerCountPreloader(), - CommsPhone: buildCommsPhoneCountPreloader(), - ComplianceReportRequest: buildComplianceReportRequestCountPreloader(), - FileuploadCSV: buildFileuploadCSVCountPreloader(), - FileuploadFile: buildFileuploadFileCountPreloader(), - Lead: buildLeadCountPreloader(), - NoteAudio: buildNoteAudioCountPreloader(), - NoteImage: buildNoteImageCountPreloader(), - Organization: buildOrganizationCountPreloader(), - Parcel: buildParcelCountPreloader(), - Pool: buildPoolCountPreloader(), - PublicreportImage: buildPublicreportImageCountPreloader(), - PublicreportNuisance: buildPublicreportNuisanceCountPreloader(), - PublicreportPool: buildPublicreportPoolCountPreloader(), - PublicreportQuick: buildPublicreportQuickCountPreloader(), - Signal: buildSignalCountPreloader(), - Site: buildSiteCountPreloader(), - User: buildUserCountPreloader(), - } -} - -type thenLoadCounts[Q orm.Loadable] struct { - Address addressCountThenLoader[Q] - ArcgisAccount arcgisAccountCountThenLoader[Q] - ArcgisLayer arcgisLayerCountThenLoader[Q] - ArcgisLayerField arcgisLayerFieldCountThenLoader[Q] - ArcgisServiceFeature arcgisServiceFeatureCountThenLoader[Q] - ArcgisUser arcgisuserCountThenLoader[Q] - CommsEmailContact commsEmailContactCountThenLoader[Q] - CommsEmailTemplate commsEmailTemplateCountThenLoader[Q] - CommsMailer commsMailerCountThenLoader[Q] - CommsPhone commsPhoneCountThenLoader[Q] - ComplianceReportRequest complianceReportRequestCountThenLoader[Q] - FileuploadCSV fileuploadCSVCountThenLoader[Q] - FileuploadFile fileuploadFileCountThenLoader[Q] - Lead leadCountThenLoader[Q] - NoteAudio noteAudioCountThenLoader[Q] - NoteImage noteImageCountThenLoader[Q] - Organization organizationCountThenLoader[Q] - Parcel parcelCountThenLoader[Q] - Pool poolCountThenLoader[Q] - PublicreportImage publicreportImageCountThenLoader[Q] - PublicreportNuisance publicreportNuisanceCountThenLoader[Q] - PublicreportPool publicreportPoolCountThenLoader[Q] - PublicreportQuick publicreportQuickCountThenLoader[Q] - Signal signalCountThenLoader[Q] - Site siteCountThenLoader[Q] - User userCountThenLoader[Q] -} - -func getThenLoadCount[Q orm.Loadable]() thenLoadCounts[Q] { - return thenLoadCounts[Q]{ - Address: buildAddressCountThenLoader[Q](), - ArcgisAccount: buildArcgisAccountCountThenLoader[Q](), - ArcgisLayer: buildArcgisLayerCountThenLoader[Q](), - ArcgisLayerField: buildArcgisLayerFieldCountThenLoader[Q](), - ArcgisServiceFeature: buildArcgisServiceFeatureCountThenLoader[Q](), - ArcgisUser: buildArcgisUserCountThenLoader[Q](), - CommsEmailContact: buildCommsEmailContactCountThenLoader[Q](), - CommsEmailTemplate: buildCommsEmailTemplateCountThenLoader[Q](), - CommsMailer: buildCommsMailerCountThenLoader[Q](), - CommsPhone: buildCommsPhoneCountThenLoader[Q](), - ComplianceReportRequest: buildComplianceReportRequestCountThenLoader[Q](), - FileuploadCSV: buildFileuploadCSVCountThenLoader[Q](), - FileuploadFile: buildFileuploadFileCountThenLoader[Q](), - Lead: buildLeadCountThenLoader[Q](), - NoteAudio: buildNoteAudioCountThenLoader[Q](), - NoteImage: buildNoteImageCountThenLoader[Q](), - Organization: buildOrganizationCountThenLoader[Q](), - Parcel: buildParcelCountThenLoader[Q](), - Pool: buildPoolCountThenLoader[Q](), - PublicreportImage: buildPublicreportImageCountThenLoader[Q](), - PublicreportNuisance: buildPublicreportNuisanceCountThenLoader[Q](), - PublicreportPool: buildPublicreportPoolCountThenLoader[Q](), - PublicreportQuick: buildPublicreportQuickCountThenLoader[Q](), - Signal: buildSignalCountThenLoader[Q](), - Site: buildSiteCountThenLoader[Q](), - User: buildUserCountThenLoader[Q](), - } -} - -func countThenLoadBuilder[Q orm.Loadable, T any](name string, f func(context.Context, bob.Executor, T, ...bob.Mod[*dialect.SelectQuery]) error) func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] { - return func(queryMods ...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] { - return func(ctx context.Context, exec bob.Executor, retrieved any) error { - loader, isLoader := retrieved.(T) - if !isLoader { - return nil // silently skip if not the right type - } - - return f(ctx, exec, loader, queryMods...) - } - } -} - -// countPreloadable is an interface for models that can have counts preloaded -type countPreloadable interface { - PreloadCount(name string, count int64) error -} - -// countPreloadMod is used to add a count subquery to the SELECT -type countPreloadMod[T countPreloadable] struct { - name string - countExpr func(from string) bob.Expression -} - -// Apply implements bob.Mod -func (c countPreloadMod[T]) Apply(q *dialect.SelectQuery) { - c.applyCount(q, "") -} - -// applyCount adds the count subquery to the query -func (c countPreloadMod[T]) applyCount(q *dialect.SelectQuery, parent string) { - countCol := c.countExpr(parent) - q.AppendPreloadSelect(aliasedExpr{expr: countCol, alias: "__count_" + c.name}) -} - -// aliasedExpr wraps an expression with an alias -type aliasedExpr struct { - expr bob.Expression - alias string -} - -func (a aliasedExpr) WriteSQL(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { - args, err := a.expr.WriteSQL(ctx, w, d, start) - if err != nil { - return nil, err - } - w.WriteString(" AS ") - d.WriteQuoted(w, a.alias) - return args, nil -} - -// countPreloader returns a Preloader that adds a count subquery -func countPreloader[T countPreloadable](name string, countExpr func(from string) bob.Expression) psql.Preloader { - return func(parent string) (bob.Mod[*dialect.SelectQuery], scan.MapperMod, []bob.Loader) { - m := countPreloadMod[T]{ - name: name, - countExpr: countExpr, - } - - queryMod := bob.ModFunc[*dialect.SelectQuery](func(q *dialect.SelectQuery) { - m.applyCount(q, parent) - }) - - mapperMod := func(ctx context.Context, cols []string) (scan.BeforeFunc, scan.AfterMod) { - // Find the count column - countColName := "__count_" + name - colIndex := -1 - for i, col := range cols { - if col == countColName { - colIndex = i - break - } - } - - return func(r *scan.Row) (any, error) { - if colIndex >= 0 { - var count *int64 - r.ScheduleScanByIndex(colIndex, &count) - return &count, nil - } - return nil, nil - }, func(link, retrieved any) error { - if link == nil { - return nil - } - countPtr, ok := link.(**int64) - if !ok || countPtr == nil || *countPtr == nil { - return nil - } - - loader, isLoader := retrieved.(countPreloadable) - if !isLoader { - return nil - } - - return loader.PreloadCount(name, **countPtr) - } - } - - return queryMod, mapperMod, nil - } -} diff --git a/db/models/bob_joins.bob.go b/db/models/bob_joins.bob.go deleted file mode 100644 index 6e807d2c..00000000 --- a/db/models/bob_joins.bob.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by BobGen psql v0.42.5. DO NOT EDIT. -// This file is meant to be re-generated in place and/or deleted at any time. - -package models - -import ( - "hash/maphash" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/clause" - "github.com/Gleipnir-Technology/bob/dialect/psql/dialect" -) - -var ( - SelectJoins = getJoins[*dialect.SelectQuery]() - UpdateJoins = getJoins[*dialect.UpdateQuery]() - DeleteJoins = getJoins[*dialect.DeleteQuery]() -) - -type joinSet[Q interface{ aliasedAs(string) Q }] struct { - InnerJoin Q - LeftJoin Q - RightJoin Q -} - -func (j joinSet[Q]) AliasedAs(alias string) joinSet[Q] { - return joinSet[Q]{ - InnerJoin: j.InnerJoin.aliasedAs(alias), - LeftJoin: j.LeftJoin.aliasedAs(alias), - RightJoin: j.RightJoin.aliasedAs(alias), - } -} - -type joins[Q dialect.Joinable] struct { - Addresses joinSet[addressJoins[Q]] - ArcgisAccounts joinSet[arcgisAccountJoins[Q]] - ArcgisAddressMappings joinSet[arcgisAddressMappingJoins[Q]] - ArcgisLayers joinSet[arcgisLayerJoins[Q]] - ArcgisLayerFields joinSet[arcgisLayerFieldJoins[Q]] - ArcgisOauthTokens joinSet[arcgisOauthTokenJoins[Q]] - ArcgisParcelMappings joinSet[arcgisParcelMappingJoins[Q]] - ArcgisServiceFeatures joinSet[arcgisServiceFeatureJoins[Q]] - ArcgisServiceMaps joinSet[arcgisServiceMapJoins[Q]] - ArcgisUsers joinSet[arcgisuserJoins[Q]] - ArcgisUserPrivileges joinSet[arcgisUserPrivilegeJoins[Q]] - CommsEmailContacts joinSet[commsEmailContactJoins[Q]] - CommsEmailLogs joinSet[commsEmailLogJoins[Q]] - CommsEmailTemplates joinSet[commsEmailTemplateJoins[Q]] - CommsMailers joinSet[commsMailerJoins[Q]] - CommsPhones joinSet[commsPhoneJoins[Q]] - CommsTextJobs joinSet[commsTextJobJoins[Q]] - CommsTextLogs joinSet[commsTextLogJoins[Q]] - ComplianceReportRequests joinSet[complianceReportRequestJoins[Q]] - ComplianceReportRequestMailers joinSet[complianceReportRequestMailerJoins[Q]] - DistrictSubscriptionEmails joinSet[districtSubscriptionEmailJoins[Q]] - DistrictSubscriptionPhones joinSet[districtSubscriptionPhoneJoins[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]] - FileuploadCSVS joinSet[fileuploadCSVJoins[Q]] - FileuploadErrorCSVS joinSet[fileuploadErrorCSVJoins[Q]] - FileuploadErrorFiles joinSet[fileuploadErrorFileJoins[Q]] - FileuploadFiles joinSet[fileuploadFileJoins[Q]] - FileuploadPools joinSet[fileuploadPoolJoins[Q]] - H3Aggregations joinSet[h3AggregationJoins[Q]] - Leads joinSet[leadJoins[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]] - Organizations joinSet[organizationJoins[Q]] - Parcels joinSet[parcelJoins[Q]] - Pools joinSet[poolJoins[Q]] - PublicreportImages joinSet[publicreportImageJoins[Q]] - PublicreportImageExifs joinSet[publicreportImageExifJoins[Q]] - PublicreportNotifyEmailNuisances joinSet[publicreportNotifyEmailNuisanceJoins[Q]] - PublicreportNotifyEmailPools joinSet[publicreportNotifyEmailPoolJoins[Q]] - PublicreportNotifyPhoneNuisances joinSet[publicreportNotifyPhoneNuisanceJoins[Q]] - PublicreportNotifyPhonePools joinSet[publicreportNotifyPhonePoolJoins[Q]] - PublicreportNuisances joinSet[publicreportNuisanceJoins[Q]] - PublicreportNuisanceImages joinSet[publicreportNuisanceImageJoins[Q]] - PublicreportPools joinSet[publicreportPoolJoins[Q]] - PublicreportPoolImages joinSet[publicreportPoolImageJoins[Q]] - PublicreportQuicks joinSet[publicreportQuickJoins[Q]] - PublicreportQuickImages joinSet[publicreportQuickImageJoins[Q]] - PublicreportSubscribeEmails joinSet[publicreportSubscribeEmailJoins[Q]] - PublicreportSubscribePhones joinSet[publicreportSubscribePhoneJoins[Q]] - Residents joinSet[residentJoins[Q]] - Signals joinSet[signalJoins[Q]] - SignalPools joinSet[signalPoolJoins[Q]] - Sites joinSet[siteJoins[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] { - return joinSet[Q]{ - InnerJoin: f(c, clause.InnerJoin), - LeftJoin: f(c, clause.LeftJoin), - RightJoin: f(c, clause.RightJoin), - } -} - -func getJoins[Q dialect.Joinable]() joins[Q] { - return joins[Q]{ - Addresses: buildJoinSet[addressJoins[Q]](Addresses.Columns, buildAddressJoins), - ArcgisAccounts: buildJoinSet[arcgisAccountJoins[Q]](ArcgisAccounts.Columns, buildArcgisAccountJoins), - ArcgisAddressMappings: buildJoinSet[arcgisAddressMappingJoins[Q]](ArcgisAddressMappings.Columns, buildArcgisAddressMappingJoins), - ArcgisLayers: buildJoinSet[arcgisLayerJoins[Q]](ArcgisLayers.Columns, buildArcgisLayerJoins), - ArcgisLayerFields: buildJoinSet[arcgisLayerFieldJoins[Q]](ArcgisLayerFields.Columns, buildArcgisLayerFieldJoins), - ArcgisOauthTokens: buildJoinSet[arcgisOauthTokenJoins[Q]](ArcgisOauthTokens.Columns, buildArcgisOauthTokenJoins), - ArcgisParcelMappings: buildJoinSet[arcgisParcelMappingJoins[Q]](ArcgisParcelMappings.Columns, buildArcgisParcelMappingJoins), - ArcgisServiceFeatures: buildJoinSet[arcgisServiceFeatureJoins[Q]](ArcgisServiceFeatures.Columns, buildArcgisServiceFeatureJoins), - ArcgisServiceMaps: buildJoinSet[arcgisServiceMapJoins[Q]](ArcgisServiceMaps.Columns, buildArcgisServiceMapJoins), - ArcgisUsers: buildJoinSet[arcgisuserJoins[Q]](ArcgisUsers.Columns, buildArcgisUserJoins), - ArcgisUserPrivileges: buildJoinSet[arcgisUserPrivilegeJoins[Q]](ArcgisUserPrivileges.Columns, buildArcgisUserPrivilegeJoins), - CommsEmailContacts: buildJoinSet[commsEmailContactJoins[Q]](CommsEmailContacts.Columns, buildCommsEmailContactJoins), - CommsEmailLogs: buildJoinSet[commsEmailLogJoins[Q]](CommsEmailLogs.Columns, buildCommsEmailLogJoins), - CommsEmailTemplates: buildJoinSet[commsEmailTemplateJoins[Q]](CommsEmailTemplates.Columns, buildCommsEmailTemplateJoins), - CommsMailers: buildJoinSet[commsMailerJoins[Q]](CommsMailers.Columns, buildCommsMailerJoins), - CommsPhones: buildJoinSet[commsPhoneJoins[Q]](CommsPhones.Columns, buildCommsPhoneJoins), - CommsTextJobs: buildJoinSet[commsTextJobJoins[Q]](CommsTextJobs.Columns, buildCommsTextJobJoins), - CommsTextLogs: buildJoinSet[commsTextLogJoins[Q]](CommsTextLogs.Columns, buildCommsTextLogJoins), - ComplianceReportRequests: buildJoinSet[complianceReportRequestJoins[Q]](ComplianceReportRequests.Columns, buildComplianceReportRequestJoins), - ComplianceReportRequestMailers: buildJoinSet[complianceReportRequestMailerJoins[Q]](ComplianceReportRequestMailers.Columns, buildComplianceReportRequestMailerJoins), - DistrictSubscriptionEmails: buildJoinSet[districtSubscriptionEmailJoins[Q]](DistrictSubscriptionEmails.Columns, buildDistrictSubscriptionEmailJoins), - DistrictSubscriptionPhones: buildJoinSet[districtSubscriptionPhoneJoins[Q]](DistrictSubscriptionPhones.Columns, buildDistrictSubscriptionPhoneJoins), - 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), - FileuploadCSVS: buildJoinSet[fileuploadCSVJoins[Q]](FileuploadCSVS.Columns, buildFileuploadCSVJoins), - FileuploadErrorCSVS: buildJoinSet[fileuploadErrorCSVJoins[Q]](FileuploadErrorCSVS.Columns, buildFileuploadErrorCSVJoins), - FileuploadErrorFiles: buildJoinSet[fileuploadErrorFileJoins[Q]](FileuploadErrorFiles.Columns, buildFileuploadErrorFileJoins), - FileuploadFiles: buildJoinSet[fileuploadFileJoins[Q]](FileuploadFiles.Columns, buildFileuploadFileJoins), - FileuploadPools: buildJoinSet[fileuploadPoolJoins[Q]](FileuploadPools.Columns, buildFileuploadPoolJoins), - H3Aggregations: buildJoinSet[h3AggregationJoins[Q]](H3Aggregations.Columns, buildH3AggregationJoins), - Leads: buildJoinSet[leadJoins[Q]](Leads.Columns, buildLeadJoins), - 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), - Organizations: buildJoinSet[organizationJoins[Q]](Organizations.Columns, buildOrganizationJoins), - Parcels: buildJoinSet[parcelJoins[Q]](Parcels.Columns, buildParcelJoins), - Pools: buildJoinSet[poolJoins[Q]](Pools.Columns, buildPoolJoins), - PublicreportImages: buildJoinSet[publicreportImageJoins[Q]](PublicreportImages.Columns, buildPublicreportImageJoins), - PublicreportImageExifs: buildJoinSet[publicreportImageExifJoins[Q]](PublicreportImageExifs.Columns, buildPublicreportImageExifJoins), - PublicreportNotifyEmailNuisances: buildJoinSet[publicreportNotifyEmailNuisanceJoins[Q]](PublicreportNotifyEmailNuisances.Columns, buildPublicreportNotifyEmailNuisanceJoins), - PublicreportNotifyEmailPools: buildJoinSet[publicreportNotifyEmailPoolJoins[Q]](PublicreportNotifyEmailPools.Columns, buildPublicreportNotifyEmailPoolJoins), - PublicreportNotifyPhoneNuisances: buildJoinSet[publicreportNotifyPhoneNuisanceJoins[Q]](PublicreportNotifyPhoneNuisances.Columns, buildPublicreportNotifyPhoneNuisanceJoins), - PublicreportNotifyPhonePools: buildJoinSet[publicreportNotifyPhonePoolJoins[Q]](PublicreportNotifyPhonePools.Columns, buildPublicreportNotifyPhonePoolJoins), - PublicreportNuisances: buildJoinSet[publicreportNuisanceJoins[Q]](PublicreportNuisances.Columns, buildPublicreportNuisanceJoins), - PublicreportNuisanceImages: buildJoinSet[publicreportNuisanceImageJoins[Q]](PublicreportNuisanceImages.Columns, buildPublicreportNuisanceImageJoins), - PublicreportPools: buildJoinSet[publicreportPoolJoins[Q]](PublicreportPools.Columns, buildPublicreportPoolJoins), - PublicreportPoolImages: buildJoinSet[publicreportPoolImageJoins[Q]](PublicreportPoolImages.Columns, buildPublicreportPoolImageJoins), - PublicreportQuicks: buildJoinSet[publicreportQuickJoins[Q]](PublicreportQuicks.Columns, buildPublicreportQuickJoins), - PublicreportQuickImages: buildJoinSet[publicreportQuickImageJoins[Q]](PublicreportQuickImages.Columns, buildPublicreportQuickImageJoins), - PublicreportSubscribeEmails: buildJoinSet[publicreportSubscribeEmailJoins[Q]](PublicreportSubscribeEmails.Columns, buildPublicreportSubscribeEmailJoins), - PublicreportSubscribePhones: buildJoinSet[publicreportSubscribePhoneJoins[Q]](PublicreportSubscribePhones.Columns, buildPublicreportSubscribePhoneJoins), - Residents: buildJoinSet[residentJoins[Q]](Residents.Columns, buildResidentJoins), - Signals: buildJoinSet[signalJoins[Q]](Signals.Columns, buildSignalJoins), - SignalPools: buildJoinSet[signalPoolJoins[Q]](SignalPools.Columns, buildSignalPoolJoins), - Sites: buildJoinSet[siteJoins[Q]](Sites.Columns, buildSiteJoins), - Users: buildJoinSet[userJoins[Q]](Users.Columns, buildUserJoins), - } -} - -type modAs[Q any, C interface{ AliasedAs(string) C }] struct { - c C - f func(C) bob.Mod[Q] -} - -func (m modAs[Q, C]) Apply(q Q) { - m.f(m.c).Apply(q) -} - -func (m modAs[Q, C]) AliasedAs(alias string) bob.Mod[Q] { - m.c = m.c.AliasedAs(alias) - return m -} - -func randInt() int64 { - out := int64(new(maphash.Hash).Sum64()) - - if out < 0 { - return -out % 10000 - } - - return out % 10000 -} diff --git a/db/models/bob_loaders.bob.go b/db/models/bob_loaders.bob.go index fd842564..46c5c500 100644 --- a/db/models/bob_loaders.bob.go +++ b/db/models/bob_loaders.bob.go @@ -39,6 +39,8 @@ type preloaders struct { ComplianceReportRequestMailer complianceReportRequestMailerPreloader DistrictSubscriptionEmail districtSubscriptionEmailPreloader DistrictSubscriptionPhone districtSubscriptionPhonePreloader + Feature featurePreloader + FeaturePool featurePoolPreloader FieldseekerContainerrelate fieldseekerContainerrelatePreloader FieldseekerFieldscoutinglog fieldseekerFieldscoutinglogPreloader FieldseekerHabitatrelate fieldseekerHabitatrelatePreloader @@ -83,7 +85,6 @@ type preloaders struct { Notification notificationPreloader Organization organizationPreloader Parcel parcelPreloader - Pool poolPreloader PublicreportImage publicreportImagePreloader PublicreportImageExif publicreportImageExifPreloader PublicreportNotifyEmailNuisance publicreportNotifyEmailNuisancePreloader @@ -99,8 +100,9 @@ type preloaders struct { PublicreportSubscribeEmail publicreportSubscribeEmailPreloader PublicreportSubscribePhone publicreportSubscribePhonePreloader Resident residentPreloader + ReviewTask reviewTaskPreloader + ReviewTaskPool reviewTaskPoolPreloader Signal signalPreloader - SignalPool signalPoolPreloader Site sitePreloader User userPreloader } @@ -129,6 +131,8 @@ func getPreloaders() preloaders { ComplianceReportRequestMailer: buildComplianceReportRequestMailerPreloader(), DistrictSubscriptionEmail: buildDistrictSubscriptionEmailPreloader(), DistrictSubscriptionPhone: buildDistrictSubscriptionPhonePreloader(), + Feature: buildFeaturePreloader(), + FeaturePool: buildFeaturePoolPreloader(), FieldseekerContainerrelate: buildFieldseekerContainerrelatePreloader(), FieldseekerFieldscoutinglog: buildFieldseekerFieldscoutinglogPreloader(), FieldseekerHabitatrelate: buildFieldseekerHabitatrelatePreloader(), @@ -173,7 +177,6 @@ func getPreloaders() preloaders { Notification: buildNotificationPreloader(), Organization: buildOrganizationPreloader(), Parcel: buildParcelPreloader(), - Pool: buildPoolPreloader(), PublicreportImage: buildPublicreportImagePreloader(), PublicreportImageExif: buildPublicreportImageExifPreloader(), PublicreportNotifyEmailNuisance: buildPublicreportNotifyEmailNuisancePreloader(), @@ -189,8 +192,9 @@ func getPreloaders() preloaders { PublicreportSubscribeEmail: buildPublicreportSubscribeEmailPreloader(), PublicreportSubscribePhone: buildPublicreportSubscribePhonePreloader(), Resident: buildResidentPreloader(), + ReviewTask: buildReviewTaskPreloader(), + ReviewTaskPool: buildReviewTaskPoolPreloader(), Signal: buildSignalPreloader(), - SignalPool: buildSignalPoolPreloader(), Site: buildSitePreloader(), User: buildUserPreloader(), } @@ -225,6 +229,8 @@ type thenLoaders[Q orm.Loadable] struct { ComplianceReportRequestMailer complianceReportRequestMailerThenLoader[Q] DistrictSubscriptionEmail districtSubscriptionEmailThenLoader[Q] DistrictSubscriptionPhone districtSubscriptionPhoneThenLoader[Q] + Feature featureThenLoader[Q] + FeaturePool featurePoolThenLoader[Q] FieldseekerContainerrelate fieldseekerContainerrelateThenLoader[Q] FieldseekerFieldscoutinglog fieldseekerFieldscoutinglogThenLoader[Q] FieldseekerHabitatrelate fieldseekerHabitatrelateThenLoader[Q] @@ -269,7 +275,6 @@ type thenLoaders[Q orm.Loadable] struct { Notification notificationThenLoader[Q] Organization organizationThenLoader[Q] Parcel parcelThenLoader[Q] - Pool poolThenLoader[Q] PublicreportImage publicreportImageThenLoader[Q] PublicreportImageExif publicreportImageExifThenLoader[Q] PublicreportNotifyEmailNuisance publicreportNotifyEmailNuisanceThenLoader[Q] @@ -285,8 +290,9 @@ type thenLoaders[Q orm.Loadable] struct { PublicreportSubscribeEmail publicreportSubscribeEmailThenLoader[Q] PublicreportSubscribePhone publicreportSubscribePhoneThenLoader[Q] Resident residentThenLoader[Q] + ReviewTask reviewTaskThenLoader[Q] + ReviewTaskPool reviewTaskPoolThenLoader[Q] Signal signalThenLoader[Q] - SignalPool signalPoolThenLoader[Q] Site siteThenLoader[Q] User userThenLoader[Q] } @@ -315,6 +321,8 @@ func getThenLoaders[Q orm.Loadable]() thenLoaders[Q] { ComplianceReportRequestMailer: buildComplianceReportRequestMailerThenLoader[Q](), DistrictSubscriptionEmail: buildDistrictSubscriptionEmailThenLoader[Q](), DistrictSubscriptionPhone: buildDistrictSubscriptionPhoneThenLoader[Q](), + Feature: buildFeatureThenLoader[Q](), + FeaturePool: buildFeaturePoolThenLoader[Q](), FieldseekerContainerrelate: buildFieldseekerContainerrelateThenLoader[Q](), FieldseekerFieldscoutinglog: buildFieldseekerFieldscoutinglogThenLoader[Q](), FieldseekerHabitatrelate: buildFieldseekerHabitatrelateThenLoader[Q](), @@ -359,7 +367,6 @@ func getThenLoaders[Q orm.Loadable]() thenLoaders[Q] { Notification: buildNotificationThenLoader[Q](), Organization: buildOrganizationThenLoader[Q](), Parcel: buildParcelThenLoader[Q](), - Pool: buildPoolThenLoader[Q](), PublicreportImage: buildPublicreportImageThenLoader[Q](), PublicreportImageExif: buildPublicreportImageExifThenLoader[Q](), PublicreportNotifyEmailNuisance: buildPublicreportNotifyEmailNuisanceThenLoader[Q](), @@ -375,8 +382,9 @@ func getThenLoaders[Q orm.Loadable]() thenLoaders[Q] { PublicreportSubscribeEmail: buildPublicreportSubscribeEmailThenLoader[Q](), PublicreportSubscribePhone: buildPublicreportSubscribePhoneThenLoader[Q](), Resident: buildResidentThenLoader[Q](), + ReviewTask: buildReviewTaskThenLoader[Q](), + ReviewTaskPool: buildReviewTaskPoolThenLoader[Q](), Signal: buildSignalThenLoader[Q](), - SignalPool: buildSignalPoolThenLoader[Q](), Site: buildSiteThenLoader[Q](), User: buildUserThenLoader[Q](), } diff --git a/db/models/bob_where.bob.go b/db/models/bob_where.bob.go index ee3a63bf..cc0b88b3 100644 --- a/db/models/bob_where.bob.go +++ b/db/models/bob_where.bob.go @@ -39,6 +39,8 @@ func Where[Q psql.Filterable]() struct { ComplianceReportRequestMailers complianceReportRequestMailerWhere[Q] DistrictSubscriptionEmails districtSubscriptionEmailWhere[Q] DistrictSubscriptionPhones districtSubscriptionPhoneWhere[Q] + Features featureWhere[Q] + FeaturePools featurePoolWhere[Q] FieldseekerContainerrelates fieldseekerContainerrelateWhere[Q] FieldseekerFieldscoutinglogs fieldseekerFieldscoutinglogWhere[Q] FieldseekerHabitatrelates fieldseekerHabitatrelateWhere[Q] @@ -86,7 +88,6 @@ func Where[Q psql.Filterable]() struct { Notifications notificationWhere[Q] Organizations organizationWhere[Q] Parcels parcelWhere[Q] - Pools poolWhere[Q] PublicreportImages publicreportImageWhere[Q] PublicreportImageExifs publicreportImageExifWhere[Q] PublicreportNotifyEmailNuisances publicreportNotifyEmailNuisanceWhere[Q] @@ -105,9 +106,10 @@ func Where[Q psql.Filterable]() struct { RasterColumns rasterColumnWhere[Q] RasterOverviews rasterOverviewWhere[Q] Residents residentWhere[Q] + ReviewTasks reviewTaskWhere[Q] + ReviewTaskPools reviewTaskPoolWhere[Q] Sessions sessionWhere[Q] Signals signalWhere[Q] - SignalPools signalPoolWhere[Q] Sites siteWhere[Q] SpatialRefSys spatialRefSyWhere[Q] Users userWhere[Q] @@ -135,6 +137,8 @@ func Where[Q psql.Filterable]() struct { ComplianceReportRequestMailers complianceReportRequestMailerWhere[Q] DistrictSubscriptionEmails districtSubscriptionEmailWhere[Q] DistrictSubscriptionPhones districtSubscriptionPhoneWhere[Q] + Features featureWhere[Q] + FeaturePools featurePoolWhere[Q] FieldseekerContainerrelates fieldseekerContainerrelateWhere[Q] FieldseekerFieldscoutinglogs fieldseekerFieldscoutinglogWhere[Q] FieldseekerHabitatrelates fieldseekerHabitatrelateWhere[Q] @@ -182,7 +186,6 @@ func Where[Q psql.Filterable]() struct { Notifications notificationWhere[Q] Organizations organizationWhere[Q] Parcels parcelWhere[Q] - Pools poolWhere[Q] PublicreportImages publicreportImageWhere[Q] PublicreportImageExifs publicreportImageExifWhere[Q] PublicreportNotifyEmailNuisances publicreportNotifyEmailNuisanceWhere[Q] @@ -201,9 +204,10 @@ func Where[Q psql.Filterable]() struct { RasterColumns rasterColumnWhere[Q] RasterOverviews rasterOverviewWhere[Q] Residents residentWhere[Q] + ReviewTasks reviewTaskWhere[Q] + ReviewTaskPools reviewTaskPoolWhere[Q] Sessions sessionWhere[Q] Signals signalWhere[Q] - SignalPools signalPoolWhere[Q] Sites siteWhere[Q] SpatialRefSys spatialRefSyWhere[Q] Users userWhere[Q] @@ -230,6 +234,8 @@ func Where[Q psql.Filterable]() struct { ComplianceReportRequestMailers: buildComplianceReportRequestMailerWhere[Q](ComplianceReportRequestMailers.Columns), DistrictSubscriptionEmails: buildDistrictSubscriptionEmailWhere[Q](DistrictSubscriptionEmails.Columns), DistrictSubscriptionPhones: buildDistrictSubscriptionPhoneWhere[Q](DistrictSubscriptionPhones.Columns), + Features: buildFeatureWhere[Q](Features.Columns), + FeaturePools: buildFeaturePoolWhere[Q](FeaturePools.Columns), FieldseekerContainerrelates: buildFieldseekerContainerrelateWhere[Q](FieldseekerContainerrelates.Columns), FieldseekerFieldscoutinglogs: buildFieldseekerFieldscoutinglogWhere[Q](FieldseekerFieldscoutinglogs.Columns), FieldseekerHabitatrelates: buildFieldseekerHabitatrelateWhere[Q](FieldseekerHabitatrelates.Columns), @@ -277,7 +283,6 @@ func Where[Q psql.Filterable]() struct { Notifications: buildNotificationWhere[Q](Notifications.Columns), Organizations: buildOrganizationWhere[Q](Organizations.Columns), Parcels: buildParcelWhere[Q](Parcels.Columns), - Pools: buildPoolWhere[Q](Pools.Columns), PublicreportImages: buildPublicreportImageWhere[Q](PublicreportImages.Columns), PublicreportImageExifs: buildPublicreportImageExifWhere[Q](PublicreportImageExifs.Columns), PublicreportNotifyEmailNuisances: buildPublicreportNotifyEmailNuisanceWhere[Q](PublicreportNotifyEmailNuisances.Columns), @@ -296,9 +301,10 @@ func Where[Q psql.Filterable]() struct { RasterColumns: buildRasterColumnWhere[Q](RasterColumns.Columns), RasterOverviews: buildRasterOverviewWhere[Q](RasterOverviews.Columns), Residents: buildResidentWhere[Q](Residents.Columns), + ReviewTasks: buildReviewTaskWhere[Q](ReviewTasks.Columns), + ReviewTaskPools: buildReviewTaskPoolWhere[Q](ReviewTaskPools.Columns), Sessions: buildSessionWhere[Q](Sessions.Columns), Signals: buildSignalWhere[Q](Signals.Columns), - SignalPools: buildSignalPoolWhere[Q](SignalPools.Columns), Sites: buildSiteWhere[Q](Sites.Columns), SpatialRefSys: buildSpatialRefSyWhere[Q](SpatialRefSys.Columns), Users: buildUserWhere[Q](Users.Columns), diff --git a/db/models/comms.email_contact.bob.go b/db/models/comms.email_contact.bob.go index 5d534c2a..44c76462 100644 --- a/db/models/comms.email_contact.bob.go +++ b/db/models/comms.email_contact.bob.go @@ -7,7 +7,6 @@ import ( "context" "fmt" "io" - "strconv" "github.com/Gleipnir-Technology/bob" "github.com/Gleipnir-Technology/bob/dialect/psql" @@ -16,7 +15,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/omit" @@ -31,8 +29,6 @@ type CommsEmailContact struct { PublicID string `db:"public_id" ` R commsEmailContactR `db:"-" ` - - C commsEmailContactC `db:"-" ` } // CommsEmailContactSlice is an alias for a slice of pointers to CommsEmailContact. @@ -1374,440 +1370,3 @@ func (os CommsEmailContactSlice) LoadEmailAddressSubscribeEmails(ctx context.Con return nil } - -// commsEmailContactC is where relationship counts are stored. -type commsEmailContactC struct { - DestinationEmailLogs *int64 - Organizations *int64 - EmailAddressNotifyEmailNuisances *int64 - EmailAddressNotifyEmailPools *int64 - EmailAddressSubscribeEmails *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *CommsEmailContact) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "DestinationEmailLogs": - o.C.DestinationEmailLogs = &count - case "Organizations": - o.C.Organizations = &count - case "EmailAddressNotifyEmailNuisances": - o.C.EmailAddressNotifyEmailNuisances = &count - case "EmailAddressNotifyEmailPools": - o.C.EmailAddressNotifyEmailPools = &count - case "EmailAddressSubscribeEmails": - o.C.EmailAddressSubscribeEmails = &count - } - return nil -} - -type commsEmailContactCountPreloader struct { - DestinationEmailLogs func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Organizations func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - EmailAddressNotifyEmailNuisances func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - EmailAddressNotifyEmailPools func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - EmailAddressSubscribeEmails func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildCommsEmailContactCountPreloader() commsEmailContactCountPreloader { - return commsEmailContactCountPreloader{ - DestinationEmailLogs: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*CommsEmailContact]("DestinationEmailLogs", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = CommsEmailContacts.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(CommsEmailLogs.Name()), - sm.Where(psql.Quote(CommsEmailLogs.Alias(), "destination").EQ(psql.Quote(parent, "address"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Organizations: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*CommsEmailContact]("Organizations", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = CommsEmailContacts.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(DistrictSubscriptionEmails.Name()), - sm.Where(psql.Quote(DistrictSubscriptionEmails.Alias(), "email_contact_address").EQ(psql.Quote(parent, "address"))), - sm.InnerJoin(Organizations.Name()).On( - psql.Quote(Organizations.Alias(), "id").EQ(psql.Quote(DistrictSubscriptionEmails.Alias(), "organization_id")), - ), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - EmailAddressNotifyEmailNuisances: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*CommsEmailContact]("EmailAddressNotifyEmailNuisances", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = CommsEmailContacts.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(PublicreportNotifyEmailNuisances.Name()), - sm.Where(psql.Quote(PublicreportNotifyEmailNuisances.Alias(), "email_address").EQ(psql.Quote(parent, "address"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - EmailAddressNotifyEmailPools: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*CommsEmailContact]("EmailAddressNotifyEmailPools", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = CommsEmailContacts.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(PublicreportNotifyEmailPools.Name()), - sm.Where(psql.Quote(PublicreportNotifyEmailPools.Alias(), "email_address").EQ(psql.Quote(parent, "address"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - EmailAddressSubscribeEmails: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*CommsEmailContact]("EmailAddressSubscribeEmails", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = CommsEmailContacts.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(PublicreportSubscribeEmails.Name()), - sm.Where(psql.Quote(PublicreportSubscribeEmails.Alias(), "email_address").EQ(psql.Quote(parent, "address"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type commsEmailContactCountThenLoader[Q orm.Loadable] struct { - DestinationEmailLogs func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - Organizations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - EmailAddressNotifyEmailNuisances func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - EmailAddressNotifyEmailPools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - EmailAddressSubscribeEmails func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildCommsEmailContactCountThenLoader[Q orm.Loadable]() commsEmailContactCountThenLoader[Q] { - type DestinationEmailLogsCountInterface interface { - LoadCountDestinationEmailLogs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type OrganizationsCountInterface interface { - LoadCountOrganizations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type EmailAddressNotifyEmailNuisancesCountInterface interface { - LoadCountEmailAddressNotifyEmailNuisances(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type EmailAddressNotifyEmailPoolsCountInterface interface { - LoadCountEmailAddressNotifyEmailPools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type EmailAddressSubscribeEmailsCountInterface interface { - LoadCountEmailAddressSubscribeEmails(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return commsEmailContactCountThenLoader[Q]{ - DestinationEmailLogs: countThenLoadBuilder[Q]( - "DestinationEmailLogs", - func(ctx context.Context, exec bob.Executor, retrieved DestinationEmailLogsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountDestinationEmailLogs(ctx, exec, mods...) - }, - ), - Organizations: countThenLoadBuilder[Q]( - "Organizations", - func(ctx context.Context, exec bob.Executor, retrieved OrganizationsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountOrganizations(ctx, exec, mods...) - }, - ), - EmailAddressNotifyEmailNuisances: countThenLoadBuilder[Q]( - "EmailAddressNotifyEmailNuisances", - func(ctx context.Context, exec bob.Executor, retrieved EmailAddressNotifyEmailNuisancesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountEmailAddressNotifyEmailNuisances(ctx, exec, mods...) - }, - ), - EmailAddressNotifyEmailPools: countThenLoadBuilder[Q]( - "EmailAddressNotifyEmailPools", - func(ctx context.Context, exec bob.Executor, retrieved EmailAddressNotifyEmailPoolsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountEmailAddressNotifyEmailPools(ctx, exec, mods...) - }, - ), - EmailAddressSubscribeEmails: countThenLoadBuilder[Q]( - "EmailAddressSubscribeEmails", - func(ctx context.Context, exec bob.Executor, retrieved EmailAddressSubscribeEmailsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountEmailAddressSubscribeEmails(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountDestinationEmailLogs loads the count of DestinationEmailLogs into the C struct -func (o *CommsEmailContact) LoadCountDestinationEmailLogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.DestinationEmailLogs(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.DestinationEmailLogs = &count - return nil -} - -// LoadCountDestinationEmailLogs loads the count of DestinationEmailLogs for a slice -func (os CommsEmailContactSlice) LoadCountDestinationEmailLogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountDestinationEmailLogs(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountOrganizations loads the count of Organizations into the C struct -func (o *CommsEmailContact) LoadCountOrganizations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Organizations(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Organizations = &count - return nil -} - -// LoadCountOrganizations loads the count of Organizations for a slice -func (os CommsEmailContactSlice) LoadCountOrganizations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountOrganizations(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountEmailAddressNotifyEmailNuisances loads the count of EmailAddressNotifyEmailNuisances into the C struct -func (o *CommsEmailContact) LoadCountEmailAddressNotifyEmailNuisances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.EmailAddressNotifyEmailNuisances(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.EmailAddressNotifyEmailNuisances = &count - return nil -} - -// LoadCountEmailAddressNotifyEmailNuisances loads the count of EmailAddressNotifyEmailNuisances for a slice -func (os CommsEmailContactSlice) LoadCountEmailAddressNotifyEmailNuisances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountEmailAddressNotifyEmailNuisances(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountEmailAddressNotifyEmailPools loads the count of EmailAddressNotifyEmailPools into the C struct -func (o *CommsEmailContact) LoadCountEmailAddressNotifyEmailPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.EmailAddressNotifyEmailPools(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.EmailAddressNotifyEmailPools = &count - return nil -} - -// LoadCountEmailAddressNotifyEmailPools loads the count of EmailAddressNotifyEmailPools for a slice -func (os CommsEmailContactSlice) LoadCountEmailAddressNotifyEmailPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountEmailAddressNotifyEmailPools(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountEmailAddressSubscribeEmails loads the count of EmailAddressSubscribeEmails into the C struct -func (o *CommsEmailContact) LoadCountEmailAddressSubscribeEmails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.EmailAddressSubscribeEmails(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.EmailAddressSubscribeEmails = &count - return nil -} - -// LoadCountEmailAddressSubscribeEmails loads the count of EmailAddressSubscribeEmails for a slice -func (os CommsEmailContactSlice) LoadCountEmailAddressSubscribeEmails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountEmailAddressSubscribeEmails(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type commsEmailContactJoins[Q dialect.Joinable] struct { - typ string - DestinationEmailLogs modAs[Q, commsEmailLogColumns] - Organizations modAs[Q, organizationColumns] - EmailAddressNotifyEmailNuisances modAs[Q, publicreportNotifyEmailNuisanceColumns] - EmailAddressNotifyEmailPools modAs[Q, publicreportNotifyEmailPoolColumns] - EmailAddressSubscribeEmails modAs[Q, publicreportSubscribeEmailColumns] -} - -func (j commsEmailContactJoins[Q]) aliasedAs(alias string) commsEmailContactJoins[Q] { - return buildCommsEmailContactJoins[Q](buildCommsEmailContactColumns(alias), j.typ) -} - -func buildCommsEmailContactJoins[Q dialect.Joinable](cols commsEmailContactColumns, typ string) commsEmailContactJoins[Q] { - return commsEmailContactJoins[Q]{ - typ: typ, - DestinationEmailLogs: modAs[Q, commsEmailLogColumns]{ - c: CommsEmailLogs.Columns, - f: func(to commsEmailLogColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsEmailLogs.Name().As(to.Alias())).On( - to.Destination.EQ(cols.Address), - )) - } - - return mods - }, - }, - Organizations: modAs[Q, organizationColumns]{ - c: Organizations.Columns, - f: func(to organizationColumns) bob.Mod[Q] { - random := strconv.FormatInt(randInt(), 10) - mods := make(mods.QueryMods[Q], 0, 2) - - { - to := DistrictSubscriptionEmails.Columns.AliasedAs(DistrictSubscriptionEmails.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, DistrictSubscriptionEmails.Name().As(to.Alias())).On( - to.EmailContactAddress.EQ(cols.Address), - )) - } - { - cols := DistrictSubscriptionEmails.Columns.AliasedAs(DistrictSubscriptionEmails.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, Organizations.Name().As(to.Alias())).On( - to.ID.EQ(cols.OrganizationID), - )) - } - - return mods - }, - }, - EmailAddressNotifyEmailNuisances: modAs[Q, publicreportNotifyEmailNuisanceColumns]{ - c: PublicreportNotifyEmailNuisances.Columns, - f: func(to publicreportNotifyEmailNuisanceColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportNotifyEmailNuisances.Name().As(to.Alias())).On( - to.EmailAddress.EQ(cols.Address), - )) - } - - return mods - }, - }, - EmailAddressNotifyEmailPools: modAs[Q, publicreportNotifyEmailPoolColumns]{ - c: PublicreportNotifyEmailPools.Columns, - f: func(to publicreportNotifyEmailPoolColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportNotifyEmailPools.Name().As(to.Alias())).On( - to.EmailAddress.EQ(cols.Address), - )) - } - - return mods - }, - }, - EmailAddressSubscribeEmails: modAs[Q, publicreportSubscribeEmailColumns]{ - c: PublicreportSubscribeEmails.Columns, - f: func(to publicreportSubscribeEmailColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportSubscribeEmails.Name().As(to.Alias())).On( - to.EmailAddress.EQ(cols.Address), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/comms.email_log.bob.go b/db/models/comms.email_log.bob.go index 6c39c8cd..7b225d33 100644 --- a/db/models/comms.email_log.bob.go +++ b/db/models/comms.email_log.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -961,47 +960,3 @@ func (os CommsEmailLogSlice) LoadTemplateEmailTemplate(ctx context.Context, exec return nil } - -type commsEmailLogJoins[Q dialect.Joinable] struct { - typ string - DestinationEmailContact modAs[Q, commsEmailContactColumns] - TemplateEmailTemplate modAs[Q, commsEmailTemplateColumns] -} - -func (j commsEmailLogJoins[Q]) aliasedAs(alias string) commsEmailLogJoins[Q] { - return buildCommsEmailLogJoins[Q](buildCommsEmailLogColumns(alias), j.typ) -} - -func buildCommsEmailLogJoins[Q dialect.Joinable](cols commsEmailLogColumns, typ string) commsEmailLogJoins[Q] { - return commsEmailLogJoins[Q]{ - typ: typ, - DestinationEmailContact: modAs[Q, commsEmailContactColumns]{ - c: CommsEmailContacts.Columns, - f: func(to commsEmailContactColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsEmailContacts.Name().As(to.Alias())).On( - to.Address.EQ(cols.Destination), - )) - } - - return mods - }, - }, - TemplateEmailTemplate: modAs[Q, commsEmailTemplateColumns]{ - c: CommsEmailTemplates.Columns, - f: func(to commsEmailTemplateColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsEmailTemplates.Name().As(to.Alias())).On( - to.ID.EQ(cols.TemplateID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/comms.email_template.bob.go b/db/models/comms.email_template.bob.go index 83471826..e3973aac 100644 --- a/db/models/comms.email_template.bob.go +++ b/db/models/comms.email_template.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -37,8 +36,6 @@ type CommsEmailTemplate struct { MessageType enums.CommsMessagetypeemail `db:"message_type" ` R commsEmailTemplateR `db:"-" ` - - C commsEmailTemplateC `db:"-" ` } // CommsEmailTemplateSlice is an alias for a slice of pointers to CommsEmailTemplate. @@ -742,125 +739,3 @@ func (os CommsEmailTemplateSlice) LoadTemplateEmailLogs(ctx context.Context, exe return nil } - -// commsEmailTemplateC is where relationship counts are stored. -type commsEmailTemplateC struct { - TemplateEmailLogs *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *CommsEmailTemplate) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "TemplateEmailLogs": - o.C.TemplateEmailLogs = &count - } - return nil -} - -type commsEmailTemplateCountPreloader struct { - TemplateEmailLogs func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildCommsEmailTemplateCountPreloader() commsEmailTemplateCountPreloader { - return commsEmailTemplateCountPreloader{ - TemplateEmailLogs: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*CommsEmailTemplate]("TemplateEmailLogs", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = CommsEmailTemplates.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(CommsEmailLogs.Name()), - sm.Where(psql.Quote(CommsEmailLogs.Alias(), "template_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type commsEmailTemplateCountThenLoader[Q orm.Loadable] struct { - TemplateEmailLogs func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildCommsEmailTemplateCountThenLoader[Q orm.Loadable]() commsEmailTemplateCountThenLoader[Q] { - type TemplateEmailLogsCountInterface interface { - LoadCountTemplateEmailLogs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return commsEmailTemplateCountThenLoader[Q]{ - TemplateEmailLogs: countThenLoadBuilder[Q]( - "TemplateEmailLogs", - func(ctx context.Context, exec bob.Executor, retrieved TemplateEmailLogsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountTemplateEmailLogs(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountTemplateEmailLogs loads the count of TemplateEmailLogs into the C struct -func (o *CommsEmailTemplate) LoadCountTemplateEmailLogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.TemplateEmailLogs(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.TemplateEmailLogs = &count - return nil -} - -// LoadCountTemplateEmailLogs loads the count of TemplateEmailLogs for a slice -func (os CommsEmailTemplateSlice) LoadCountTemplateEmailLogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountTemplateEmailLogs(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type commsEmailTemplateJoins[Q dialect.Joinable] struct { - typ string - TemplateEmailLogs modAs[Q, commsEmailLogColumns] -} - -func (j commsEmailTemplateJoins[Q]) aliasedAs(alias string) commsEmailTemplateJoins[Q] { - return buildCommsEmailTemplateJoins[Q](buildCommsEmailTemplateColumns(alias), j.typ) -} - -func buildCommsEmailTemplateJoins[Q dialect.Joinable](cols commsEmailTemplateColumns, typ string) commsEmailTemplateJoins[Q] { - return commsEmailTemplateJoins[Q]{ - typ: typ, - TemplateEmailLogs: modAs[Q, commsEmailLogColumns]{ - c: CommsEmailLogs.Columns, - f: func(to commsEmailLogColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsEmailLogs.Name().As(to.Alias())).On( - to.TemplateID.EQ(cols.ID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/comms.mailer.bob.go b/db/models/comms.mailer.bob.go index 0082f795..c6ee6262 100644 --- a/db/models/comms.mailer.bob.go +++ b/db/models/comms.mailer.bob.go @@ -7,7 +7,6 @@ import ( "context" "fmt" "io" - "strconv" "time" "github.com/Gleipnir-Technology/bob" @@ -17,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/omit" @@ -34,8 +32,6 @@ type CommsMailer struct { UUID uuid.UUID `db:"uuid" ` R commsMailerR `db:"-" ` - - C commsMailerC `db:"-" ` } // CommsMailerSlice is an alias for a slice of pointers to CommsMailer. @@ -787,151 +783,3 @@ func (os CommsMailerSlice) LoadComplianceReportRequests(ctx context.Context, exe return nil } - -// commsMailerC is where relationship counts are stored. -type commsMailerC struct { - ComplianceReportRequests *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *CommsMailer) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "ComplianceReportRequests": - o.C.ComplianceReportRequests = &count - } - return nil -} - -type commsMailerCountPreloader struct { - ComplianceReportRequests func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildCommsMailerCountPreloader() commsMailerCountPreloader { - return commsMailerCountPreloader{ - ComplianceReportRequests: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*CommsMailer]("ComplianceReportRequests", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = CommsMailers.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(ComplianceReportRequestMailers.Name()), - sm.Where(psql.Quote(ComplianceReportRequestMailers.Alias(), "mailer_id").EQ(psql.Quote(parent, "id"))), - sm.InnerJoin(ComplianceReportRequests.Name()).On( - psql.Quote(ComplianceReportRequests.Alias(), "id").EQ(psql.Quote(ComplianceReportRequestMailers.Alias(), "compliance_report_request_id")), - ), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type commsMailerCountThenLoader[Q orm.Loadable] struct { - ComplianceReportRequests func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildCommsMailerCountThenLoader[Q orm.Loadable]() commsMailerCountThenLoader[Q] { - type ComplianceReportRequestsCountInterface interface { - LoadCountComplianceReportRequests(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return commsMailerCountThenLoader[Q]{ - ComplianceReportRequests: countThenLoadBuilder[Q]( - "ComplianceReportRequests", - func(ctx context.Context, exec bob.Executor, retrieved ComplianceReportRequestsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountComplianceReportRequests(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountComplianceReportRequests loads the count of ComplianceReportRequests into the C struct -func (o *CommsMailer) LoadCountComplianceReportRequests(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.ComplianceReportRequests(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.ComplianceReportRequests = &count - return nil -} - -// LoadCountComplianceReportRequests loads the count of ComplianceReportRequests for a slice -func (os CommsMailerSlice) LoadCountComplianceReportRequests(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountComplianceReportRequests(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type commsMailerJoins[Q dialect.Joinable] struct { - typ string - Address modAs[Q, addressColumns] - ComplianceReportRequests modAs[Q, complianceReportRequestColumns] -} - -func (j commsMailerJoins[Q]) aliasedAs(alias string) commsMailerJoins[Q] { - return buildCommsMailerJoins[Q](buildCommsMailerColumns(alias), j.typ) -} - -func buildCommsMailerJoins[Q dialect.Joinable](cols commsMailerColumns, typ string) commsMailerJoins[Q] { - return commsMailerJoins[Q]{ - typ: typ, - Address: modAs[Q, addressColumns]{ - c: Addresses.Columns, - f: func(to addressColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Addresses.Name().As(to.Alias())).On( - to.ID.EQ(cols.AddressID), - )) - } - - return mods - }, - }, - ComplianceReportRequests: modAs[Q, complianceReportRequestColumns]{ - c: ComplianceReportRequests.Columns, - f: func(to complianceReportRequestColumns) bob.Mod[Q] { - random := strconv.FormatInt(randInt(), 10) - mods := make(mods.QueryMods[Q], 0, 2) - - { - to := ComplianceReportRequestMailers.Columns.AliasedAs(ComplianceReportRequestMailers.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, ComplianceReportRequestMailers.Name().As(to.Alias())).On( - to.MailerID.EQ(cols.ID), - )) - } - { - cols := ComplianceReportRequestMailers.Columns.AliasedAs(ComplianceReportRequestMailers.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, ComplianceReportRequests.Name().As(to.Alias())).On( - to.ID.EQ(cols.ComplianceReportRequestID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/comms.phone.bob.go b/db/models/comms.phone.bob.go index 97aaacdd..073f4f9c 100644 --- a/db/models/comms.phone.bob.go +++ b/db/models/comms.phone.bob.go @@ -7,7 +7,6 @@ import ( "context" "fmt" "io" - "strconv" "github.com/Gleipnir-Technology/bob" "github.com/Gleipnir-Technology/bob/dialect/psql" @@ -16,7 +15,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -32,8 +30,6 @@ type CommsPhone struct { Status enums.CommsPhonestatustype `db:"status" ` R commsPhoneR `db:"-" ` - - C commsPhoneC `db:"-" ` } // CommsPhoneSlice is an alias for a slice of pointers to CommsPhone. @@ -2250,820 +2246,3 @@ func (os CommsPhoneSlice) LoadPhoneMobileResidents(ctx context.Context, exec bob return nil } - -// commsPhoneC is where relationship counts are stored. -type commsPhoneC struct { - DestinationTextJobs *int64 - DestinationTextLogs *int64 - SourceTextLogs *int64 - Organizations *int64 - PropertyOwnerPhoneE164Pools *int64 - ResidentPhoneE164Pools *int64 - PhoneE164NotifyPhoneNuisances *int64 - PhoneE164NotifyPhonePools *int64 - PhoneE164SubscribePhones *int64 - PhoneMobileResidents *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *CommsPhone) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "DestinationTextJobs": - o.C.DestinationTextJobs = &count - case "DestinationTextLogs": - o.C.DestinationTextLogs = &count - case "SourceTextLogs": - o.C.SourceTextLogs = &count - case "Organizations": - o.C.Organizations = &count - case "PropertyOwnerPhoneE164Pools": - o.C.PropertyOwnerPhoneE164Pools = &count - case "ResidentPhoneE164Pools": - o.C.ResidentPhoneE164Pools = &count - case "PhoneE164NotifyPhoneNuisances": - o.C.PhoneE164NotifyPhoneNuisances = &count - case "PhoneE164NotifyPhonePools": - o.C.PhoneE164NotifyPhonePools = &count - case "PhoneE164SubscribePhones": - o.C.PhoneE164SubscribePhones = &count - case "PhoneMobileResidents": - o.C.PhoneMobileResidents = &count - } - return nil -} - -type commsPhoneCountPreloader struct { - DestinationTextJobs func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - DestinationTextLogs func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - SourceTextLogs func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Organizations func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - PropertyOwnerPhoneE164Pools func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - ResidentPhoneE164Pools func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - PhoneE164NotifyPhoneNuisances func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - PhoneE164NotifyPhonePools func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - PhoneE164SubscribePhones func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - PhoneMobileResidents func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildCommsPhoneCountPreloader() commsPhoneCountPreloader { - return commsPhoneCountPreloader{ - DestinationTextJobs: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*CommsPhone]("DestinationTextJobs", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = CommsPhones.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(CommsTextJobs.Name()), - sm.Where(psql.Quote(CommsTextJobs.Alias(), "destination").EQ(psql.Quote(parent, "e164"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - DestinationTextLogs: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*CommsPhone]("DestinationTextLogs", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = CommsPhones.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(CommsTextLogs.Name()), - sm.Where(psql.Quote(CommsTextLogs.Alias(), "destination").EQ(psql.Quote(parent, "e164"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - SourceTextLogs: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*CommsPhone]("SourceTextLogs", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = CommsPhones.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(CommsTextLogs.Name()), - sm.Where(psql.Quote(CommsTextLogs.Alias(), "source").EQ(psql.Quote(parent, "e164"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Organizations: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*CommsPhone]("Organizations", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = CommsPhones.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(DistrictSubscriptionPhones.Name()), - sm.Where(psql.Quote(DistrictSubscriptionPhones.Alias(), "phone_e164").EQ(psql.Quote(parent, "e164"))), - sm.InnerJoin(Organizations.Name()).On( - psql.Quote(Organizations.Alias(), "id").EQ(psql.Quote(DistrictSubscriptionPhones.Alias(), "organization_id")), - ), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - PropertyOwnerPhoneE164Pools: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*CommsPhone]("PropertyOwnerPhoneE164Pools", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = CommsPhones.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FileuploadPools.Name()), - sm.Where(psql.Quote(FileuploadPools.Alias(), "property_owner_phone_e164").EQ(psql.Quote(parent, "e164"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - ResidentPhoneE164Pools: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*CommsPhone]("ResidentPhoneE164Pools", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = CommsPhones.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FileuploadPools.Name()), - sm.Where(psql.Quote(FileuploadPools.Alias(), "resident_phone_e164").EQ(psql.Quote(parent, "e164"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - PhoneE164NotifyPhoneNuisances: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*CommsPhone]("PhoneE164NotifyPhoneNuisances", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = CommsPhones.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(PublicreportNotifyPhoneNuisances.Name()), - sm.Where(psql.Quote(PublicreportNotifyPhoneNuisances.Alias(), "phone_e164").EQ(psql.Quote(parent, "e164"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - PhoneE164NotifyPhonePools: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*CommsPhone]("PhoneE164NotifyPhonePools", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = CommsPhones.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(PublicreportNotifyPhonePools.Name()), - sm.Where(psql.Quote(PublicreportNotifyPhonePools.Alias(), "phone_e164").EQ(psql.Quote(parent, "e164"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - PhoneE164SubscribePhones: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*CommsPhone]("PhoneE164SubscribePhones", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = CommsPhones.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(PublicreportSubscribePhones.Name()), - sm.Where(psql.Quote(PublicreportSubscribePhones.Alias(), "phone_e164").EQ(psql.Quote(parent, "e164"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - PhoneMobileResidents: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*CommsPhone]("PhoneMobileResidents", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = CommsPhones.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(Residents.Name()), - sm.Where(psql.Quote(Residents.Alias(), "phone_mobile").EQ(psql.Quote(parent, "e164"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type commsPhoneCountThenLoader[Q orm.Loadable] struct { - DestinationTextJobs func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - DestinationTextLogs func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - SourceTextLogs func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - Organizations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - PropertyOwnerPhoneE164Pools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - ResidentPhoneE164Pools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - PhoneE164NotifyPhoneNuisances func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - PhoneE164NotifyPhonePools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - PhoneE164SubscribePhones func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - PhoneMobileResidents func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildCommsPhoneCountThenLoader[Q orm.Loadable]() commsPhoneCountThenLoader[Q] { - type DestinationTextJobsCountInterface interface { - LoadCountDestinationTextJobs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type DestinationTextLogsCountInterface interface { - LoadCountDestinationTextLogs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type SourceTextLogsCountInterface interface { - LoadCountSourceTextLogs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type OrganizationsCountInterface interface { - LoadCountOrganizations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type PropertyOwnerPhoneE164PoolsCountInterface interface { - LoadCountPropertyOwnerPhoneE164Pools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type ResidentPhoneE164PoolsCountInterface interface { - LoadCountResidentPhoneE164Pools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type PhoneE164NotifyPhoneNuisancesCountInterface interface { - LoadCountPhoneE164NotifyPhoneNuisances(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type PhoneE164NotifyPhonePoolsCountInterface interface { - LoadCountPhoneE164NotifyPhonePools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type PhoneE164SubscribePhonesCountInterface interface { - LoadCountPhoneE164SubscribePhones(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type PhoneMobileResidentsCountInterface interface { - LoadCountPhoneMobileResidents(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return commsPhoneCountThenLoader[Q]{ - DestinationTextJobs: countThenLoadBuilder[Q]( - "DestinationTextJobs", - func(ctx context.Context, exec bob.Executor, retrieved DestinationTextJobsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountDestinationTextJobs(ctx, exec, mods...) - }, - ), - DestinationTextLogs: countThenLoadBuilder[Q]( - "DestinationTextLogs", - func(ctx context.Context, exec bob.Executor, retrieved DestinationTextLogsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountDestinationTextLogs(ctx, exec, mods...) - }, - ), - SourceTextLogs: countThenLoadBuilder[Q]( - "SourceTextLogs", - func(ctx context.Context, exec bob.Executor, retrieved SourceTextLogsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountSourceTextLogs(ctx, exec, mods...) - }, - ), - Organizations: countThenLoadBuilder[Q]( - "Organizations", - func(ctx context.Context, exec bob.Executor, retrieved OrganizationsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountOrganizations(ctx, exec, mods...) - }, - ), - PropertyOwnerPhoneE164Pools: countThenLoadBuilder[Q]( - "PropertyOwnerPhoneE164Pools", - func(ctx context.Context, exec bob.Executor, retrieved PropertyOwnerPhoneE164PoolsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountPropertyOwnerPhoneE164Pools(ctx, exec, mods...) - }, - ), - ResidentPhoneE164Pools: countThenLoadBuilder[Q]( - "ResidentPhoneE164Pools", - func(ctx context.Context, exec bob.Executor, retrieved ResidentPhoneE164PoolsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountResidentPhoneE164Pools(ctx, exec, mods...) - }, - ), - PhoneE164NotifyPhoneNuisances: countThenLoadBuilder[Q]( - "PhoneE164NotifyPhoneNuisances", - func(ctx context.Context, exec bob.Executor, retrieved PhoneE164NotifyPhoneNuisancesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountPhoneE164NotifyPhoneNuisances(ctx, exec, mods...) - }, - ), - PhoneE164NotifyPhonePools: countThenLoadBuilder[Q]( - "PhoneE164NotifyPhonePools", - func(ctx context.Context, exec bob.Executor, retrieved PhoneE164NotifyPhonePoolsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountPhoneE164NotifyPhonePools(ctx, exec, mods...) - }, - ), - PhoneE164SubscribePhones: countThenLoadBuilder[Q]( - "PhoneE164SubscribePhones", - func(ctx context.Context, exec bob.Executor, retrieved PhoneE164SubscribePhonesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountPhoneE164SubscribePhones(ctx, exec, mods...) - }, - ), - PhoneMobileResidents: countThenLoadBuilder[Q]( - "PhoneMobileResidents", - func(ctx context.Context, exec bob.Executor, retrieved PhoneMobileResidentsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountPhoneMobileResidents(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountDestinationTextJobs loads the count of DestinationTextJobs into the C struct -func (o *CommsPhone) LoadCountDestinationTextJobs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.DestinationTextJobs(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.DestinationTextJobs = &count - return nil -} - -// LoadCountDestinationTextJobs loads the count of DestinationTextJobs for a slice -func (os CommsPhoneSlice) LoadCountDestinationTextJobs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountDestinationTextJobs(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountDestinationTextLogs loads the count of DestinationTextLogs into the C struct -func (o *CommsPhone) LoadCountDestinationTextLogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.DestinationTextLogs(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.DestinationTextLogs = &count - return nil -} - -// LoadCountDestinationTextLogs loads the count of DestinationTextLogs for a slice -func (os CommsPhoneSlice) LoadCountDestinationTextLogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountDestinationTextLogs(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountSourceTextLogs loads the count of SourceTextLogs into the C struct -func (o *CommsPhone) LoadCountSourceTextLogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.SourceTextLogs(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.SourceTextLogs = &count - return nil -} - -// LoadCountSourceTextLogs loads the count of SourceTextLogs for a slice -func (os CommsPhoneSlice) LoadCountSourceTextLogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountSourceTextLogs(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountOrganizations loads the count of Organizations into the C struct -func (o *CommsPhone) LoadCountOrganizations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Organizations(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Organizations = &count - return nil -} - -// LoadCountOrganizations loads the count of Organizations for a slice -func (os CommsPhoneSlice) LoadCountOrganizations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountOrganizations(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountPropertyOwnerPhoneE164Pools loads the count of PropertyOwnerPhoneE164Pools into the C struct -func (o *CommsPhone) LoadCountPropertyOwnerPhoneE164Pools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.PropertyOwnerPhoneE164Pools(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.PropertyOwnerPhoneE164Pools = &count - return nil -} - -// LoadCountPropertyOwnerPhoneE164Pools loads the count of PropertyOwnerPhoneE164Pools for a slice -func (os CommsPhoneSlice) LoadCountPropertyOwnerPhoneE164Pools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountPropertyOwnerPhoneE164Pools(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountResidentPhoneE164Pools loads the count of ResidentPhoneE164Pools into the C struct -func (o *CommsPhone) LoadCountResidentPhoneE164Pools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.ResidentPhoneE164Pools(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.ResidentPhoneE164Pools = &count - return nil -} - -// LoadCountResidentPhoneE164Pools loads the count of ResidentPhoneE164Pools for a slice -func (os CommsPhoneSlice) LoadCountResidentPhoneE164Pools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountResidentPhoneE164Pools(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountPhoneE164NotifyPhoneNuisances loads the count of PhoneE164NotifyPhoneNuisances into the C struct -func (o *CommsPhone) LoadCountPhoneE164NotifyPhoneNuisances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.PhoneE164NotifyPhoneNuisances(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.PhoneE164NotifyPhoneNuisances = &count - return nil -} - -// LoadCountPhoneE164NotifyPhoneNuisances loads the count of PhoneE164NotifyPhoneNuisances for a slice -func (os CommsPhoneSlice) LoadCountPhoneE164NotifyPhoneNuisances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountPhoneE164NotifyPhoneNuisances(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountPhoneE164NotifyPhonePools loads the count of PhoneE164NotifyPhonePools into the C struct -func (o *CommsPhone) LoadCountPhoneE164NotifyPhonePools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.PhoneE164NotifyPhonePools(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.PhoneE164NotifyPhonePools = &count - return nil -} - -// LoadCountPhoneE164NotifyPhonePools loads the count of PhoneE164NotifyPhonePools for a slice -func (os CommsPhoneSlice) LoadCountPhoneE164NotifyPhonePools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountPhoneE164NotifyPhonePools(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountPhoneE164SubscribePhones loads the count of PhoneE164SubscribePhones into the C struct -func (o *CommsPhone) LoadCountPhoneE164SubscribePhones(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.PhoneE164SubscribePhones(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.PhoneE164SubscribePhones = &count - return nil -} - -// LoadCountPhoneE164SubscribePhones loads the count of PhoneE164SubscribePhones for a slice -func (os CommsPhoneSlice) LoadCountPhoneE164SubscribePhones(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountPhoneE164SubscribePhones(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountPhoneMobileResidents loads the count of PhoneMobileResidents into the C struct -func (o *CommsPhone) LoadCountPhoneMobileResidents(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.PhoneMobileResidents(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.PhoneMobileResidents = &count - return nil -} - -// LoadCountPhoneMobileResidents loads the count of PhoneMobileResidents for a slice -func (os CommsPhoneSlice) LoadCountPhoneMobileResidents(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountPhoneMobileResidents(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type commsPhoneJoins[Q dialect.Joinable] struct { - typ string - DestinationTextJobs modAs[Q, commsTextJobColumns] - DestinationTextLogs modAs[Q, commsTextLogColumns] - SourceTextLogs modAs[Q, commsTextLogColumns] - Organizations modAs[Q, organizationColumns] - PropertyOwnerPhoneE164Pools modAs[Q, fileuploadPoolColumns] - ResidentPhoneE164Pools modAs[Q, fileuploadPoolColumns] - PhoneE164NotifyPhoneNuisances modAs[Q, publicreportNotifyPhoneNuisanceColumns] - PhoneE164NotifyPhonePools modAs[Q, publicreportNotifyPhonePoolColumns] - PhoneE164SubscribePhones modAs[Q, publicreportSubscribePhoneColumns] - PhoneMobileResidents modAs[Q, residentColumns] -} - -func (j commsPhoneJoins[Q]) aliasedAs(alias string) commsPhoneJoins[Q] { - return buildCommsPhoneJoins[Q](buildCommsPhoneColumns(alias), j.typ) -} - -func buildCommsPhoneJoins[Q dialect.Joinable](cols commsPhoneColumns, typ string) commsPhoneJoins[Q] { - return commsPhoneJoins[Q]{ - typ: typ, - DestinationTextJobs: modAs[Q, commsTextJobColumns]{ - c: CommsTextJobs.Columns, - f: func(to commsTextJobColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsTextJobs.Name().As(to.Alias())).On( - to.Destination.EQ(cols.E164), - )) - } - - return mods - }, - }, - DestinationTextLogs: modAs[Q, commsTextLogColumns]{ - c: CommsTextLogs.Columns, - f: func(to commsTextLogColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsTextLogs.Name().As(to.Alias())).On( - to.Destination.EQ(cols.E164), - )) - } - - return mods - }, - }, - SourceTextLogs: modAs[Q, commsTextLogColumns]{ - c: CommsTextLogs.Columns, - f: func(to commsTextLogColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsTextLogs.Name().As(to.Alias())).On( - to.Source.EQ(cols.E164), - )) - } - - return mods - }, - }, - Organizations: modAs[Q, organizationColumns]{ - c: Organizations.Columns, - f: func(to organizationColumns) bob.Mod[Q] { - random := strconv.FormatInt(randInt(), 10) - mods := make(mods.QueryMods[Q], 0, 2) - - { - to := DistrictSubscriptionPhones.Columns.AliasedAs(DistrictSubscriptionPhones.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, DistrictSubscriptionPhones.Name().As(to.Alias())).On( - to.PhoneE164.EQ(cols.E164), - )) - } - { - cols := DistrictSubscriptionPhones.Columns.AliasedAs(DistrictSubscriptionPhones.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, Organizations.Name().As(to.Alias())).On( - to.ID.EQ(cols.OrganizationID), - )) - } - - return mods - }, - }, - PropertyOwnerPhoneE164Pools: modAs[Q, fileuploadPoolColumns]{ - c: FileuploadPools.Columns, - f: func(to fileuploadPoolColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FileuploadPools.Name().As(to.Alias())).On( - to.PropertyOwnerPhoneE164.EQ(cols.E164), - )) - } - - return mods - }, - }, - ResidentPhoneE164Pools: modAs[Q, fileuploadPoolColumns]{ - c: FileuploadPools.Columns, - f: func(to fileuploadPoolColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FileuploadPools.Name().As(to.Alias())).On( - to.ResidentPhoneE164.EQ(cols.E164), - )) - } - - return mods - }, - }, - PhoneE164NotifyPhoneNuisances: modAs[Q, publicreportNotifyPhoneNuisanceColumns]{ - c: PublicreportNotifyPhoneNuisances.Columns, - f: func(to publicreportNotifyPhoneNuisanceColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportNotifyPhoneNuisances.Name().As(to.Alias())).On( - to.PhoneE164.EQ(cols.E164), - )) - } - - return mods - }, - }, - PhoneE164NotifyPhonePools: modAs[Q, publicreportNotifyPhonePoolColumns]{ - c: PublicreportNotifyPhonePools.Columns, - f: func(to publicreportNotifyPhonePoolColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportNotifyPhonePools.Name().As(to.Alias())).On( - to.PhoneE164.EQ(cols.E164), - )) - } - - return mods - }, - }, - PhoneE164SubscribePhones: modAs[Q, publicreportSubscribePhoneColumns]{ - c: PublicreportSubscribePhones.Columns, - f: func(to publicreportSubscribePhoneColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportSubscribePhones.Name().As(to.Alias())).On( - to.PhoneE164.EQ(cols.E164), - )) - } - - return mods - }, - }, - PhoneMobileResidents: modAs[Q, residentColumns]{ - c: Residents.Columns, - f: func(to residentColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Residents.Name().As(to.Alias())).On( - to.PhoneMobile.EQ(cols.E164), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/comms.text_job.bob.go b/db/models/comms.text_job.bob.go index f5532b15..ff59c48e 100644 --- a/db/models/comms.text_job.bob.go +++ b/db/models/comms.text_job.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -700,32 +699,3 @@ func (os CommsTextJobSlice) LoadDestinationPhone(ctx context.Context, exec bob.E return nil } - -type commsTextJobJoins[Q dialect.Joinable] struct { - typ string - DestinationPhone modAs[Q, commsPhoneColumns] -} - -func (j commsTextJobJoins[Q]) aliasedAs(alias string) commsTextJobJoins[Q] { - return buildCommsTextJobJoins[Q](buildCommsTextJobColumns(alias), j.typ) -} - -func buildCommsTextJobJoins[Q dialect.Joinable](cols commsTextJobColumns, typ string) commsTextJobJoins[Q] { - return commsTextJobJoins[Q]{ - typ: typ, - DestinationPhone: modAs[Q, commsPhoneColumns]{ - c: CommsPhones.Columns, - f: func(to commsPhoneColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsPhones.Name().As(to.Alias())).On( - to.E164.EQ(cols.Destination), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/comms.text_log.bob.go b/db/models/comms.text_log.bob.go index 33c31b19..5669f5b8 100644 --- a/db/models/comms.text_log.bob.go +++ b/db/models/comms.text_log.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -936,47 +935,3 @@ func (os CommsTextLogSlice) LoadSourcePhone(ctx context.Context, exec bob.Execut return nil } - -type commsTextLogJoins[Q dialect.Joinable] struct { - typ string - DestinationPhone modAs[Q, commsPhoneColumns] - SourcePhone modAs[Q, commsPhoneColumns] -} - -func (j commsTextLogJoins[Q]) aliasedAs(alias string) commsTextLogJoins[Q] { - return buildCommsTextLogJoins[Q](buildCommsTextLogColumns(alias), j.typ) -} - -func buildCommsTextLogJoins[Q dialect.Joinable](cols commsTextLogColumns, typ string) commsTextLogJoins[Q] { - return commsTextLogJoins[Q]{ - typ: typ, - DestinationPhone: modAs[Q, commsPhoneColumns]{ - c: CommsPhones.Columns, - f: func(to commsPhoneColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsPhones.Name().As(to.Alias())).On( - to.E164.EQ(cols.Destination), - )) - } - - return mods - }, - }, - SourcePhone: modAs[Q, commsPhoneColumns]{ - c: CommsPhones.Columns, - f: func(to commsPhoneColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsPhones.Name().As(to.Alias())).On( - to.E164.EQ(cols.Source), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/compliance_report_request.bob.go b/db/models/compliance_report_request.bob.go index 9c319da7..c3351560 100644 --- a/db/models/compliance_report_request.bob.go +++ b/db/models/compliance_report_request.bob.go @@ -7,7 +7,6 @@ import ( "context" "fmt" "io" - "strconv" "time" "github.com/Gleipnir-Technology/bob" @@ -17,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/null" @@ -35,8 +33,6 @@ type ComplianceReportRequest struct { LeadID null.Val[int32] `db:"lead_id" ` R complianceReportRequestR `db:"-" ` - - C complianceReportRequestC `db:"-" ` } // ComplianceReportRequestSlice is an alias for a slice of pointers to ComplianceReportRequest. @@ -952,166 +948,3 @@ func (os ComplianceReportRequestSlice) LoadMailers(ctx context.Context, exec bob return nil } - -// complianceReportRequestC is where relationship counts are stored. -type complianceReportRequestC struct { - Mailers *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *ComplianceReportRequest) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "Mailers": - o.C.Mailers = &count - } - return nil -} - -type complianceReportRequestCountPreloader struct { - Mailers func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildComplianceReportRequestCountPreloader() complianceReportRequestCountPreloader { - return complianceReportRequestCountPreloader{ - Mailers: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*ComplianceReportRequest]("Mailers", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = ComplianceReportRequests.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(ComplianceReportRequestMailers.Name()), - sm.Where(psql.Quote(ComplianceReportRequestMailers.Alias(), "compliance_report_request_id").EQ(psql.Quote(parent, "id"))), - sm.InnerJoin(CommsMailers.Name()).On( - psql.Quote(CommsMailers.Alias(), "id").EQ(psql.Quote(ComplianceReportRequestMailers.Alias(), "mailer_id")), - ), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type complianceReportRequestCountThenLoader[Q orm.Loadable] struct { - Mailers func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildComplianceReportRequestCountThenLoader[Q orm.Loadable]() complianceReportRequestCountThenLoader[Q] { - type MailersCountInterface interface { - LoadCountMailers(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return complianceReportRequestCountThenLoader[Q]{ - Mailers: countThenLoadBuilder[Q]( - "Mailers", - func(ctx context.Context, exec bob.Executor, retrieved MailersCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountMailers(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountMailers loads the count of Mailers into the C struct -func (o *ComplianceReportRequest) LoadCountMailers(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Mailers(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Mailers = &count - return nil -} - -// LoadCountMailers loads the count of Mailers for a slice -func (os ComplianceReportRequestSlice) LoadCountMailers(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountMailers(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type complianceReportRequestJoins[Q dialect.Joinable] struct { - typ string - CreatorUser modAs[Q, userColumns] - Lead modAs[Q, leadColumns] - Mailers modAs[Q, commsMailerColumns] -} - -func (j complianceReportRequestJoins[Q]) aliasedAs(alias string) complianceReportRequestJoins[Q] { - return buildComplianceReportRequestJoins[Q](buildComplianceReportRequestColumns(alias), j.typ) -} - -func buildComplianceReportRequestJoins[Q dialect.Joinable](cols complianceReportRequestColumns, typ string) complianceReportRequestJoins[Q] { - return complianceReportRequestJoins[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.Creator), - )) - } - - return mods - }, - }, - Lead: modAs[Q, leadColumns]{ - c: Leads.Columns, - f: func(to leadColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Leads.Name().As(to.Alias())).On( - to.ID.EQ(cols.LeadID), - )) - } - - return mods - }, - }, - Mailers: modAs[Q, commsMailerColumns]{ - c: CommsMailers.Columns, - f: func(to commsMailerColumns) bob.Mod[Q] { - random := strconv.FormatInt(randInt(), 10) - mods := make(mods.QueryMods[Q], 0, 2) - - { - to := ComplianceReportRequestMailers.Columns.AliasedAs(ComplianceReportRequestMailers.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, ComplianceReportRequestMailers.Name().As(to.Alias())).On( - to.ComplianceReportRequestID.EQ(cols.ID), - )) - } - { - cols := ComplianceReportRequestMailers.Columns.AliasedAs(ComplianceReportRequestMailers.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, CommsMailers.Name().As(to.Alias())).On( - to.ID.EQ(cols.MailerID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/compliance_report_request_mailer.bob.go b/db/models/compliance_report_request_mailer.bob.go index 56a62a19..e279efe2 100644 --- a/db/models/compliance_report_request_mailer.bob.go +++ b/db/models/compliance_report_request_mailer.bob.go @@ -14,7 +14,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/omit" @@ -418,47 +417,3 @@ func (os ComplianceReportRequestMailerSlice) LoadMailer(ctx context.Context, exe return nil } - -type complianceReportRequestMailerJoins[Q dialect.Joinable] struct { - typ string - ComplianceReportRequest modAs[Q, complianceReportRequestColumns] - Mailer modAs[Q, commsMailerColumns] -} - -func (j complianceReportRequestMailerJoins[Q]) aliasedAs(alias string) complianceReportRequestMailerJoins[Q] { - return buildComplianceReportRequestMailerJoins[Q](buildComplianceReportRequestMailerColumns(alias), j.typ) -} - -func buildComplianceReportRequestMailerJoins[Q dialect.Joinable](cols complianceReportRequestMailerColumns, typ string) complianceReportRequestMailerJoins[Q] { - return complianceReportRequestMailerJoins[Q]{ - typ: typ, - ComplianceReportRequest: modAs[Q, complianceReportRequestColumns]{ - c: ComplianceReportRequests.Columns, - f: func(to complianceReportRequestColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ComplianceReportRequests.Name().As(to.Alias())).On( - to.ID.EQ(cols.ComplianceReportRequestID), - )) - } - - return mods - }, - }, - Mailer: modAs[Q, commsMailerColumns]{ - c: CommsMailers.Columns, - f: func(to commsMailerColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsMailers.Name().As(to.Alias())).On( - to.ID.EQ(cols.MailerID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/district_subscription_email.bob.go b/db/models/district_subscription_email.bob.go index 5334e520..80924780 100644 --- a/db/models/district_subscription_email.bob.go +++ b/db/models/district_subscription_email.bob.go @@ -15,7 +15,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/omit" @@ -720,47 +719,3 @@ func (os DistrictSubscriptionEmailSlice) LoadOrganization(ctx context.Context, e return nil } - -type districtSubscriptionEmailJoins[Q dialect.Joinable] struct { - typ string - EmailContactAddressEmailContact modAs[Q, commsEmailContactColumns] - Organization modAs[Q, organizationColumns] -} - -func (j districtSubscriptionEmailJoins[Q]) aliasedAs(alias string) districtSubscriptionEmailJoins[Q] { - return buildDistrictSubscriptionEmailJoins[Q](buildDistrictSubscriptionEmailColumns(alias), j.typ) -} - -func buildDistrictSubscriptionEmailJoins[Q dialect.Joinable](cols districtSubscriptionEmailColumns, typ string) districtSubscriptionEmailJoins[Q] { - return districtSubscriptionEmailJoins[Q]{ - typ: typ, - EmailContactAddressEmailContact: modAs[Q, commsEmailContactColumns]{ - c: CommsEmailContacts.Columns, - f: func(to commsEmailContactColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsEmailContacts.Name().As(to.Alias())).On( - to.Address.EQ(cols.EmailContactAddress), - )) - } - - 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 - }, - }, - } -} diff --git a/db/models/district_subscription_phone.bob.go b/db/models/district_subscription_phone.bob.go index 4dd6f8a6..b7995c50 100644 --- a/db/models/district_subscription_phone.bob.go +++ b/db/models/district_subscription_phone.bob.go @@ -15,7 +15,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/omit" @@ -720,47 +719,3 @@ func (os DistrictSubscriptionPhoneSlice) LoadPhoneE164Phone(ctx context.Context, return nil } - -type districtSubscriptionPhoneJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] - PhoneE164Phone modAs[Q, commsPhoneColumns] -} - -func (j districtSubscriptionPhoneJoins[Q]) aliasedAs(alias string) districtSubscriptionPhoneJoins[Q] { - return buildDistrictSubscriptionPhoneJoins[Q](buildDistrictSubscriptionPhoneColumns(alias), j.typ) -} - -func buildDistrictSubscriptionPhoneJoins[Q dialect.Joinable](cols districtSubscriptionPhoneColumns, typ string) districtSubscriptionPhoneJoins[Q] { - return districtSubscriptionPhoneJoins[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 - }, - }, - PhoneE164Phone: modAs[Q, commsPhoneColumns]{ - c: CommsPhones.Columns, - f: func(to commsPhoneColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsPhones.Name().As(to.Alias())).On( - to.E164.EQ(cols.PhoneE164), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/feature.bob.go b/db/models/feature.bob.go new file mode 100644 index 00000000..df14384f --- /dev/null +++ b/db/models/feature.bob.go @@ -0,0 +1,1198 @@ +// Code generated by BobGen psql v0.42.5. 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/Gleipnir-Technology/bob" + "github.com/Gleipnir-Technology/bob/dialect/psql" + "github.com/Gleipnir-Technology/bob/dialect/psql/dialect" + "github.com/Gleipnir-Technology/bob/dialect/psql/dm" + "github.com/Gleipnir-Technology/bob/dialect/psql/sm" + "github.com/Gleipnir-Technology/bob/dialect/psql/um" + "github.com/Gleipnir-Technology/bob/expr" + "github.com/Gleipnir-Technology/bob/orm" + "github.com/Gleipnir-Technology/bob/types/pgtypes" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" +) + +// Feature is an object representing the database table. +type Feature struct { + Created time.Time `db:"created" ` + CreatorID int32 `db:"creator_id" ` + ID int32 `db:"id,pk" ` + OrganizationID int32 `db:"organization_id" ` + SiteID int32 `db:"site_id" ` + SiteVersion int32 `db:"site_version" ` + Geometry null.Val[string] `db:"geometry" ` + + R featureR `db:"-" ` +} + +// FeatureSlice is an alias for a slice of pointers to Feature. +// This should almost always be used instead of []*Feature. +type FeatureSlice []*Feature + +// Features contains methods to work with the feature table +var Features = psql.NewTablex[*Feature, FeatureSlice, *FeatureSetter]("", "feature", buildFeatureColumns("feature")) + +// FeaturesQuery is a query on the feature table +type FeaturesQuery = *psql.ViewQuery[*Feature, FeatureSlice] + +// featureR is where relationships are stored. +type featureR struct { + CreatorUser *User // feature.feature_creator_id_fkey + Organization *Organization // feature.feature_organization_id_fkey + Site *Site // feature.feature_site_id_site_version_fkey + FeaturePool *FeaturePool // feature_pool.feature_pool_feature_id_fkey +} + +func buildFeatureColumns(alias string) featureColumns { + return featureColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "created", "creator_id", "id", "organization_id", "site_id", "site_version", "geometry", + ).WithParent("feature"), + tableAlias: alias, + Created: psql.Quote(alias, "created"), + CreatorID: psql.Quote(alias, "creator_id"), + ID: psql.Quote(alias, "id"), + OrganizationID: psql.Quote(alias, "organization_id"), + SiteID: psql.Quote(alias, "site_id"), + SiteVersion: psql.Quote(alias, "site_version"), + Geometry: psql.Quote(alias, "geometry"), + } +} + +type featureColumns struct { + expr.ColumnsExpr + tableAlias string + Created psql.Expression + CreatorID psql.Expression + ID psql.Expression + OrganizationID psql.Expression + SiteID psql.Expression + SiteVersion psql.Expression + Geometry psql.Expression +} + +func (c featureColumns) Alias() string { + return c.tableAlias +} + +func (featureColumns) AliasedAs(alias string) featureColumns { + return buildFeatureColumns(alias) +} + +// FeatureSetter is used for insert/upsert/update operations +// All values are optional, and do not have to be set +// Generated columns are not included +type FeatureSetter struct { + Created omit.Val[time.Time] `db:"created" ` + CreatorID omit.Val[int32] `db:"creator_id" ` + ID omit.Val[int32] `db:"id,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + SiteID omit.Val[int32] `db:"site_id" ` + SiteVersion omit.Val[int32] `db:"site_version" ` + Geometry omitnull.Val[string] `db:"geometry" ` +} + +func (s FeatureSetter) 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.ID.IsValue() { + vals = append(vals, "id") + } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } + if s.SiteID.IsValue() { + vals = append(vals, "site_id") + } + if s.SiteVersion.IsValue() { + vals = append(vals, "site_version") + } + if !s.Geometry.IsUnset() { + vals = append(vals, "geometry") + } + return vals +} + +func (s FeatureSetter) Overwrite(t *Feature) { + if s.Created.IsValue() { + t.Created = s.Created.MustGet() + } + if s.CreatorID.IsValue() { + t.CreatorID = s.CreatorID.MustGet() + } + if s.ID.IsValue() { + t.ID = s.ID.MustGet() + } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } + if s.SiteID.IsValue() { + t.SiteID = s.SiteID.MustGet() + } + if s.SiteVersion.IsValue() { + t.SiteVersion = s.SiteVersion.MustGet() + } + if !s.Geometry.IsUnset() { + t.Geometry = s.Geometry.MustGetNull() + } +} + +func (s *FeatureSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return Features.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.ID.IsValue() { + vals[2] = psql.Arg(s.ID.MustGet()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[3] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if s.SiteID.IsValue() { + vals[4] = psql.Arg(s.SiteID.MustGet()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if s.SiteVersion.IsValue() { + vals[5] = psql.Arg(s.SiteVersion.MustGet()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + if !s.Geometry.IsUnset() { + vals[6] = psql.Arg(s.Geometry.MustGetNull()) + } else { + vals[6] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FeatureSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FeatureSetter) 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.ID.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "id")...), + psql.Arg(s.ID), + }}) + } + + 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.SiteID.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "site_id")...), + psql.Arg(s.SiteID), + }}) + } + + if s.SiteVersion.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "site_version")...), + psql.Arg(s.SiteVersion), + }}) + } + + if !s.Geometry.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + return exprs +} + +// FindFeature retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFeature(ctx context.Context, exec bob.Executor, IDPK int32, cols ...string) (*Feature, error) { + if len(cols) == 0 { + return Features.Query( + sm.Where(Features.Columns.ID.EQ(psql.Arg(IDPK))), + ).One(ctx, exec) + } + + return Features.Query( + sm.Where(Features.Columns.ID.EQ(psql.Arg(IDPK))), + sm.Columns(Features.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FeatureExists checks the presence of a single record by primary key +func FeatureExists(ctx context.Context, exec bob.Executor, IDPK int32) (bool, error) { + return Features.Query( + sm.Where(Features.Columns.ID.EQ(psql.Arg(IDPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after Feature is retrieved from the database +func (o *Feature) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = Features.AfterSelectHooks.RunHooks(ctx, exec, FeatureSlice{o}) + case bob.QueryTypeInsert: + ctx, err = Features.AfterInsertHooks.RunHooks(ctx, exec, FeatureSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = Features.AfterUpdateHooks.RunHooks(ctx, exec, FeatureSlice{o}) + case bob.QueryTypeDelete: + ctx, err = Features.AfterDeleteHooks.RunHooks(ctx, exec, FeatureSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the Feature +func (o *Feature) primaryKeyVals() bob.Expression { + return psql.Arg(o.ID) +} + +func (o *Feature) pkEQ() dialect.Expression { + return psql.Quote("feature", "id").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 Feature +func (o *Feature) Update(ctx context.Context, exec bob.Executor, s *FeatureSetter) error { + v, err := Features.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 Feature record with an executor +func (o *Feature) Delete(ctx context.Context, exec bob.Executor) error { + _, err := Features.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the Feature using the executor +func (o *Feature) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := Features.Query( + sm.Where(Features.Columns.ID.EQ(psql.Arg(o.ID))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FeatureSlice is retrieved from the database +func (o FeatureSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = Features.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = Features.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = Features.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = Features.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FeatureSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("feature", "id").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 FeatureSlice) copyMatchingRows(from ...*Feature) { + for i, old := range o { + for _, new := range from { + if new.ID != old.ID { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FeatureSlice) 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 Features.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 *Feature: + o.copyMatchingRows(retrieved) + case []*Feature: + o.copyMatchingRows(retrieved...) + case FeatureSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a Feature or a slice of Feature + // then run the AfterUpdateHooks on the slice + _, err = Features.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FeatureSlice) 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 Features.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 *Feature: + o.copyMatchingRows(retrieved) + case []*Feature: + o.copyMatchingRows(retrieved...) + case FeatureSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a Feature or a slice of Feature + // then run the AfterDeleteHooks on the slice + _, err = Features.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FeatureSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FeatureSetter) error { + if len(o) == 0 { + return nil + } + + _, err := Features.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FeatureSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := Features.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FeatureSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := Features.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 *Feature) CreatorUser(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery { + return Users.Query(append(mods, + sm.Where(Users.Columns.ID.EQ(psql.Arg(o.CreatorID))), + )...) +} + +func (os FeatureSlice) 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)), + )...) +} + +// Organization starts a query for related objects on organization +func (o *Feature) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os FeatureSlice) 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)), + )...) +} + +// Site starts a query for related objects on site +func (o *Feature) Site(mods ...bob.Mod[*dialect.SelectQuery]) SitesQuery { + return Sites.Query(append(mods, + sm.Where(Sites.Columns.ID.EQ(psql.Arg(o.SiteID))), sm.Where(Sites.Columns.Version.EQ(psql.Arg(o.SiteVersion))), + )...) +} + +func (os FeatureSlice) Site(mods ...bob.Mod[*dialect.SelectQuery]) SitesQuery { + pkSiteID := make(pgtypes.Array[int32], 0, len(os)) + + pkSiteVersion := make(pgtypes.Array[int32], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkSiteID = append(pkSiteID, o.SiteID) + pkSiteVersion = append(pkSiteVersion, o.SiteVersion) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkSiteID), "integer[]")), + psql.F("unnest", psql.Cast(psql.Arg(pkSiteVersion), "integer[]")), + )) + + return Sites.Query(append(mods, + sm.Where(psql.Group(Sites.Columns.ID, Sites.Columns.Version).OP("IN", PKArgExpr)), + )...) +} + +// FeaturePool starts a query for related objects on feature_pool +func (o *Feature) FeaturePool(mods ...bob.Mod[*dialect.SelectQuery]) FeaturePoolsQuery { + return FeaturePools.Query(append(mods, + sm.Where(FeaturePools.Columns.FeatureID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os FeatureSlice) FeaturePool(mods ...bob.Mod[*dialect.SelectQuery]) FeaturePoolsQuery { + 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 FeaturePools.Query(append(mods, + sm.Where(psql.Group(FeaturePools.Columns.FeatureID).OP("IN", PKArgExpr)), + )...) +} + +func attachFeatureCreatorUser0(ctx context.Context, exec bob.Executor, count int, feature0 *Feature, user1 *User) (*Feature, error) { + setter := &FeatureSetter{ + CreatorID: omit.From(user1.ID), + } + + err := feature0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFeatureCreatorUser0: %w", err) + } + + return feature0, nil +} + +func (feature0 *Feature) 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 = attachFeatureCreatorUser0(ctx, exec, 1, feature0, user1) + if err != nil { + return err + } + + feature0.R.CreatorUser = user1 + + user1.R.CreatorFeatures = append(user1.R.CreatorFeatures, feature0) + + return nil +} + +func (feature0 *Feature) AttachCreatorUser(ctx context.Context, exec bob.Executor, user1 *User) error { + var err error + + _, err = attachFeatureCreatorUser0(ctx, exec, 1, feature0, user1) + if err != nil { + return err + } + + feature0.R.CreatorUser = user1 + + user1.R.CreatorFeatures = append(user1.R.CreatorFeatures, feature0) + + return nil +} + +func attachFeatureOrganization0(ctx context.Context, exec bob.Executor, count int, feature0 *Feature, organization1 *Organization) (*Feature, error) { + setter := &FeatureSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := feature0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFeatureOrganization0: %w", err) + } + + return feature0, nil +} + +func (feature0 *Feature) 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 = attachFeatureOrganization0(ctx, exec, 1, feature0, organization1) + if err != nil { + return err + } + + feature0.R.Organization = organization1 + + organization1.R.Features = append(organization1.R.Features, feature0) + + return nil +} + +func (feature0 *Feature) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachFeatureOrganization0(ctx, exec, 1, feature0, organization1) + if err != nil { + return err + } + + feature0.R.Organization = organization1 + + organization1.R.Features = append(organization1.R.Features, feature0) + + return nil +} + +func attachFeatureSite0(ctx context.Context, exec bob.Executor, count int, feature0 *Feature, site1 *Site) (*Feature, error) { + setter := &FeatureSetter{ + SiteID: omit.From(site1.ID), + SiteVersion: omit.From(site1.Version), + } + + err := feature0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFeatureSite0: %w", err) + } + + return feature0, nil +} + +func (feature0 *Feature) InsertSite(ctx context.Context, exec bob.Executor, related *SiteSetter) error { + var err error + + site1, err := Sites.Insert(related).One(ctx, exec) + if err != nil { + return fmt.Errorf("inserting related objects: %w", err) + } + + _, err = attachFeatureSite0(ctx, exec, 1, feature0, site1) + if err != nil { + return err + } + + feature0.R.Site = site1 + + site1.R.Features = append(site1.R.Features, feature0) + + return nil +} + +func (feature0 *Feature) AttachSite(ctx context.Context, exec bob.Executor, site1 *Site) error { + var err error + + _, err = attachFeatureSite0(ctx, exec, 1, feature0, site1) + if err != nil { + return err + } + + feature0.R.Site = site1 + + site1.R.Features = append(site1.R.Features, feature0) + + return nil +} + +func insertFeatureFeaturePool0(ctx context.Context, exec bob.Executor, featurePool1 *FeaturePoolSetter, feature0 *Feature) (*FeaturePool, error) { + featurePool1.FeatureID = omit.From(feature0.ID) + + ret, err := FeaturePools.Insert(featurePool1).One(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertFeatureFeaturePool0: %w", err) + } + + return ret, nil +} + +func attachFeatureFeaturePool0(ctx context.Context, exec bob.Executor, count int, featurePool1 *FeaturePool, feature0 *Feature) (*FeaturePool, error) { + setter := &FeaturePoolSetter{ + FeatureID: omit.From(feature0.ID), + } + + err := featurePool1.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFeatureFeaturePool0: %w", err) + } + + return featurePool1, nil +} + +func (feature0 *Feature) InsertFeaturePool(ctx context.Context, exec bob.Executor, related *FeaturePoolSetter) error { + var err error + + featurePool1, err := insertFeatureFeaturePool0(ctx, exec, related, feature0) + if err != nil { + return err + } + + feature0.R.FeaturePool = featurePool1 + + featurePool1.R.Feature = feature0 + + return nil +} + +func (feature0 *Feature) AttachFeaturePool(ctx context.Context, exec bob.Executor, featurePool1 *FeaturePool) error { + var err error + + _, err = attachFeatureFeaturePool0(ctx, exec, 1, featurePool1, feature0) + if err != nil { + return err + } + + feature0.R.FeaturePool = featurePool1 + + featurePool1.R.Feature = feature0 + + return nil +} + +type featureWhere[Q psql.Filterable] struct { + Created psql.WhereMod[Q, time.Time] + CreatorID psql.WhereMod[Q, int32] + ID psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] + SiteID psql.WhereMod[Q, int32] + SiteVersion psql.WhereMod[Q, int32] + Geometry psql.WhereNullMod[Q, string] +} + +func (featureWhere[Q]) AliasedAs(alias string) featureWhere[Q] { + return buildFeatureWhere[Q](buildFeatureColumns(alias)) +} + +func buildFeatureWhere[Q psql.Filterable](cols featureColumns) featureWhere[Q] { + return featureWhere[Q]{ + Created: psql.Where[Q, time.Time](cols.Created), + CreatorID: psql.Where[Q, int32](cols.CreatorID), + ID: psql.Where[Q, int32](cols.ID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + SiteID: psql.Where[Q, int32](cols.SiteID), + SiteVersion: psql.Where[Q, int32](cols.SiteVersion), + Geometry: psql.WhereNull[Q, string](cols.Geometry), + } +} + +func (o *Feature) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "CreatorUser": + rel, ok := retrieved.(*User) + if !ok { + return fmt.Errorf("feature cannot load %T as %q", retrieved, name) + } + + o.R.CreatorUser = rel + + if rel != nil { + rel.R.CreatorFeatures = FeatureSlice{o} + } + return nil + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("feature cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.Features = FeatureSlice{o} + } + return nil + case "Site": + rel, ok := retrieved.(*Site) + if !ok { + return fmt.Errorf("feature cannot load %T as %q", retrieved, name) + } + + o.R.Site = rel + + if rel != nil { + rel.R.Features = FeatureSlice{o} + } + return nil + case "FeaturePool": + rel, ok := retrieved.(*FeaturePool) + if !ok { + return fmt.Errorf("feature cannot load %T as %q", retrieved, name) + } + + o.R.FeaturePool = rel + + if rel != nil { + rel.R.Feature = o + } + return nil + default: + return fmt.Errorf("feature has no relationship %q", name) + } +} + +type featurePreloader struct { + CreatorUser func(...psql.PreloadOption) psql.Preloader + Organization func(...psql.PreloadOption) psql.Preloader + Site func(...psql.PreloadOption) psql.Preloader + FeaturePool func(...psql.PreloadOption) psql.Preloader +} + +func buildFeaturePreloader() featurePreloader { + return featurePreloader{ + CreatorUser: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*User, UserSlice](psql.PreloadRel{ + Name: "CreatorUser", + Sides: []psql.PreloadSide{ + { + From: Features, + To: Users, + FromColumns: []string{"creator_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: Features, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + Site: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Site, SiteSlice](psql.PreloadRel{ + Name: "Site", + Sides: []psql.PreloadSide{ + { + From: Features, + To: Sites, + FromColumns: []string{"site_id", "site_version"}, + ToColumns: []string{"id", "version"}, + }, + }, + }, Sites.Columns.Names(), opts...) + }, + FeaturePool: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*FeaturePool, FeaturePoolSlice](psql.PreloadRel{ + Name: "FeaturePool", + Sides: []psql.PreloadSide{ + { + From: Features, + To: FeaturePools, + FromColumns: []string{"id"}, + ToColumns: []string{"feature_id"}, + }, + }, + }, FeaturePools.Columns.Names(), opts...) + }, + } +} + +type featureThenLoader[Q orm.Loadable] struct { + CreatorUser func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Site func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + FeaturePool func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFeatureThenLoader[Q orm.Loadable]() featureThenLoader[Q] { + type CreatorUserLoadInterface interface { + LoadCreatorUser(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type SiteLoadInterface interface { + LoadSite(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type FeaturePoolLoadInterface interface { + LoadFeaturePool(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return featureThenLoader[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...) + }, + ), + 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...) + }, + ), + Site: thenLoadBuilder[Q]( + "Site", + func(ctx context.Context, exec bob.Executor, retrieved SiteLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadSite(ctx, exec, mods...) + }, + ), + FeaturePool: thenLoadBuilder[Q]( + "FeaturePool", + func(ctx context.Context, exec bob.Executor, retrieved FeaturePoolLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFeaturePool(ctx, exec, mods...) + }, + ), + } +} + +// LoadCreatorUser loads the feature's CreatorUser into the .R struct +func (o *Feature) 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.CreatorFeatures = FeatureSlice{o} + + o.R.CreatorUser = related + return nil +} + +// LoadCreatorUser loads the feature's CreatorUser into the .R struct +func (os FeatureSlice) 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.CreatorFeatures = append(rel.R.CreatorFeatures, o) + + o.R.CreatorUser = rel + break + } + } + + return nil +} + +// LoadOrganization loads the feature's Organization into the .R struct +func (o *Feature) 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.Features = FeatureSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the feature's Organization into the .R struct +func (os FeatureSlice) 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.Features = append(rel.R.Features, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +// LoadSite loads the feature's Site into the .R struct +func (o *Feature) LoadSite(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Site = nil + + related, err := o.Site(mods...).One(ctx, exec) + if err != nil { + return err + } + + related.R.Features = FeatureSlice{o} + + o.R.Site = related + return nil +} + +// LoadSite loads the feature's Site into the .R struct +func (os FeatureSlice) LoadSite(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + sites, err := os.Site(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range sites { + + if !(o.SiteID == rel.ID) { + continue + } + + if !(o.SiteVersion == rel.Version) { + continue + } + + rel.R.Features = append(rel.R.Features, o) + + o.R.Site = rel + break + } + } + + return nil +} + +// LoadFeaturePool loads the feature's FeaturePool into the .R struct +func (o *Feature) LoadFeaturePool(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FeaturePool = nil + + related, err := o.FeaturePool(mods...).One(ctx, exec) + if err != nil { + return err + } + + related.R.Feature = o + + o.R.FeaturePool = related + return nil +} + +// LoadFeaturePool loads the feature's FeaturePool into the .R struct +func (os FeatureSlice) LoadFeaturePool(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + featurePools, err := os.FeaturePool(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range featurePools { + + if !(o.ID == rel.FeatureID) { + continue + } + + rel.R.Feature = o + + o.R.FeaturePool = rel + break + } + } + + return nil +} diff --git a/db/models/feature_pool.bob.go b/db/models/feature_pool.bob.go new file mode 100644 index 00000000..84cb56a7 --- /dev/null +++ b/db/models/feature_pool.bob.go @@ -0,0 +1,803 @@ +// Code generated by BobGen psql v0.42.5. 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" + + "github.com/Gleipnir-Technology/bob" + "github.com/Gleipnir-Technology/bob/dialect/psql" + "github.com/Gleipnir-Technology/bob/dialect/psql/dialect" + "github.com/Gleipnir-Technology/bob/dialect/psql/dm" + "github.com/Gleipnir-Technology/bob/dialect/psql/sm" + "github.com/Gleipnir-Technology/bob/dialect/psql/um" + "github.com/Gleipnir-Technology/bob/expr" + "github.com/Gleipnir-Technology/bob/orm" + "github.com/Gleipnir-Technology/bob/types/pgtypes" + enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" +) + +// FeaturePool is an object representing the database table. +type FeaturePool struct { + FeatureID int32 `db:"feature_id,pk" ` + Condition enums.Poolconditiontype `db:"condition" ` + DepthMeters null.Val[float64] `db:"depth_meters" ` + Geometry null.Val[string] `db:"geometry" ` + + R featurePoolR `db:"-" ` +} + +// FeaturePoolSlice is an alias for a slice of pointers to FeaturePool. +// This should almost always be used instead of []*FeaturePool. +type FeaturePoolSlice []*FeaturePool + +// FeaturePools contains methods to work with the feature_pool table +var FeaturePools = psql.NewTablex[*FeaturePool, FeaturePoolSlice, *FeaturePoolSetter]("", "feature_pool", buildFeaturePoolColumns("feature_pool")) + +// FeaturePoolsQuery is a query on the feature_pool table +type FeaturePoolsQuery = *psql.ViewQuery[*FeaturePool, FeaturePoolSlice] + +// featurePoolR is where relationships are stored. +type featurePoolR struct { + Feature *Feature // feature_pool.feature_pool_feature_id_fkey + ReviewTaskPools ReviewTaskPoolSlice // review_task_pool.review_task_pool_feature_pool_fkey +} + +func buildFeaturePoolColumns(alias string) featurePoolColumns { + return featurePoolColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "feature_id", "condition", "depth_meters", "geometry", + ).WithParent("feature_pool"), + tableAlias: alias, + FeatureID: psql.Quote(alias, "feature_id"), + Condition: psql.Quote(alias, "condition"), + DepthMeters: psql.Quote(alias, "depth_meters"), + Geometry: psql.Quote(alias, "geometry"), + } +} + +type featurePoolColumns struct { + expr.ColumnsExpr + tableAlias string + FeatureID psql.Expression + Condition psql.Expression + DepthMeters psql.Expression + Geometry psql.Expression +} + +func (c featurePoolColumns) Alias() string { + return c.tableAlias +} + +func (featurePoolColumns) AliasedAs(alias string) featurePoolColumns { + return buildFeaturePoolColumns(alias) +} + +// FeaturePoolSetter is used for insert/upsert/update operations +// All values are optional, and do not have to be set +// Generated columns are not included +type FeaturePoolSetter struct { + FeatureID omit.Val[int32] `db:"feature_id,pk" ` + Condition omit.Val[enums.Poolconditiontype] `db:"condition" ` + DepthMeters omitnull.Val[float64] `db:"depth_meters" ` + Geometry omitnull.Val[string] `db:"geometry" ` +} + +func (s FeaturePoolSetter) SetColumns() []string { + vals := make([]string, 0, 4) + if s.FeatureID.IsValue() { + vals = append(vals, "feature_id") + } + if s.Condition.IsValue() { + vals = append(vals, "condition") + } + if !s.DepthMeters.IsUnset() { + vals = append(vals, "depth_meters") + } + if !s.Geometry.IsUnset() { + vals = append(vals, "geometry") + } + return vals +} + +func (s FeaturePoolSetter) Overwrite(t *FeaturePool) { + if s.FeatureID.IsValue() { + t.FeatureID = s.FeatureID.MustGet() + } + if s.Condition.IsValue() { + t.Condition = s.Condition.MustGet() + } + if !s.DepthMeters.IsUnset() { + t.DepthMeters = s.DepthMeters.MustGetNull() + } + if !s.Geometry.IsUnset() { + t.Geometry = s.Geometry.MustGetNull() + } +} + +func (s *FeaturePoolSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return FeaturePools.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.FeatureID.IsValue() { + vals[0] = psql.Arg(s.FeatureID.MustGet()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if s.Condition.IsValue() { + vals[1] = psql.Arg(s.Condition.MustGet()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.DepthMeters.IsUnset() { + vals[2] = psql.Arg(s.DepthMeters.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if !s.Geometry.IsUnset() { + vals[3] = psql.Arg(s.Geometry.MustGetNull()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s FeaturePoolSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s FeaturePoolSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 4) + + if s.FeatureID.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "feature_id")...), + psql.Arg(s.FeatureID), + }}) + } + + if s.Condition.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "condition")...), + psql.Arg(s.Condition), + }}) + } + + if !s.DepthMeters.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "depth_meters")...), + psql.Arg(s.DepthMeters), + }}) + } + + if !s.Geometry.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + return exprs +} + +// FindFeaturePool retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindFeaturePool(ctx context.Context, exec bob.Executor, FeatureIDPK int32, cols ...string) (*FeaturePool, error) { + if len(cols) == 0 { + return FeaturePools.Query( + sm.Where(FeaturePools.Columns.FeatureID.EQ(psql.Arg(FeatureIDPK))), + ).One(ctx, exec) + } + + return FeaturePools.Query( + sm.Where(FeaturePools.Columns.FeatureID.EQ(psql.Arg(FeatureIDPK))), + sm.Columns(FeaturePools.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// FeaturePoolExists checks the presence of a single record by primary key +func FeaturePoolExists(ctx context.Context, exec bob.Executor, FeatureIDPK int32) (bool, error) { + return FeaturePools.Query( + sm.Where(FeaturePools.Columns.FeatureID.EQ(psql.Arg(FeatureIDPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after FeaturePool is retrieved from the database +func (o *FeaturePool) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FeaturePools.AfterSelectHooks.RunHooks(ctx, exec, FeaturePoolSlice{o}) + case bob.QueryTypeInsert: + ctx, err = FeaturePools.AfterInsertHooks.RunHooks(ctx, exec, FeaturePoolSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = FeaturePools.AfterUpdateHooks.RunHooks(ctx, exec, FeaturePoolSlice{o}) + case bob.QueryTypeDelete: + ctx, err = FeaturePools.AfterDeleteHooks.RunHooks(ctx, exec, FeaturePoolSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the FeaturePool +func (o *FeaturePool) primaryKeyVals() bob.Expression { + return psql.Arg(o.FeatureID) +} + +func (o *FeaturePool) pkEQ() dialect.Expression { + return psql.Quote("feature_pool", "feature_id").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 FeaturePool +func (o *FeaturePool) Update(ctx context.Context, exec bob.Executor, s *FeaturePoolSetter) error { + v, err := FeaturePools.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 FeaturePool record with an executor +func (o *FeaturePool) Delete(ctx context.Context, exec bob.Executor) error { + _, err := FeaturePools.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the FeaturePool using the executor +func (o *FeaturePool) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := FeaturePools.Query( + sm.Where(FeaturePools.Columns.FeatureID.EQ(psql.Arg(o.FeatureID))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after FeaturePoolSlice is retrieved from the database +func (o FeaturePoolSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = FeaturePools.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = FeaturePools.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = FeaturePools.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = FeaturePools.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o FeaturePoolSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("feature_pool", "feature_id").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 FeaturePoolSlice) copyMatchingRows(from ...*FeaturePool) { + for i, old := range o { + for _, new := range from { + if new.FeatureID != old.FeatureID { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o FeaturePoolSlice) 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 FeaturePools.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 *FeaturePool: + o.copyMatchingRows(retrieved) + case []*FeaturePool: + o.copyMatchingRows(retrieved...) + case FeaturePoolSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FeaturePool or a slice of FeaturePool + // then run the AfterUpdateHooks on the slice + _, err = FeaturePools.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o FeaturePoolSlice) 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 FeaturePools.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 *FeaturePool: + o.copyMatchingRows(retrieved) + case []*FeaturePool: + o.copyMatchingRows(retrieved...) + case FeaturePoolSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a FeaturePool or a slice of FeaturePool + // then run the AfterDeleteHooks on the slice + _, err = FeaturePools.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o FeaturePoolSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals FeaturePoolSetter) error { + if len(o) == 0 { + return nil + } + + _, err := FeaturePools.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o FeaturePoolSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := FeaturePools.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o FeaturePoolSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := FeaturePools.Query(sm.Where(o.pkIN())).All(ctx, exec) + if err != nil { + return err + } + + o.copyMatchingRows(o2...) + + return nil +} + +// Feature starts a query for related objects on feature +func (o *FeaturePool) Feature(mods ...bob.Mod[*dialect.SelectQuery]) FeaturesQuery { + return Features.Query(append(mods, + sm.Where(Features.Columns.ID.EQ(psql.Arg(o.FeatureID))), + )...) +} + +func (os FeaturePoolSlice) Feature(mods ...bob.Mod[*dialect.SelectQuery]) FeaturesQuery { + pkFeatureID := make(pgtypes.Array[int32], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkFeatureID = append(pkFeatureID, o.FeatureID) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkFeatureID), "integer[]")), + )) + + return Features.Query(append(mods, + sm.Where(psql.Group(Features.Columns.ID).OP("IN", PKArgExpr)), + )...) +} + +// ReviewTaskPools starts a query for related objects on review_task_pool +func (o *FeaturePool) ReviewTaskPools(mods ...bob.Mod[*dialect.SelectQuery]) ReviewTaskPoolsQuery { + return ReviewTaskPools.Query(append(mods, + sm.Where(ReviewTaskPools.Columns.FeaturePool.EQ(psql.Arg(o.FeatureID))), + )...) +} + +func (os FeaturePoolSlice) ReviewTaskPools(mods ...bob.Mod[*dialect.SelectQuery]) ReviewTaskPoolsQuery { + pkFeatureID := make(pgtypes.Array[int32], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkFeatureID = append(pkFeatureID, o.FeatureID) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkFeatureID), "integer[]")), + )) + + return ReviewTaskPools.Query(append(mods, + sm.Where(psql.Group(ReviewTaskPools.Columns.FeaturePool).OP("IN", PKArgExpr)), + )...) +} + +func attachFeaturePoolFeature0(ctx context.Context, exec bob.Executor, count int, featurePool0 *FeaturePool, feature1 *Feature) (*FeaturePool, error) { + setter := &FeaturePoolSetter{ + FeatureID: omit.From(feature1.ID), + } + + err := featurePool0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachFeaturePoolFeature0: %w", err) + } + + return featurePool0, nil +} + +func (featurePool0 *FeaturePool) InsertFeature(ctx context.Context, exec bob.Executor, related *FeatureSetter) error { + var err error + + feature1, err := Features.Insert(related).One(ctx, exec) + if err != nil { + return fmt.Errorf("inserting related objects: %w", err) + } + + _, err = attachFeaturePoolFeature0(ctx, exec, 1, featurePool0, feature1) + if err != nil { + return err + } + + featurePool0.R.Feature = feature1 + + feature1.R.FeaturePool = featurePool0 + + return nil +} + +func (featurePool0 *FeaturePool) AttachFeature(ctx context.Context, exec bob.Executor, feature1 *Feature) error { + var err error + + _, err = attachFeaturePoolFeature0(ctx, exec, 1, featurePool0, feature1) + if err != nil { + return err + } + + featurePool0.R.Feature = feature1 + + feature1.R.FeaturePool = featurePool0 + + return nil +} + +func insertFeaturePoolReviewTaskPools0(ctx context.Context, exec bob.Executor, reviewTaskPools1 []*ReviewTaskPoolSetter, featurePool0 *FeaturePool) (ReviewTaskPoolSlice, error) { + for i := range reviewTaskPools1 { + reviewTaskPools1[i].FeaturePool = omit.From(featurePool0.FeatureID) + } + + ret, err := ReviewTaskPools.Insert(bob.ToMods(reviewTaskPools1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertFeaturePoolReviewTaskPools0: %w", err) + } + + return ret, nil +} + +func attachFeaturePoolReviewTaskPools0(ctx context.Context, exec bob.Executor, count int, reviewTaskPools1 ReviewTaskPoolSlice, featurePool0 *FeaturePool) (ReviewTaskPoolSlice, error) { + setter := &ReviewTaskPoolSetter{ + FeaturePool: omit.From(featurePool0.FeatureID), + } + + err := reviewTaskPools1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachFeaturePoolReviewTaskPools0: %w", err) + } + + return reviewTaskPools1, nil +} + +func (featurePool0 *FeaturePool) InsertReviewTaskPools(ctx context.Context, exec bob.Executor, related ...*ReviewTaskPoolSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + reviewTaskPools1, err := insertFeaturePoolReviewTaskPools0(ctx, exec, related, featurePool0) + if err != nil { + return err + } + + featurePool0.R.ReviewTaskPools = append(featurePool0.R.ReviewTaskPools, reviewTaskPools1...) + + for _, rel := range reviewTaskPools1 { + rel.R.FeaturePool = featurePool0 + } + return nil +} + +func (featurePool0 *FeaturePool) AttachReviewTaskPools(ctx context.Context, exec bob.Executor, related ...*ReviewTaskPool) error { + if len(related) == 0 { + return nil + } + + var err error + reviewTaskPools1 := ReviewTaskPoolSlice(related) + + _, err = attachFeaturePoolReviewTaskPools0(ctx, exec, len(related), reviewTaskPools1, featurePool0) + if err != nil { + return err + } + + featurePool0.R.ReviewTaskPools = append(featurePool0.R.ReviewTaskPools, reviewTaskPools1...) + + for _, rel := range related { + rel.R.FeaturePool = featurePool0 + } + + return nil +} + +type featurePoolWhere[Q psql.Filterable] struct { + FeatureID psql.WhereMod[Q, int32] + Condition psql.WhereMod[Q, enums.Poolconditiontype] + DepthMeters psql.WhereNullMod[Q, float64] + Geometry psql.WhereNullMod[Q, string] +} + +func (featurePoolWhere[Q]) AliasedAs(alias string) featurePoolWhere[Q] { + return buildFeaturePoolWhere[Q](buildFeaturePoolColumns(alias)) +} + +func buildFeaturePoolWhere[Q psql.Filterable](cols featurePoolColumns) featurePoolWhere[Q] { + return featurePoolWhere[Q]{ + FeatureID: psql.Where[Q, int32](cols.FeatureID), + Condition: psql.Where[Q, enums.Poolconditiontype](cols.Condition), + DepthMeters: psql.WhereNull[Q, float64](cols.DepthMeters), + Geometry: psql.WhereNull[Q, string](cols.Geometry), + } +} + +func (o *FeaturePool) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "Feature": + rel, ok := retrieved.(*Feature) + if !ok { + return fmt.Errorf("featurePool cannot load %T as %q", retrieved, name) + } + + o.R.Feature = rel + + if rel != nil { + rel.R.FeaturePool = o + } + return nil + case "ReviewTaskPools": + rels, ok := retrieved.(ReviewTaskPoolSlice) + if !ok { + return fmt.Errorf("featurePool cannot load %T as %q", retrieved, name) + } + + o.R.ReviewTaskPools = rels + + for _, rel := range rels { + if rel != nil { + rel.R.FeaturePool = o + } + } + return nil + default: + return fmt.Errorf("featurePool has no relationship %q", name) + } +} + +type featurePoolPreloader struct { + Feature func(...psql.PreloadOption) psql.Preloader +} + +func buildFeaturePoolPreloader() featurePoolPreloader { + return featurePoolPreloader{ + Feature: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*Feature, FeatureSlice](psql.PreloadRel{ + Name: "Feature", + Sides: []psql.PreloadSide{ + { + From: FeaturePools, + To: Features, + FromColumns: []string{"feature_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Features.Columns.Names(), opts...) + }, + } +} + +type featurePoolThenLoader[Q orm.Loadable] struct { + Feature func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + ReviewTaskPools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildFeaturePoolThenLoader[Q orm.Loadable]() featurePoolThenLoader[Q] { + type FeatureLoadInterface interface { + LoadFeature(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type ReviewTaskPoolsLoadInterface interface { + LoadReviewTaskPools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return featurePoolThenLoader[Q]{ + Feature: thenLoadBuilder[Q]( + "Feature", + func(ctx context.Context, exec bob.Executor, retrieved FeatureLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFeature(ctx, exec, mods...) + }, + ), + ReviewTaskPools: thenLoadBuilder[Q]( + "ReviewTaskPools", + func(ctx context.Context, exec bob.Executor, retrieved ReviewTaskPoolsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadReviewTaskPools(ctx, exec, mods...) + }, + ), + } +} + +// LoadFeature loads the featurePool's Feature into the .R struct +func (o *FeaturePool) LoadFeature(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Feature = nil + + related, err := o.Feature(mods...).One(ctx, exec) + if err != nil { + return err + } + + related.R.FeaturePool = o + + o.R.Feature = related + return nil +} + +// LoadFeature loads the featurePool's Feature into the .R struct +func (os FeaturePoolSlice) LoadFeature(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + features, err := os.Feature(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range features { + + if !(o.FeatureID == rel.ID) { + continue + } + + rel.R.FeaturePool = o + + o.R.Feature = rel + break + } + } + + return nil +} + +// LoadReviewTaskPools loads the featurePool's ReviewTaskPools into the .R struct +func (o *FeaturePool) LoadReviewTaskPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.ReviewTaskPools = nil + + related, err := o.ReviewTaskPools(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.FeaturePool = o + } + + o.R.ReviewTaskPools = related + return nil +} + +// LoadReviewTaskPools loads the featurePool's ReviewTaskPools into the .R struct +func (os FeaturePoolSlice) LoadReviewTaskPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + reviewTaskPools, err := os.ReviewTaskPools(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.ReviewTaskPools = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range reviewTaskPools { + + if !(o.FeatureID == rel.FeaturePool) { + continue + } + + rel.R.FeaturePool = o + + o.R.ReviewTaskPools = append(o.R.ReviewTaskPools, rel) + } + } + + return nil +} diff --git a/db/models/fieldseeker.containerrelate.bob.go b/db/models/fieldseeker.containerrelate.bob.go index 3d08edbd..c6e9c5ef 100644 --- a/db/models/fieldseeker.containerrelate.bob.go +++ b/db/models/fieldseeker.containerrelate.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -1000,32 +999,3 @@ func (os FieldseekerContainerrelateSlice) LoadOrganization(ctx context.Context, 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 ff221e64..263a0692 100644 --- a/db/models/fieldseeker.fieldscoutinglog.bob.go +++ b/db/models/fieldseeker.fieldscoutinglog.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -922,32 +921,3 @@ func (os FieldseekerFieldscoutinglogSlice) LoadOrganization(ctx context.Context, 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 37743713..76f58e04 100644 --- a/db/models/fieldseeker.habitatrelate.bob.go +++ b/db/models/fieldseeker.habitatrelate.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -948,32 +947,3 @@ func (os FieldseekerHabitatrelateSlice) LoadOrganization(ctx context.Context, ex 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 b70b3452..af9e3f31 100644 --- a/db/models/fieldseeker.inspectionsample.bob.go +++ b/db/models/fieldseeker.inspectionsample.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -1000,32 +999,3 @@ func (os FieldseekerInspectionsampleSlice) LoadOrganization(ctx context.Context, 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 fde2deb9..e709cc65 100644 --- a/db/models/fieldseeker.inspectionsampledetail.bob.go +++ b/db/models/fieldseeker.inspectionsampledetail.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -1286,32 +1285,3 @@ func (os FieldseekerInspectionsampledetailSlice) LoadOrganization(ctx context.Co 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 dfa31d27..f2acf248 100644 --- a/db/models/fieldseeker.linelocation.bob.go +++ b/db/models/fieldseeker.linelocation.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -1884,32 +1883,3 @@ func (os FieldseekerLinelocationSlice) LoadOrganization(ctx context.Context, exe 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 452a6c61..773d381c 100644 --- a/db/models/fieldseeker.locationtracking.bob.go +++ b/db/models/fieldseeker.locationtracking.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -948,32 +947,3 @@ func (os FieldseekerLocationtrackingSlice) LoadOrganization(ctx context.Context, 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 89e5d974..9f289079 100644 --- a/db/models/fieldseeker.mosquitoinspection.bob.go +++ b/db/models/fieldseeker.mosquitoinspection.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -2118,32 +2117,3 @@ func (os FieldseekerMosquitoinspectionSlice) LoadOrganization(ctx context.Contex 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 0b4b92e8..20e8fd3b 100644 --- a/db/models/fieldseeker.pointlocation.bob.go +++ b/db/models/fieldseeker.pointlocation.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -1785,32 +1784,3 @@ func (os FieldseekerPointlocationSlice) LoadOrganization(ctx context.Context, ex 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 69b142ce..4888e9aa 100644 --- a/db/models/fieldseeker.polygonlocation.bob.go +++ b/db/models/fieldseeker.polygonlocation.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -1728,32 +1727,3 @@ func (os FieldseekerPolygonlocationSlice) LoadOrganization(ctx context.Context, 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 2b4c46db..12b66088 100644 --- a/db/models/fieldseeker.pool.bob.go +++ b/db/models/fieldseeker.pool.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -1364,32 +1363,3 @@ func (os FieldseekerPoolSlice) LoadOrganization(ctx context.Context, exec bob.Ex 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 38b65824..3d4d99ce 100644 --- a/db/models/fieldseeker.pooldetail.bob.go +++ b/db/models/fieldseeker.pooldetail.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -1000,32 +999,3 @@ func (os FieldseekerPooldetailSlice) LoadOrganization(ctx context.Context, exec 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 413a4ebd..49590d71 100644 --- a/db/models/fieldseeker.proposedtreatmentarea.bob.go +++ b/db/models/fieldseeker.proposedtreatmentarea.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -1494,32 +1493,3 @@ func (os FieldseekerProposedtreatmentareaSlice) LoadOrganization(ctx context.Con 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 2f73acba..5c67095f 100644 --- a/db/models/fieldseeker.qamosquitoinspection.bob.go +++ b/db/models/fieldseeker.qamosquitoinspection.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -2248,32 +2247,3 @@ func (os FieldseekerQamosquitoinspectionSlice) LoadOrganization(ctx context.Cont 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 de21bf63..3ee1f579 100644 --- a/db/models/fieldseeker.rodentlocation.bob.go +++ b/db/models/fieldseeker.rodentlocation.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -1416,32 +1415,3 @@ func (os FieldseekerRodentlocationSlice) LoadOrganization(ctx context.Context, e 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 d4bbbb9f..09ec643f 100644 --- a/db/models/fieldseeker.samplecollection.bob.go +++ b/db/models/fieldseeker.samplecollection.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -1832,32 +1831,3 @@ func (os FieldseekerSamplecollectionSlice) LoadOrganization(ctx context.Context, 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 ffa55a24..2455075f 100644 --- a/db/models/fieldseeker.samplelocation.bob.go +++ b/db/models/fieldseeker.samplelocation.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -1260,32 +1259,3 @@ func (os FieldseekerSamplelocationSlice) LoadOrganization(ctx context.Context, e 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 7f736675..79100f59 100644 --- a/db/models/fieldseeker.servicerequest.bob.go +++ b/db/models/fieldseeker.servicerequest.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -2877,32 +2876,3 @@ func (os FieldseekerServicerequestSlice) LoadOrganization(ctx context.Context, e 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 894630a0..0cb7f6f3 100644 --- a/db/models/fieldseeker.speciesabundance.bob.go +++ b/db/models/fieldseeker.speciesabundance.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -1390,32 +1389,3 @@ func (os FieldseekerSpeciesabundanceSlice) LoadOrganization(ctx context.Context, 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 c67451a9..ed21a876 100644 --- a/db/models/fieldseeker.stormdrain.bob.go +++ b/db/models/fieldseeker.stormdrain.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -1130,32 +1129,3 @@ func (os FieldseekerStormdrainSlice) LoadOrganization(ctx context.Context, exec 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 5dfed24a..22480f55 100644 --- a/db/models/fieldseeker.timecard.bob.go +++ b/db/models/fieldseeker.timecard.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -1364,32 +1363,3 @@ func (os FieldseekerTimecardSlice) LoadOrganization(ctx context.Context, exec bo 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 8075cd5b..fa2fc5ed 100644 --- a/db/models/fieldseeker.trapdata.bob.go +++ b/db/models/fieldseeker.trapdata.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -1733,32 +1732,3 @@ func (os FieldseekerTrapdatumSlice) LoadOrganization(ctx context.Context, exec b 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 e6c0a5b9..dc244436 100644 --- a/db/models/fieldseeker.traplocation.bob.go +++ b/db/models/fieldseeker.traplocation.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -1421,32 +1420,3 @@ func (os FieldseekerTraplocationSlice) LoadOrganization(ctx context.Context, exe 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 81f67bbd..e3f9277c 100644 --- a/db/models/fieldseeker.treatment.bob.go +++ b/db/models/fieldseeker.treatment.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -2045,32 +2044,3 @@ func (os FieldseekerTreatmentSlice) LoadOrganization(ctx context.Context, exec b 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 46c42d5a..a9908cf2 100644 --- a/db/models/fieldseeker.treatmentarea.bob.go +++ b/db/models/fieldseeker.treatmentarea.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -1104,32 +1103,3 @@ func (os FieldseekerTreatmentareaSlice) LoadOrganization(ctx context.Context, ex 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 8d2cabad..0a29daa1 100644 --- a/db/models/fieldseeker.zones.bob.go +++ b/db/models/fieldseeker.zones.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -1000,32 +999,3 @@ func (os FieldseekerZoneSlice) LoadOrganization(ctx context.Context, exec bob.Ex 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 18b69253..5d2e0c05 100644 --- a/db/models/fieldseeker.zones2.bob.go +++ b/db/models/fieldseeker.zones2.bob.go @@ -17,7 +17,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types" "github.com/Gleipnir-Technology/bob/types/pgtypes" @@ -974,32 +973,3 @@ func (os FieldseekerZones2Slice) LoadOrganization(ctx context.Context, exec bob. 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 f1cf9e73..2f04fd62 100644 --- a/db/models/fieldseeker_sync.bob.go +++ b/db/models/fieldseeker_sync.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/omit" @@ -672,32 +671,3 @@ func (os FieldseekerSyncSlice) LoadOrganization(ctx context.Context, exec bob.Ex return nil } - -type fieldseekerSyncJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j fieldseekerSyncJoins[Q]) aliasedAs(alias string) fieldseekerSyncJoins[Q] { - return buildFieldseekerSyncJoins[Q](buildFieldseekerSyncColumns(alias), j.typ) -} - -func buildFieldseekerSyncJoins[Q dialect.Joinable](cols fieldseekerSyncColumns, typ string) fieldseekerSyncJoins[Q] { - return fieldseekerSyncJoins[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/fileupload.csv.bob.go b/db/models/fileupload.csv.bob.go index 5b1f151d..e1e60c30 100644 --- a/db/models/fileupload.csv.bob.go +++ b/db/models/fileupload.csv.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -33,8 +32,6 @@ type FileuploadCSV struct { Type enums.FileuploadCsvtype `db:"type_" ` R fileuploadCSVR `db:"-" ` - - C fileuploadCSVC `db:"-" ` } // FileuploadCSVSlice is an alias for a slice of pointers to FileuploadCSV. @@ -983,216 +980,3 @@ func (os FileuploadCSVSlice) LoadCSVFilePools(ctx context.Context, exec bob.Exec return nil } - -// fileuploadCSVC is where relationship counts are stored. -type fileuploadCSVC struct { - CSVFileErrorCSVS *int64 - CSVFilePools *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *FileuploadCSV) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "CSVFileErrorCSVS": - o.C.CSVFileErrorCSVS = &count - case "CSVFilePools": - o.C.CSVFilePools = &count - } - return nil -} - -type fileuploadCSVCountPreloader struct { - CSVFileErrorCSVS func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - CSVFilePools func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildFileuploadCSVCountPreloader() fileuploadCSVCountPreloader { - return fileuploadCSVCountPreloader{ - CSVFileErrorCSVS: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*FileuploadCSV]("CSVFileErrorCSVS", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = FileuploadCSVS.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FileuploadErrorCSVS.Name()), - sm.Where(psql.Quote(FileuploadErrorCSVS.Alias(), "csv_file_id").EQ(psql.Quote(parent, "file_id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - CSVFilePools: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*FileuploadCSV]("CSVFilePools", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = FileuploadCSVS.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FileuploadPools.Name()), - sm.Where(psql.Quote(FileuploadPools.Alias(), "csv_file").EQ(psql.Quote(parent, "file_id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type fileuploadCSVCountThenLoader[Q orm.Loadable] struct { - CSVFileErrorCSVS func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - CSVFilePools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFileuploadCSVCountThenLoader[Q orm.Loadable]() fileuploadCSVCountThenLoader[Q] { - type CSVFileErrorCSVSCountInterface interface { - LoadCountCSVFileErrorCSVS(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type CSVFilePoolsCountInterface interface { - LoadCountCSVFilePools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fileuploadCSVCountThenLoader[Q]{ - CSVFileErrorCSVS: countThenLoadBuilder[Q]( - "CSVFileErrorCSVS", - func(ctx context.Context, exec bob.Executor, retrieved CSVFileErrorCSVSCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountCSVFileErrorCSVS(ctx, exec, mods...) - }, - ), - CSVFilePools: countThenLoadBuilder[Q]( - "CSVFilePools", - func(ctx context.Context, exec bob.Executor, retrieved CSVFilePoolsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountCSVFilePools(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountCSVFileErrorCSVS loads the count of CSVFileErrorCSVS into the C struct -func (o *FileuploadCSV) LoadCountCSVFileErrorCSVS(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.CSVFileErrorCSVS(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.CSVFileErrorCSVS = &count - return nil -} - -// LoadCountCSVFileErrorCSVS loads the count of CSVFileErrorCSVS for a slice -func (os FileuploadCSVSlice) LoadCountCSVFileErrorCSVS(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountCSVFileErrorCSVS(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountCSVFilePools loads the count of CSVFilePools into the C struct -func (o *FileuploadCSV) LoadCountCSVFilePools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.CSVFilePools(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.CSVFilePools = &count - return nil -} - -// LoadCountCSVFilePools loads the count of CSVFilePools for a slice -func (os FileuploadCSVSlice) LoadCountCSVFilePools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountCSVFilePools(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type fileuploadCSVJoins[Q dialect.Joinable] struct { - typ string - File modAs[Q, fileuploadFileColumns] - CSVFileErrorCSVS modAs[Q, fileuploadErrorCSVColumns] - CSVFilePools modAs[Q, fileuploadPoolColumns] -} - -func (j fileuploadCSVJoins[Q]) aliasedAs(alias string) fileuploadCSVJoins[Q] { - return buildFileuploadCSVJoins[Q](buildFileuploadCSVColumns(alias), j.typ) -} - -func buildFileuploadCSVJoins[Q dialect.Joinable](cols fileuploadCSVColumns, typ string) fileuploadCSVJoins[Q] { - return fileuploadCSVJoins[Q]{ - typ: typ, - File: modAs[Q, fileuploadFileColumns]{ - c: FileuploadFiles.Columns, - f: func(to fileuploadFileColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FileuploadFiles.Name().As(to.Alias())).On( - to.ID.EQ(cols.FileID), - )) - } - - return mods - }, - }, - CSVFileErrorCSVS: modAs[Q, fileuploadErrorCSVColumns]{ - c: FileuploadErrorCSVS.Columns, - f: func(to fileuploadErrorCSVColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FileuploadErrorCSVS.Name().As(to.Alias())).On( - to.CSVFileID.EQ(cols.FileID), - )) - } - - return mods - }, - }, - CSVFilePools: modAs[Q, fileuploadPoolColumns]{ - c: FileuploadPools.Columns, - f: func(to fileuploadPoolColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FileuploadPools.Name().As(to.Alias())).On( - to.CSVFile.EQ(cols.FileID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/fileupload.error_csv.bob.go b/db/models/fileupload.error_csv.bob.go index d341a219..2503f35c 100644 --- a/db/models/fileupload.error_csv.bob.go +++ b/db/models/fileupload.error_csv.bob.go @@ -15,7 +15,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/omit" @@ -646,32 +645,3 @@ func (os FileuploadErrorCSVSlice) LoadCSVFileCSV(ctx context.Context, exec bob.E return nil } - -type fileuploadErrorCSVJoins[Q dialect.Joinable] struct { - typ string - CSVFileCSV modAs[Q, fileuploadCSVColumns] -} - -func (j fileuploadErrorCSVJoins[Q]) aliasedAs(alias string) fileuploadErrorCSVJoins[Q] { - return buildFileuploadErrorCSVJoins[Q](buildFileuploadErrorCSVColumns(alias), j.typ) -} - -func buildFileuploadErrorCSVJoins[Q dialect.Joinable](cols fileuploadErrorCSVColumns, typ string) fileuploadErrorCSVJoins[Q] { - return fileuploadErrorCSVJoins[Q]{ - typ: typ, - CSVFileCSV: modAs[Q, fileuploadCSVColumns]{ - c: FileuploadCSVS.Columns, - f: func(to fileuploadCSVColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FileuploadCSVS.Name().As(to.Alias())).On( - to.FileID.EQ(cols.CSVFileID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/fileupload.error_file.bob.go b/db/models/fileupload.error_file.bob.go index d1648eb2..a514169b 100644 --- a/db/models/fileupload.error_file.bob.go +++ b/db/models/fileupload.error_file.bob.go @@ -15,7 +15,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/omit" @@ -596,32 +595,3 @@ func (os FileuploadErrorFileSlice) LoadFile(ctx context.Context, exec bob.Execut return nil } - -type fileuploadErrorFileJoins[Q dialect.Joinable] struct { - typ string - File modAs[Q, fileuploadFileColumns] -} - -func (j fileuploadErrorFileJoins[Q]) aliasedAs(alias string) fileuploadErrorFileJoins[Q] { - return buildFileuploadErrorFileJoins[Q](buildFileuploadErrorFileColumns(alias), j.typ) -} - -func buildFileuploadErrorFileJoins[Q dialect.Joinable](cols fileuploadErrorFileColumns, typ string) fileuploadErrorFileJoins[Q] { - return fileuploadErrorFileJoins[Q]{ - typ: typ, - File: modAs[Q, fileuploadFileColumns]{ - c: FileuploadFiles.Columns, - f: func(to fileuploadFileColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FileuploadFiles.Name().As(to.Alias())).On( - to.ID.EQ(cols.FileID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/fileupload.file.bob.go b/db/models/fileupload.file.bob.go index ebb42ee4..2e0de097 100644 --- a/db/models/fileupload.file.bob.go +++ b/db/models/fileupload.file.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -41,8 +40,6 @@ type FileuploadFile struct { Committer null.Val[int32] `db:"committer" ` R fileuploadFileR `db:"-" ` - - C fileuploadFileC `db:"-" ` } // FileuploadFileSlice is an alias for a slice of pointers to FileuploadFile. @@ -1654,261 +1651,3 @@ func (os FileuploadFileSlice) LoadSites(ctx context.Context, exec bob.Executor, return nil } - -// fileuploadFileC is where relationship counts are stored. -type fileuploadFileC struct { - ErrorFiles *int64 - Sites *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *FileuploadFile) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "ErrorFiles": - o.C.ErrorFiles = &count - case "Sites": - o.C.Sites = &count - } - return nil -} - -type fileuploadFileCountPreloader struct { - ErrorFiles func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Sites func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildFileuploadFileCountPreloader() fileuploadFileCountPreloader { - return fileuploadFileCountPreloader{ - ErrorFiles: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*FileuploadFile]("ErrorFiles", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = FileuploadFiles.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FileuploadErrorFiles.Name()), - sm.Where(psql.Quote(FileuploadErrorFiles.Alias(), "file_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Sites: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*FileuploadFile]("Sites", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = FileuploadFiles.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(Sites.Name()), - sm.Where(psql.Quote(Sites.Alias(), "file_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type fileuploadFileCountThenLoader[Q orm.Loadable] struct { - ErrorFiles func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - Sites func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildFileuploadFileCountThenLoader[Q orm.Loadable]() fileuploadFileCountThenLoader[Q] { - type ErrorFilesCountInterface interface { - LoadCountErrorFiles(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type SitesCountInterface interface { - LoadCountSites(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return fileuploadFileCountThenLoader[Q]{ - ErrorFiles: countThenLoadBuilder[Q]( - "ErrorFiles", - func(ctx context.Context, exec bob.Executor, retrieved ErrorFilesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountErrorFiles(ctx, exec, mods...) - }, - ), - Sites: countThenLoadBuilder[Q]( - "Sites", - func(ctx context.Context, exec bob.Executor, retrieved SitesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountSites(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountErrorFiles loads the count of ErrorFiles into the C struct -func (o *FileuploadFile) LoadCountErrorFiles(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.ErrorFiles(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.ErrorFiles = &count - return nil -} - -// LoadCountErrorFiles loads the count of ErrorFiles for a slice -func (os FileuploadFileSlice) LoadCountErrorFiles(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountErrorFiles(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountSites loads the count of Sites into the C struct -func (o *FileuploadFile) LoadCountSites(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Sites(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Sites = &count - return nil -} - -// LoadCountSites loads the count of Sites for a slice -func (os FileuploadFileSlice) LoadCountSites(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountSites(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type fileuploadFileJoins[Q dialect.Joinable] struct { - typ string - CSV modAs[Q, fileuploadCSVColumns] - ErrorFiles modAs[Q, fileuploadErrorFileColumns] - CommitterUser modAs[Q, userColumns] - CreatorUser modAs[Q, userColumns] - Organization modAs[Q, organizationColumns] - Sites modAs[Q, siteColumns] -} - -func (j fileuploadFileJoins[Q]) aliasedAs(alias string) fileuploadFileJoins[Q] { - return buildFileuploadFileJoins[Q](buildFileuploadFileColumns(alias), j.typ) -} - -func buildFileuploadFileJoins[Q dialect.Joinable](cols fileuploadFileColumns, typ string) fileuploadFileJoins[Q] { - return fileuploadFileJoins[Q]{ - typ: typ, - CSV: modAs[Q, fileuploadCSVColumns]{ - c: FileuploadCSVS.Columns, - f: func(to fileuploadCSVColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FileuploadCSVS.Name().As(to.Alias())).On( - to.FileID.EQ(cols.ID), - )) - } - - return mods - }, - }, - ErrorFiles: modAs[Q, fileuploadErrorFileColumns]{ - c: FileuploadErrorFiles.Columns, - f: func(to fileuploadErrorFileColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FileuploadErrorFiles.Name().As(to.Alias())).On( - to.FileID.EQ(cols.ID), - )) - } - - return mods - }, - }, - CommitterUser: 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.Committer), - )) - } - - return mods - }, - }, - 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 - }, - }, - 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 - }, - }, - Sites: modAs[Q, siteColumns]{ - c: Sites.Columns, - f: func(to siteColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Sites.Name().As(to.Alias())).On( - to.FileID.EQ(cols.ID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/fileupload.pool.bob.go b/db/models/fileupload.pool.bob.go index 0f76ccac..95f38ca4 100644 --- a/db/models/fileupload.pool.bob.go +++ b/db/models/fileupload.pool.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -1589,77 +1588,3 @@ func (os FileuploadPoolSlice) LoadResidentPhoneE164Phone(ctx context.Context, ex return nil } - -type fileuploadPoolJoins[Q dialect.Joinable] struct { - typ string - CreatorUser modAs[Q, userColumns] - CSVFileCSV modAs[Q, fileuploadCSVColumns] - PropertyOwnerPhoneE164Phone modAs[Q, commsPhoneColumns] - ResidentPhoneE164Phone modAs[Q, commsPhoneColumns] -} - -func (j fileuploadPoolJoins[Q]) aliasedAs(alias string) fileuploadPoolJoins[Q] { - return buildFileuploadPoolJoins[Q](buildFileuploadPoolColumns(alias), j.typ) -} - -func buildFileuploadPoolJoins[Q dialect.Joinable](cols fileuploadPoolColumns, typ string) fileuploadPoolJoins[Q] { - return fileuploadPoolJoins[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 - }, - }, - CSVFileCSV: modAs[Q, fileuploadCSVColumns]{ - c: FileuploadCSVS.Columns, - f: func(to fileuploadCSVColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FileuploadCSVS.Name().As(to.Alias())).On( - to.FileID.EQ(cols.CSVFile), - )) - } - - return mods - }, - }, - PropertyOwnerPhoneE164Phone: modAs[Q, commsPhoneColumns]{ - c: CommsPhones.Columns, - f: func(to commsPhoneColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsPhones.Name().As(to.Alias())).On( - to.E164.EQ(cols.PropertyOwnerPhoneE164), - )) - } - - return mods - }, - }, - ResidentPhoneE164Phone: modAs[Q, commsPhoneColumns]{ - c: CommsPhones.Columns, - f: func(to commsPhoneColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsPhones.Name().As(to.Alias())).On( - to.E164.EQ(cols.ResidentPhoneE164), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/h3_aggregation.bob.go b/db/models/h3_aggregation.bob.go index 1de3e34a..091076b2 100644 --- a/db/models/h3_aggregation.bob.go +++ b/db/models/h3_aggregation.bob.go @@ -15,7 +15,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -699,32 +698,3 @@ func (os H3AggregationSlice) LoadOrganization(ctx context.Context, exec bob.Exec return nil } - -type h3AggregationJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] -} - -func (j h3AggregationJoins[Q]) aliasedAs(alias string) h3AggregationJoins[Q] { - return buildH3AggregationJoins[Q](buildH3AggregationColumns(alias), j.typ) -} - -func buildH3AggregationJoins[Q dialect.Joinable](cols h3AggregationColumns, typ string) h3AggregationJoins[Q] { - return h3AggregationJoins[Q]{ - typ: typ, - Organization: modAs[Q, organizationColumns]{ - c: Organizations.Columns, - f: func(to organizationColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Organizations.Name().As(to.Alias())).On( - to.ID.EQ(cols.OrganizationID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/lead.bob.go b/db/models/lead.bob.go index e75cc848..131aba3e 100644 --- a/db/models/lead.bob.go +++ b/db/models/lead.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -36,8 +35,6 @@ type Lead struct { Type enums.Leadtype `db:"type_" ` R leadR `db:"-" ` - - C leadC `db:"-" ` } // LeadSlice is an alias for a slice of pointers to Lead. @@ -1220,170 +1217,3 @@ func (os LeadSlice) LoadSite(ctx context.Context, exec bob.Executor, mods ...bob return nil } - -// leadC is where relationship counts are stored. -type leadC struct { - ComplianceReportRequests *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *Lead) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "ComplianceReportRequests": - o.C.ComplianceReportRequests = &count - } - return nil -} - -type leadCountPreloader struct { - ComplianceReportRequests func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildLeadCountPreloader() leadCountPreloader { - return leadCountPreloader{ - ComplianceReportRequests: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Lead]("ComplianceReportRequests", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Leads.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(ComplianceReportRequests.Name()), - sm.Where(psql.Quote(ComplianceReportRequests.Alias(), "lead_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type leadCountThenLoader[Q orm.Loadable] struct { - ComplianceReportRequests func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildLeadCountThenLoader[Q orm.Loadable]() leadCountThenLoader[Q] { - type ComplianceReportRequestsCountInterface interface { - LoadCountComplianceReportRequests(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return leadCountThenLoader[Q]{ - ComplianceReportRequests: countThenLoadBuilder[Q]( - "ComplianceReportRequests", - func(ctx context.Context, exec bob.Executor, retrieved ComplianceReportRequestsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountComplianceReportRequests(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountComplianceReportRequests loads the count of ComplianceReportRequests into the C struct -func (o *Lead) LoadCountComplianceReportRequests(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.ComplianceReportRequests(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.ComplianceReportRequests = &count - return nil -} - -// LoadCountComplianceReportRequests loads the count of ComplianceReportRequests for a slice -func (os LeadSlice) LoadCountComplianceReportRequests(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountComplianceReportRequests(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type leadJoins[Q dialect.Joinable] struct { - typ string - ComplianceReportRequests modAs[Q, complianceReportRequestColumns] - CreatorUser modAs[Q, userColumns] - Organization modAs[Q, organizationColumns] - Site modAs[Q, siteColumns] -} - -func (j leadJoins[Q]) aliasedAs(alias string) leadJoins[Q] { - return buildLeadJoins[Q](buildLeadColumns(alias), j.typ) -} - -func buildLeadJoins[Q dialect.Joinable](cols leadColumns, typ string) leadJoins[Q] { - return leadJoins[Q]{ - typ: typ, - ComplianceReportRequests: modAs[Q, complianceReportRequestColumns]{ - c: ComplianceReportRequests.Columns, - f: func(to complianceReportRequestColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ComplianceReportRequests.Name().As(to.Alias())).On( - to.LeadID.EQ(cols.ID), - )) - } - - return mods - }, - }, - 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.Creator), - )) - } - - 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 - }, - }, - Site: modAs[Q, siteColumns]{ - c: Sites.Columns, - f: func(to siteColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Sites.Name().As(to.Alias())).On( - to.ID.EQ(cols.SiteID), to.Version.EQ(cols.SiteVersion), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/note_audio.bob.go b/db/models/note_audio.bob.go index 66a9e2a6..c502d998 100644 --- a/db/models/note_audio.bob.go +++ b/db/models/note_audio.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/null" @@ -39,8 +38,6 @@ type NoteAudio struct { UUID uuid.UUID `db:"uuid,pk" ` R noteAudioR `db:"-" ` - - C noteAudioC `db:"-" ` } // NoteAudioSlice is an alias for a slice of pointers to NoteAudio. @@ -1488,248 +1485,3 @@ func (os NoteAudioSlice) LoadNoteAudioData(ctx context.Context, exec bob.Executo return nil } - -// noteAudioC is where relationship counts are stored. -type noteAudioC struct { - NoteAudioBreadcrumbs *int64 - NoteAudioData *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *NoteAudio) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "NoteAudioBreadcrumbs": - o.C.NoteAudioBreadcrumbs = &count - case "NoteAudioData": - o.C.NoteAudioData = &count - } - return nil -} - -type noteAudioCountPreloader struct { - NoteAudioBreadcrumbs func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - NoteAudioData func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildNoteAudioCountPreloader() noteAudioCountPreloader { - return noteAudioCountPreloader{ - NoteAudioBreadcrumbs: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*NoteAudio]("NoteAudioBreadcrumbs", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = NoteAudios.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(NoteAudioBreadcrumbs.Name()), - sm.Where(psql.Quote(NoteAudioBreadcrumbs.Alias(), "note_audio_version").EQ(psql.Quote(parent, "version"))), - sm.Where(psql.Quote(NoteAudioBreadcrumbs.Alias(), "note_audio_uuid").EQ(psql.Quote(parent, "uuid"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - NoteAudioData: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*NoteAudio]("NoteAudioData", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = NoteAudios.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(NoteAudioData.Name()), - sm.Where(psql.Quote(NoteAudioData.Alias(), "note_audio_version").EQ(psql.Quote(parent, "version"))), - sm.Where(psql.Quote(NoteAudioData.Alias(), "note_audio_uuid").EQ(psql.Quote(parent, "uuid"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type noteAudioCountThenLoader[Q orm.Loadable] struct { - NoteAudioBreadcrumbs func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - NoteAudioData func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildNoteAudioCountThenLoader[Q orm.Loadable]() noteAudioCountThenLoader[Q] { - type NoteAudioBreadcrumbsCountInterface interface { - LoadCountNoteAudioBreadcrumbs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type NoteAudioDataCountInterface interface { - LoadCountNoteAudioData(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return noteAudioCountThenLoader[Q]{ - NoteAudioBreadcrumbs: countThenLoadBuilder[Q]( - "NoteAudioBreadcrumbs", - func(ctx context.Context, exec bob.Executor, retrieved NoteAudioBreadcrumbsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountNoteAudioBreadcrumbs(ctx, exec, mods...) - }, - ), - NoteAudioData: countThenLoadBuilder[Q]( - "NoteAudioData", - func(ctx context.Context, exec bob.Executor, retrieved NoteAudioDataCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountNoteAudioData(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountNoteAudioBreadcrumbs loads the count of NoteAudioBreadcrumbs into the C struct -func (o *NoteAudio) LoadCountNoteAudioBreadcrumbs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.NoteAudioBreadcrumbs(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.NoteAudioBreadcrumbs = &count - return nil -} - -// LoadCountNoteAudioBreadcrumbs loads the count of NoteAudioBreadcrumbs for a slice -func (os NoteAudioSlice) LoadCountNoteAudioBreadcrumbs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountNoteAudioBreadcrumbs(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountNoteAudioData loads the count of NoteAudioData into the C struct -func (o *NoteAudio) LoadCountNoteAudioData(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.NoteAudioData(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.NoteAudioData = &count - return nil -} - -// LoadCountNoteAudioData loads the count of NoteAudioData for a slice -func (os NoteAudioSlice) LoadCountNoteAudioData(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountNoteAudioData(ctx, exec, mods...); err != nil { - return err - } - } - - 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 index c25e40b8..b5c4f0fd 100644 --- a/db/models/note_audio_breadcrumb.bob.go +++ b/db/models/note_audio_breadcrumb.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/omit" @@ -700,32 +699,3 @@ func (os NoteAudioBreadcrumbSlice) LoadNoteAudio(ctx context.Context, exec bob.E 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 index d1304e38..caecc642 100644 --- a/db/models/note_audio_data.bob.go +++ b/db/models/note_audio_data.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -651,32 +650,3 @@ func (os NoteAudioDatumSlice) LoadNoteAudio(ctx context.Context, exec bob.Execut 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 index 2185c6e9..31952424 100644 --- a/db/models/note_image.bob.go +++ b/db/models/note_image.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/null" @@ -36,8 +35,6 @@ type NoteImage struct { UUID uuid.UUID `db:"uuid,pk" ` R noteImageR `db:"-" ` - - C noteImageC `db:"-" ` } // NoteImageSlice is an alias for a slice of pointers to NoteImage. @@ -1413,248 +1410,3 @@ func (os NoteImageSlice) LoadNoteImageData(ctx context.Context, exec bob.Executo return nil } - -// noteImageC is where relationship counts are stored. -type noteImageC struct { - NoteImageBreadcrumbs *int64 - NoteImageData *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *NoteImage) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "NoteImageBreadcrumbs": - o.C.NoteImageBreadcrumbs = &count - case "NoteImageData": - o.C.NoteImageData = &count - } - return nil -} - -type noteImageCountPreloader struct { - NoteImageBreadcrumbs func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - NoteImageData func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildNoteImageCountPreloader() noteImageCountPreloader { - return noteImageCountPreloader{ - NoteImageBreadcrumbs: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*NoteImage]("NoteImageBreadcrumbs", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = NoteImages.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(NoteImageBreadcrumbs.Name()), - sm.Where(psql.Quote(NoteImageBreadcrumbs.Alias(), "note_image_version").EQ(psql.Quote(parent, "version"))), - sm.Where(psql.Quote(NoteImageBreadcrumbs.Alias(), "note_image_uuid").EQ(psql.Quote(parent, "uuid"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - NoteImageData: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*NoteImage]("NoteImageData", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = NoteImages.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(NoteImageData.Name()), - sm.Where(psql.Quote(NoteImageData.Alias(), "note_image_version").EQ(psql.Quote(parent, "version"))), - sm.Where(psql.Quote(NoteImageData.Alias(), "note_image_uuid").EQ(psql.Quote(parent, "uuid"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type noteImageCountThenLoader[Q orm.Loadable] struct { - NoteImageBreadcrumbs func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - NoteImageData func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildNoteImageCountThenLoader[Q orm.Loadable]() noteImageCountThenLoader[Q] { - type NoteImageBreadcrumbsCountInterface interface { - LoadCountNoteImageBreadcrumbs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type NoteImageDataCountInterface interface { - LoadCountNoteImageData(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return noteImageCountThenLoader[Q]{ - NoteImageBreadcrumbs: countThenLoadBuilder[Q]( - "NoteImageBreadcrumbs", - func(ctx context.Context, exec bob.Executor, retrieved NoteImageBreadcrumbsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountNoteImageBreadcrumbs(ctx, exec, mods...) - }, - ), - NoteImageData: countThenLoadBuilder[Q]( - "NoteImageData", - func(ctx context.Context, exec bob.Executor, retrieved NoteImageDataCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountNoteImageData(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountNoteImageBreadcrumbs loads the count of NoteImageBreadcrumbs into the C struct -func (o *NoteImage) LoadCountNoteImageBreadcrumbs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.NoteImageBreadcrumbs(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.NoteImageBreadcrumbs = &count - return nil -} - -// LoadCountNoteImageBreadcrumbs loads the count of NoteImageBreadcrumbs for a slice -func (os NoteImageSlice) LoadCountNoteImageBreadcrumbs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountNoteImageBreadcrumbs(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountNoteImageData loads the count of NoteImageData into the C struct -func (o *NoteImage) LoadCountNoteImageData(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.NoteImageData(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.NoteImageData = &count - return nil -} - -// LoadCountNoteImageData loads the count of NoteImageData for a slice -func (os NoteImageSlice) LoadCountNoteImageData(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountNoteImageData(ctx, exec, mods...); err != nil { - return err - } - } - - 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 index 2cfc2f79..e6922810 100644 --- a/db/models/note_image_breadcrumb.bob.go +++ b/db/models/note_image_breadcrumb.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/omit" @@ -700,32 +699,3 @@ func (os NoteImageBreadcrumbSlice) LoadNoteImage(ctx context.Context, exec bob.E 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 index 8bac0d0a..6a3e1d42 100644 --- a/db/models/note_image_data.bob.go +++ b/db/models/note_image_data.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -651,32 +650,3 @@ func (os NoteImageDatumSlice) LoadNoteImage(ctx context.Context, exec bob.Execut 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 b2166395..18b74a34 100644 --- a/db/models/notification.bob.go +++ b/db/models/notification.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -700,32 +699,3 @@ func (os NotificationSlice) LoadUserUser(ctx context.Context, exec bob.Executor, return nil } - -type notificationJoins[Q dialect.Joinable] struct { - typ string - UserUser modAs[Q, userColumns] -} - -func (j notificationJoins[Q]) aliasedAs(alias string) notificationJoins[Q] { - return buildNotificationJoins[Q](buildNotificationColumns(alias), j.typ) -} - -func buildNotificationJoins[Q dialect.Joinable](cols notificationColumns, typ string) notificationJoins[Q] { - return notificationJoins[Q]{ - typ: typ, - UserUser: 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.UserID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/organization.bob.go b/db/models/organization.bob.go index 74b5cdae..83ec3389 100644 --- a/db/models/organization.bob.go +++ b/db/models/organization.bob.go @@ -7,7 +7,6 @@ import ( "context" "fmt" "io" - "strconv" "github.com/Gleipnir-Technology/bob" "github.com/Gleipnir-Technology/bob/dialect/psql" @@ -16,7 +15,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/null" @@ -63,8 +61,6 @@ type Organization struct { FieldseekerServiceFeatureItemID null.Val[string] `db:"fieldseeker_service_feature_item_id" ` R organizationR `db:"-" ` - - C organizationC `db:"-" ` } // OrganizationSlice is an alias for a slice of pointers to Organization. @@ -84,6 +80,7 @@ type organizationR struct { ParcelMappings ArcgisParcelMappingSlice // arcgis.parcel_mapping.parcel_mapping_organization_id_fkey EmailContacts CommsEmailContactSlice // district_subscription_email.district_subscription_email_email_contact_address_fkeydistrict_subscription_email.district_subscription_email_organization_id_fkey Phones CommsPhoneSlice // district_subscription_phone.district_subscription_phone_organization_id_fkeydistrict_subscription_phone.district_subscription_phone_phone_e164_fkey + Features FeatureSlice // feature.feature_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 @@ -122,6 +119,7 @@ type organizationR struct { Nuisances PublicreportNuisanceSlice // publicreport.nuisance.nuisance_organization_id_fkey PublicreportPool PublicreportPoolSlice // publicreport.pool.pool_organization_id_fkey Quicks PublicreportQuickSlice // publicreport.quick.quick_organization_id_fkey + ReviewTasks ReviewTaskSlice // review_task.review_task_organization_id_fkey Signals SignalSlice // signal.signal_organization_id_fkey User UserSlice // user_.user__organization_id_fkey } @@ -1040,6 +1038,30 @@ func (os OrganizationSlice) Phones(mods ...bob.Mod[*dialect.SelectQuery]) CommsP )...) } +// Features starts a query for related objects on feature +func (o *Organization) Features(mods ...bob.Mod[*dialect.SelectQuery]) FeaturesQuery { + return Features.Query(append(mods, + sm.Where(Features.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) Features(mods ...bob.Mod[*dialect.SelectQuery]) FeaturesQuery { + 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 Features.Query(append(mods, + sm.Where(psql.Group(Features.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + // 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, @@ -1952,6 +1974,30 @@ func (os OrganizationSlice) Quicks(mods ...bob.Mod[*dialect.SelectQuery]) Public )...) } +// ReviewTasks starts a query for related objects on review_task +func (o *Organization) ReviewTasks(mods ...bob.Mod[*dialect.SelectQuery]) ReviewTasksQuery { + return ReviewTasks.Query(append(mods, + sm.Where(ReviewTasks.Columns.OrganizationID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os OrganizationSlice) ReviewTasks(mods ...bob.Mod[*dialect.SelectQuery]) ReviewTasksQuery { + 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 ReviewTasks.Query(append(mods, + sm.Where(psql.Group(ReviewTasks.Columns.OrganizationID).OP("IN", PKArgExpr)), + )...) +} + // Signals starts a query for related objects on signal func (o *Organization) Signals(mods ...bob.Mod[*dialect.SelectQuery]) SignalsQuery { return Signals.Query(append(mods, @@ -2334,6 +2380,74 @@ func (organization0 *Organization) AttachPhones(ctx context.Context, exec bob.Ex return nil } +func insertOrganizationFeatures0(ctx context.Context, exec bob.Executor, features1 []*FeatureSetter, organization0 *Organization) (FeatureSlice, error) { + for i := range features1 { + features1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := Features.Insert(bob.ToMods(features1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationFeatures0: %w", err) + } + + return ret, nil +} + +func attachOrganizationFeatures0(ctx context.Context, exec bob.Executor, count int, features1 FeatureSlice, organization0 *Organization) (FeatureSlice, error) { + setter := &FeatureSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := features1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationFeatures0: %w", err) + } + + return features1, nil +} + +func (organization0 *Organization) InsertFeatures(ctx context.Context, exec bob.Executor, related ...*FeatureSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + features1, err := insertOrganizationFeatures0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.Features = append(organization0.R.Features, features1...) + + for _, rel := range features1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachFeatures(ctx context.Context, exec bob.Executor, related ...*Feature) error { + if len(related) == 0 { + return nil + } + + var err error + features1 := FeatureSlice(related) + + _, err = attachOrganizationFeatures0(ctx, exec, len(related), features1, organization0) + if err != nil { + return err + } + + organization0.R.Features = append(organization0.R.Features, features1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + 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) @@ -4878,6 +4992,74 @@ func (organization0 *Organization) AttachQuicks(ctx context.Context, exec bob.Ex return nil } +func insertOrganizationReviewTasks0(ctx context.Context, exec bob.Executor, reviewTasks1 []*ReviewTaskSetter, organization0 *Organization) (ReviewTaskSlice, error) { + for i := range reviewTasks1 { + reviewTasks1[i].OrganizationID = omit.From(organization0.ID) + } + + ret, err := ReviewTasks.Insert(bob.ToMods(reviewTasks1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertOrganizationReviewTasks0: %w", err) + } + + return ret, nil +} + +func attachOrganizationReviewTasks0(ctx context.Context, exec bob.Executor, count int, reviewTasks1 ReviewTaskSlice, organization0 *Organization) (ReviewTaskSlice, error) { + setter := &ReviewTaskSetter{ + OrganizationID: omit.From(organization0.ID), + } + + err := reviewTasks1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachOrganizationReviewTasks0: %w", err) + } + + return reviewTasks1, nil +} + +func (organization0 *Organization) InsertReviewTasks(ctx context.Context, exec bob.Executor, related ...*ReviewTaskSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + reviewTasks1, err := insertOrganizationReviewTasks0(ctx, exec, related, organization0) + if err != nil { + return err + } + + organization0.R.ReviewTasks = append(organization0.R.ReviewTasks, reviewTasks1...) + + for _, rel := range reviewTasks1 { + rel.R.Organization = organization0 + } + return nil +} + +func (organization0 *Organization) AttachReviewTasks(ctx context.Context, exec bob.Executor, related ...*ReviewTask) error { + if len(related) == 0 { + return nil + } + + var err error + reviewTasks1 := ReviewTaskSlice(related) + + _, err = attachOrganizationReviewTasks0(ctx, exec, len(related), reviewTasks1, organization0) + if err != nil { + return err + } + + organization0.R.ReviewTasks = append(organization0.R.ReviewTasks, reviewTasks1...) + + for _, rel := range related { + rel.R.Organization = organization0 + } + + return nil +} + func insertOrganizationSignals0(ctx context.Context, exec bob.Executor, signals1 []*SignalSetter, organization0 *Organization) (SignalSlice, error) { for i := range signals1 { signals1[i].OrganizationID = omit.From(organization0.ID) @@ -5166,6 +5348,20 @@ func (o *Organization) Preload(name string, retrieved any) error { } } return nil + case "Features": + rels, ok := retrieved.(FeatureSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.Features = rels + + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil case "Containerrelates": rels, ok := retrieved.(FieldseekerContainerrelateSlice) if !ok { @@ -5688,6 +5884,20 @@ func (o *Organization) Preload(name string, retrieved any) error { o.R.Quicks = rels + for _, rel := range rels { + if rel != nil { + rel.R.Organization = o + } + } + return nil + case "ReviewTasks": + rels, ok := retrieved.(ReviewTaskSlice) + if !ok { + return fmt.Errorf("organization cannot load %T as %q", retrieved, name) + } + + o.R.ReviewTasks = rels + for _, rel := range rels { if rel != nil { rel.R.Organization = o @@ -5769,6 +5979,7 @@ type organizationThenLoader[Q orm.Loadable] struct { ParcelMappings func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] EmailContacts func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] Phones func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Features 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] @@ -5807,6 +6018,7 @@ type organizationThenLoader[Q orm.Loadable] struct { Nuisances func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] PublicreportPool func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] Quicks func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + ReviewTasks func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] Signals func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] User func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] } @@ -5827,6 +6039,9 @@ func buildOrganizationThenLoader[Q orm.Loadable]() organizationThenLoader[Q] { type PhonesLoadInterface interface { LoadPhones(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } + type FeaturesLoadInterface interface { + LoadFeatures(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } type ContainerrelatesLoadInterface interface { LoadContainerrelates(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } @@ -5941,6 +6156,9 @@ func buildOrganizationThenLoader[Q orm.Loadable]() organizationThenLoader[Q] { type QuicksLoadInterface interface { LoadQuicks(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } + type ReviewTasksLoadInterface interface { + LoadReviewTasks(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } type SignalsLoadInterface interface { LoadSignals(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } @@ -5979,6 +6197,12 @@ func buildOrganizationThenLoader[Q orm.Loadable]() organizationThenLoader[Q] { return retrieved.LoadPhones(ctx, exec, mods...) }, ), + Features: thenLoadBuilder[Q]( + "Features", + func(ctx context.Context, exec bob.Executor, retrieved FeaturesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFeatures(ctx, exec, mods...) + }, + ), Containerrelates: thenLoadBuilder[Q]( "Containerrelates", func(ctx context.Context, exec bob.Executor, retrieved ContainerrelatesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { @@ -6207,6 +6431,12 @@ func buildOrganizationThenLoader[Q orm.Loadable]() organizationThenLoader[Q] { return retrieved.LoadQuicks(ctx, exec, mods...) }, ), + ReviewTasks: thenLoadBuilder[Q]( + "ReviewTasks", + func(ctx context.Context, exec bob.Executor, retrieved ReviewTasksLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadReviewTasks(ctx, exec, mods...) + }, + ), Signals: thenLoadBuilder[Q]( "Signals", func(ctx context.Context, exec bob.Executor, retrieved SignalsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { @@ -6567,6 +6797,67 @@ func (os OrganizationSlice) LoadPhones(ctx context.Context, exec bob.Executor, m return nil } +// LoadFeatures loads the organization's Features into the .R struct +func (o *Organization) LoadFeatures(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Features = nil + + related, err := o.Features(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.Features = related + return nil +} + +// LoadFeatures loads the organization's Features into the .R struct +func (os OrganizationSlice) LoadFeatures(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + features, err := os.Features(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Features = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range features { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.Features = append(o.R.Features, rel) + } + } + + return nil +} + // 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 { @@ -8882,6 +9173,67 @@ func (os OrganizationSlice) LoadQuicks(ctx context.Context, exec bob.Executor, m return nil } +// LoadReviewTasks loads the organization's ReviewTasks into the .R struct +func (o *Organization) LoadReviewTasks(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.ReviewTasks = nil + + related, err := o.ReviewTasks(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Organization = o + } + + o.R.ReviewTasks = related + return nil +} + +// LoadReviewTasks loads the organization's ReviewTasks into the .R struct +func (os OrganizationSlice) LoadReviewTasks(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + reviewTasks, err := os.ReviewTasks(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.ReviewTasks = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range reviewTasks { + + if !(o.ID == rel.OrganizationID) { + continue + } + + rel.R.Organization = o + + o.R.ReviewTasks = append(o.R.ReviewTasks, rel) + } + } + + return nil +} + // LoadSignals loads the organization's Signals into the .R struct func (o *Organization) LoadSignals(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { @@ -9003,3369 +9355,3 @@ func (os OrganizationSlice) LoadUser(ctx context.Context, exec bob.Executor, mod return nil } - -// organizationC is where relationship counts are stored. -type organizationC struct { - Accounts *int64 - AddressMappings *int64 - ParcelMappings *int64 - EmailContacts *int64 - Phones *int64 - Containerrelates *int64 - Fieldscoutinglogs *int64 - Habitatrelates *int64 - Inspectionsamples *int64 - Inspectionsampledetails *int64 - Linelocations *int64 - Locationtrackings *int64 - Mosquitoinspections *int64 - Pointlocations *int64 - Polygonlocations *int64 - FieldseekerPool *int64 - Pooldetails *int64 - Proposedtreatmentareas *int64 - Qamosquitoinspections *int64 - Rodentlocations *int64 - Samplecollections *int64 - Samplelocations *int64 - Servicerequests *int64 - Speciesabundances *int64 - Stormdrains *int64 - Timecards *int64 - Trapdata *int64 - Traplocations *int64 - Treatments *int64 - Treatmentareas *int64 - Zones *int64 - Zones2s *int64 - FieldseekerSyncs *int64 - Files *int64 - H3Aggregations *int64 - Leads *int64 - NoteAudios *int64 - NoteImages *int64 - Nuisances *int64 - PublicreportPool *int64 - Quicks *int64 - Signals *int64 - User *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *Organization) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "Accounts": - o.C.Accounts = &count - case "AddressMappings": - o.C.AddressMappings = &count - case "ParcelMappings": - o.C.ParcelMappings = &count - case "EmailContacts": - o.C.EmailContacts = &count - case "Phones": - o.C.Phones = &count - case "Containerrelates": - o.C.Containerrelates = &count - case "Fieldscoutinglogs": - o.C.Fieldscoutinglogs = &count - case "Habitatrelates": - o.C.Habitatrelates = &count - case "Inspectionsamples": - o.C.Inspectionsamples = &count - case "Inspectionsampledetails": - o.C.Inspectionsampledetails = &count - case "Linelocations": - o.C.Linelocations = &count - case "Locationtrackings": - o.C.Locationtrackings = &count - case "Mosquitoinspections": - o.C.Mosquitoinspections = &count - case "Pointlocations": - o.C.Pointlocations = &count - case "Polygonlocations": - o.C.Polygonlocations = &count - case "FieldseekerPool": - o.C.FieldseekerPool = &count - case "Pooldetails": - o.C.Pooldetails = &count - case "Proposedtreatmentareas": - o.C.Proposedtreatmentareas = &count - case "Qamosquitoinspections": - o.C.Qamosquitoinspections = &count - case "Rodentlocations": - o.C.Rodentlocations = &count - case "Samplecollections": - o.C.Samplecollections = &count - case "Samplelocations": - o.C.Samplelocations = &count - case "Servicerequests": - o.C.Servicerequests = &count - case "Speciesabundances": - o.C.Speciesabundances = &count - case "Stormdrains": - o.C.Stormdrains = &count - case "Timecards": - o.C.Timecards = &count - case "Trapdata": - o.C.Trapdata = &count - case "Traplocations": - o.C.Traplocations = &count - case "Treatments": - o.C.Treatments = &count - case "Treatmentareas": - o.C.Treatmentareas = &count - case "Zones": - o.C.Zones = &count - case "Zones2s": - o.C.Zones2s = &count - case "FieldseekerSyncs": - o.C.FieldseekerSyncs = &count - case "Files": - o.C.Files = &count - case "H3Aggregations": - o.C.H3Aggregations = &count - case "Leads": - o.C.Leads = &count - case "NoteAudios": - o.C.NoteAudios = &count - case "NoteImages": - o.C.NoteImages = &count - case "Nuisances": - o.C.Nuisances = &count - case "PublicreportPool": - o.C.PublicreportPool = &count - case "Quicks": - o.C.Quicks = &count - case "Signals": - o.C.Signals = &count - case "User": - o.C.User = &count - } - return nil -} - -type organizationCountPreloader struct { - Accounts func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - AddressMappings func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - ParcelMappings func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - EmailContacts func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Phones func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Containerrelates func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Fieldscoutinglogs func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Habitatrelates func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Inspectionsamples func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Inspectionsampledetails func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Linelocations func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Locationtrackings func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Mosquitoinspections func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Pointlocations func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Polygonlocations func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - FieldseekerPool func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Pooldetails func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Proposedtreatmentareas func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Qamosquitoinspections func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Rodentlocations func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Samplecollections func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Samplelocations func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Servicerequests func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Speciesabundances func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Stormdrains func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Timecards func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Trapdata func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Traplocations func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Treatments func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Treatmentareas func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Zones func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Zones2s func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - FieldseekerSyncs func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Files func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - H3Aggregations func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Leads func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - NoteAudios func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - NoteImages func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Nuisances func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - PublicreportPool func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Quicks func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Signals func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - User func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildOrganizationCountPreloader() organizationCountPreloader { - return organizationCountPreloader{ - Accounts: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Accounts", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(ArcgisAccounts.Name()), - sm.Where(psql.Quote(ArcgisAccounts.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - AddressMappings: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("AddressMappings", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(ArcgisAddressMappings.Name()), - sm.Where(psql.Quote(ArcgisAddressMappings.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - ParcelMappings: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("ParcelMappings", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(ArcgisParcelMappings.Name()), - sm.Where(psql.Quote(ArcgisParcelMappings.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - EmailContacts: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("EmailContacts", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(DistrictSubscriptionEmails.Name()), - sm.Where(psql.Quote(DistrictSubscriptionEmails.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - sm.InnerJoin(CommsEmailContacts.Name()).On( - psql.Quote(CommsEmailContacts.Alias(), "address").EQ(psql.Quote(DistrictSubscriptionEmails.Alias(), "email_contact_address")), - ), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Phones: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Phones", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(DistrictSubscriptionPhones.Name()), - sm.Where(psql.Quote(DistrictSubscriptionPhones.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - sm.InnerJoin(CommsPhones.Name()).On( - psql.Quote(CommsPhones.Alias(), "e164").EQ(psql.Quote(DistrictSubscriptionPhones.Alias(), "phone_e164")), - ), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Containerrelates: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Containerrelates", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerContainerrelates.Name()), - sm.Where(psql.Quote(FieldseekerContainerrelates.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Fieldscoutinglogs: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Fieldscoutinglogs", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerFieldscoutinglogs.Name()), - sm.Where(psql.Quote(FieldseekerFieldscoutinglogs.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Habitatrelates: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Habitatrelates", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerHabitatrelates.Name()), - sm.Where(psql.Quote(FieldseekerHabitatrelates.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Inspectionsamples: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Inspectionsamples", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerInspectionsamples.Name()), - sm.Where(psql.Quote(FieldseekerInspectionsamples.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Inspectionsampledetails: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Inspectionsampledetails", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerInspectionsampledetails.Name()), - sm.Where(psql.Quote(FieldseekerInspectionsampledetails.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Linelocations: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Linelocations", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerLinelocations.Name()), - sm.Where(psql.Quote(FieldseekerLinelocations.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Locationtrackings: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Locationtrackings", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerLocationtrackings.Name()), - sm.Where(psql.Quote(FieldseekerLocationtrackings.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Mosquitoinspections: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Mosquitoinspections", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerMosquitoinspections.Name()), - sm.Where(psql.Quote(FieldseekerMosquitoinspections.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Pointlocations: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Pointlocations", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerPointlocations.Name()), - sm.Where(psql.Quote(FieldseekerPointlocations.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Polygonlocations: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Polygonlocations", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerPolygonlocations.Name()), - sm.Where(psql.Quote(FieldseekerPolygonlocations.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - FieldseekerPool: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("FieldseekerPool", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerPools.Name()), - sm.Where(psql.Quote(FieldseekerPools.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Pooldetails: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Pooldetails", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerPooldetails.Name()), - sm.Where(psql.Quote(FieldseekerPooldetails.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Proposedtreatmentareas: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Proposedtreatmentareas", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerProposedtreatmentareas.Name()), - sm.Where(psql.Quote(FieldseekerProposedtreatmentareas.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Qamosquitoinspections: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Qamosquitoinspections", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerQamosquitoinspections.Name()), - sm.Where(psql.Quote(FieldseekerQamosquitoinspections.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Rodentlocations: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Rodentlocations", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerRodentlocations.Name()), - sm.Where(psql.Quote(FieldseekerRodentlocations.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Samplecollections: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Samplecollections", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerSamplecollections.Name()), - sm.Where(psql.Quote(FieldseekerSamplecollections.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Samplelocations: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Samplelocations", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerSamplelocations.Name()), - sm.Where(psql.Quote(FieldseekerSamplelocations.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Servicerequests: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Servicerequests", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerServicerequests.Name()), - sm.Where(psql.Quote(FieldseekerServicerequests.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Speciesabundances: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Speciesabundances", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerSpeciesabundances.Name()), - sm.Where(psql.Quote(FieldseekerSpeciesabundances.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Stormdrains: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Stormdrains", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerStormdrains.Name()), - sm.Where(psql.Quote(FieldseekerStormdrains.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Timecards: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Timecards", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerTimecards.Name()), - sm.Where(psql.Quote(FieldseekerTimecards.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Trapdata: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Trapdata", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerTrapdata.Name()), - sm.Where(psql.Quote(FieldseekerTrapdata.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Traplocations: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Traplocations", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerTraplocations.Name()), - sm.Where(psql.Quote(FieldseekerTraplocations.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Treatments: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Treatments", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerTreatments.Name()), - sm.Where(psql.Quote(FieldseekerTreatments.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Treatmentareas: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Treatmentareas", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerTreatmentareas.Name()), - sm.Where(psql.Quote(FieldseekerTreatmentareas.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Zones: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Zones", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerZones.Name()), - sm.Where(psql.Quote(FieldseekerZones.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Zones2s: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Zones2s", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerZones2s.Name()), - sm.Where(psql.Quote(FieldseekerZones2s.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - FieldseekerSyncs: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("FieldseekerSyncs", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FieldseekerSyncs.Name()), - sm.Where(psql.Quote(FieldseekerSyncs.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Files: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Files", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FileuploadFiles.Name()), - sm.Where(psql.Quote(FileuploadFiles.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - H3Aggregations: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("H3Aggregations", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(H3Aggregations.Name()), - sm.Where(psql.Quote(H3Aggregations.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Leads: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Leads", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(Leads.Name()), - sm.Where(psql.Quote(Leads.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - NoteAudios: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("NoteAudios", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(NoteAudios.Name()), - sm.Where(psql.Quote(NoteAudios.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - NoteImages: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("NoteImages", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(NoteImages.Name()), - sm.Where(psql.Quote(NoteImages.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Nuisances: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Nuisances", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(PublicreportNuisances.Name()), - sm.Where(psql.Quote(PublicreportNuisances.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - PublicreportPool: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("PublicreportPool", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(PublicreportPools.Name()), - sm.Where(psql.Quote(PublicreportPools.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Quicks: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Quicks", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(PublicreportQuicks.Name()), - sm.Where(psql.Quote(PublicreportQuicks.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Signals: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("Signals", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(Signals.Name()), - sm.Where(psql.Quote(Signals.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - User: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Organization]("User", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Organizations.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(Users.Name()), - sm.Where(psql.Quote(Users.Alias(), "organization_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type organizationCountThenLoader[Q orm.Loadable] struct { - Accounts func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - AddressMappings func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - ParcelMappings func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - EmailContacts func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - Phones 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] - FieldseekerPool 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] - Files func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - H3Aggregations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - Leads 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] - Nuisances func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - PublicreportPool func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - Quicks func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - Signals func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - User func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildOrganizationCountThenLoader[Q orm.Loadable]() organizationCountThenLoader[Q] { - type AccountsCountInterface interface { - LoadCountAccounts(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type AddressMappingsCountInterface interface { - LoadCountAddressMappings(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type ParcelMappingsCountInterface interface { - LoadCountParcelMappings(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type EmailContactsCountInterface interface { - LoadCountEmailContacts(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type PhonesCountInterface interface { - LoadCountPhones(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type ContainerrelatesCountInterface interface { - LoadCountContainerrelates(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FieldscoutinglogsCountInterface interface { - LoadCountFieldscoutinglogs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type HabitatrelatesCountInterface interface { - LoadCountHabitatrelates(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type InspectionsamplesCountInterface interface { - LoadCountInspectionsamples(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type InspectionsampledetailsCountInterface interface { - LoadCountInspectionsampledetails(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type LinelocationsCountInterface interface { - LoadCountLinelocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type LocationtrackingsCountInterface interface { - LoadCountLocationtrackings(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type MosquitoinspectionsCountInterface interface { - LoadCountMosquitoinspections(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type PointlocationsCountInterface interface { - LoadCountPointlocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type PolygonlocationsCountInterface interface { - LoadCountPolygonlocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FieldseekerPoolCountInterface interface { - LoadCountFieldseekerPool(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type PooldetailsCountInterface interface { - LoadCountPooldetails(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type ProposedtreatmentareasCountInterface interface { - LoadCountProposedtreatmentareas(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type QamosquitoinspectionsCountInterface interface { - LoadCountQamosquitoinspections(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type RodentlocationsCountInterface interface { - LoadCountRodentlocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type SamplecollectionsCountInterface interface { - LoadCountSamplecollections(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type SamplelocationsCountInterface interface { - LoadCountSamplelocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type ServicerequestsCountInterface interface { - LoadCountServicerequests(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type SpeciesabundancesCountInterface interface { - LoadCountSpeciesabundances(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type StormdrainsCountInterface interface { - LoadCountStormdrains(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type TimecardsCountInterface interface { - LoadCountTimecards(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type TrapdataCountInterface interface { - LoadCountTrapdata(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type TraplocationsCountInterface interface { - LoadCountTraplocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type TreatmentsCountInterface interface { - LoadCountTreatments(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type TreatmentareasCountInterface interface { - LoadCountTreatmentareas(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type ZonesCountInterface interface { - LoadCountZones(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type Zones2sCountInterface interface { - LoadCountZones2s(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FieldseekerSyncsCountInterface interface { - LoadCountFieldseekerSyncs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FilesCountInterface interface { - LoadCountFiles(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type H3AggregationsCountInterface interface { - LoadCountH3Aggregations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type LeadsCountInterface interface { - LoadCountLeads(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type NoteAudiosCountInterface interface { - LoadCountNoteAudios(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type NoteImagesCountInterface interface { - LoadCountNoteImages(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type NuisancesCountInterface interface { - LoadCountNuisances(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type PublicreportPoolCountInterface interface { - LoadCountPublicreportPool(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type QuicksCountInterface interface { - LoadCountQuicks(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type SignalsCountInterface interface { - LoadCountSignals(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type UserCountInterface interface { - LoadCountUser(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return organizationCountThenLoader[Q]{ - Accounts: countThenLoadBuilder[Q]( - "Accounts", - func(ctx context.Context, exec bob.Executor, retrieved AccountsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountAccounts(ctx, exec, mods...) - }, - ), - AddressMappings: countThenLoadBuilder[Q]( - "AddressMappings", - func(ctx context.Context, exec bob.Executor, retrieved AddressMappingsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountAddressMappings(ctx, exec, mods...) - }, - ), - ParcelMappings: countThenLoadBuilder[Q]( - "ParcelMappings", - func(ctx context.Context, exec bob.Executor, retrieved ParcelMappingsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountParcelMappings(ctx, exec, mods...) - }, - ), - EmailContacts: countThenLoadBuilder[Q]( - "EmailContacts", - func(ctx context.Context, exec bob.Executor, retrieved EmailContactsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountEmailContacts(ctx, exec, mods...) - }, - ), - Phones: countThenLoadBuilder[Q]( - "Phones", - func(ctx context.Context, exec bob.Executor, retrieved PhonesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountPhones(ctx, exec, mods...) - }, - ), - Containerrelates: countThenLoadBuilder[Q]( - "Containerrelates", - func(ctx context.Context, exec bob.Executor, retrieved ContainerrelatesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountContainerrelates(ctx, exec, mods...) - }, - ), - Fieldscoutinglogs: countThenLoadBuilder[Q]( - "Fieldscoutinglogs", - func(ctx context.Context, exec bob.Executor, retrieved FieldscoutinglogsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountFieldscoutinglogs(ctx, exec, mods...) - }, - ), - Habitatrelates: countThenLoadBuilder[Q]( - "Habitatrelates", - func(ctx context.Context, exec bob.Executor, retrieved HabitatrelatesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountHabitatrelates(ctx, exec, mods...) - }, - ), - Inspectionsamples: countThenLoadBuilder[Q]( - "Inspectionsamples", - func(ctx context.Context, exec bob.Executor, retrieved InspectionsamplesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountInspectionsamples(ctx, exec, mods...) - }, - ), - Inspectionsampledetails: countThenLoadBuilder[Q]( - "Inspectionsampledetails", - func(ctx context.Context, exec bob.Executor, retrieved InspectionsampledetailsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountInspectionsampledetails(ctx, exec, mods...) - }, - ), - Linelocations: countThenLoadBuilder[Q]( - "Linelocations", - func(ctx context.Context, exec bob.Executor, retrieved LinelocationsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountLinelocations(ctx, exec, mods...) - }, - ), - Locationtrackings: countThenLoadBuilder[Q]( - "Locationtrackings", - func(ctx context.Context, exec bob.Executor, retrieved LocationtrackingsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountLocationtrackings(ctx, exec, mods...) - }, - ), - Mosquitoinspections: countThenLoadBuilder[Q]( - "Mosquitoinspections", - func(ctx context.Context, exec bob.Executor, retrieved MosquitoinspectionsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountMosquitoinspections(ctx, exec, mods...) - }, - ), - Pointlocations: countThenLoadBuilder[Q]( - "Pointlocations", - func(ctx context.Context, exec bob.Executor, retrieved PointlocationsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountPointlocations(ctx, exec, mods...) - }, - ), - Polygonlocations: countThenLoadBuilder[Q]( - "Polygonlocations", - func(ctx context.Context, exec bob.Executor, retrieved PolygonlocationsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountPolygonlocations(ctx, exec, mods...) - }, - ), - FieldseekerPool: countThenLoadBuilder[Q]( - "FieldseekerPool", - func(ctx context.Context, exec bob.Executor, retrieved FieldseekerPoolCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountFieldseekerPool(ctx, exec, mods...) - }, - ), - Pooldetails: countThenLoadBuilder[Q]( - "Pooldetails", - func(ctx context.Context, exec bob.Executor, retrieved PooldetailsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountPooldetails(ctx, exec, mods...) - }, - ), - Proposedtreatmentareas: countThenLoadBuilder[Q]( - "Proposedtreatmentareas", - func(ctx context.Context, exec bob.Executor, retrieved ProposedtreatmentareasCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountProposedtreatmentareas(ctx, exec, mods...) - }, - ), - Qamosquitoinspections: countThenLoadBuilder[Q]( - "Qamosquitoinspections", - func(ctx context.Context, exec bob.Executor, retrieved QamosquitoinspectionsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountQamosquitoinspections(ctx, exec, mods...) - }, - ), - Rodentlocations: countThenLoadBuilder[Q]( - "Rodentlocations", - func(ctx context.Context, exec bob.Executor, retrieved RodentlocationsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountRodentlocations(ctx, exec, mods...) - }, - ), - Samplecollections: countThenLoadBuilder[Q]( - "Samplecollections", - func(ctx context.Context, exec bob.Executor, retrieved SamplecollectionsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountSamplecollections(ctx, exec, mods...) - }, - ), - Samplelocations: countThenLoadBuilder[Q]( - "Samplelocations", - func(ctx context.Context, exec bob.Executor, retrieved SamplelocationsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountSamplelocations(ctx, exec, mods...) - }, - ), - Servicerequests: countThenLoadBuilder[Q]( - "Servicerequests", - func(ctx context.Context, exec bob.Executor, retrieved ServicerequestsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountServicerequests(ctx, exec, mods...) - }, - ), - Speciesabundances: countThenLoadBuilder[Q]( - "Speciesabundances", - func(ctx context.Context, exec bob.Executor, retrieved SpeciesabundancesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountSpeciesabundances(ctx, exec, mods...) - }, - ), - Stormdrains: countThenLoadBuilder[Q]( - "Stormdrains", - func(ctx context.Context, exec bob.Executor, retrieved StormdrainsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountStormdrains(ctx, exec, mods...) - }, - ), - Timecards: countThenLoadBuilder[Q]( - "Timecards", - func(ctx context.Context, exec bob.Executor, retrieved TimecardsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountTimecards(ctx, exec, mods...) - }, - ), - Trapdata: countThenLoadBuilder[Q]( - "Trapdata", - func(ctx context.Context, exec bob.Executor, retrieved TrapdataCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountTrapdata(ctx, exec, mods...) - }, - ), - Traplocations: countThenLoadBuilder[Q]( - "Traplocations", - func(ctx context.Context, exec bob.Executor, retrieved TraplocationsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountTraplocations(ctx, exec, mods...) - }, - ), - Treatments: countThenLoadBuilder[Q]( - "Treatments", - func(ctx context.Context, exec bob.Executor, retrieved TreatmentsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountTreatments(ctx, exec, mods...) - }, - ), - Treatmentareas: countThenLoadBuilder[Q]( - "Treatmentareas", - func(ctx context.Context, exec bob.Executor, retrieved TreatmentareasCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountTreatmentareas(ctx, exec, mods...) - }, - ), - Zones: countThenLoadBuilder[Q]( - "Zones", - func(ctx context.Context, exec bob.Executor, retrieved ZonesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountZones(ctx, exec, mods...) - }, - ), - Zones2s: countThenLoadBuilder[Q]( - "Zones2s", - func(ctx context.Context, exec bob.Executor, retrieved Zones2sCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountZones2s(ctx, exec, mods...) - }, - ), - FieldseekerSyncs: countThenLoadBuilder[Q]( - "FieldseekerSyncs", - func(ctx context.Context, exec bob.Executor, retrieved FieldseekerSyncsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountFieldseekerSyncs(ctx, exec, mods...) - }, - ), - Files: countThenLoadBuilder[Q]( - "Files", - func(ctx context.Context, exec bob.Executor, retrieved FilesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountFiles(ctx, exec, mods...) - }, - ), - H3Aggregations: countThenLoadBuilder[Q]( - "H3Aggregations", - func(ctx context.Context, exec bob.Executor, retrieved H3AggregationsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountH3Aggregations(ctx, exec, mods...) - }, - ), - Leads: countThenLoadBuilder[Q]( - "Leads", - func(ctx context.Context, exec bob.Executor, retrieved LeadsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountLeads(ctx, exec, mods...) - }, - ), - NoteAudios: countThenLoadBuilder[Q]( - "NoteAudios", - func(ctx context.Context, exec bob.Executor, retrieved NoteAudiosCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountNoteAudios(ctx, exec, mods...) - }, - ), - NoteImages: countThenLoadBuilder[Q]( - "NoteImages", - func(ctx context.Context, exec bob.Executor, retrieved NoteImagesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountNoteImages(ctx, exec, mods...) - }, - ), - Nuisances: countThenLoadBuilder[Q]( - "Nuisances", - func(ctx context.Context, exec bob.Executor, retrieved NuisancesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountNuisances(ctx, exec, mods...) - }, - ), - PublicreportPool: countThenLoadBuilder[Q]( - "PublicreportPool", - func(ctx context.Context, exec bob.Executor, retrieved PublicreportPoolCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountPublicreportPool(ctx, exec, mods...) - }, - ), - Quicks: countThenLoadBuilder[Q]( - "Quicks", - func(ctx context.Context, exec bob.Executor, retrieved QuicksCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountQuicks(ctx, exec, mods...) - }, - ), - Signals: countThenLoadBuilder[Q]( - "Signals", - func(ctx context.Context, exec bob.Executor, retrieved SignalsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountSignals(ctx, exec, mods...) - }, - ), - User: countThenLoadBuilder[Q]( - "User", - func(ctx context.Context, exec bob.Executor, retrieved UserCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountUser(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountAccounts loads the count of Accounts into the C struct -func (o *Organization) LoadCountAccounts(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Accounts(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Accounts = &count - return nil -} - -// LoadCountAccounts loads the count of Accounts for a slice -func (os OrganizationSlice) LoadCountAccounts(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountAccounts(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountAddressMappings loads the count of AddressMappings into the C struct -func (o *Organization) LoadCountAddressMappings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.AddressMappings(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.AddressMappings = &count - return nil -} - -// LoadCountAddressMappings loads the count of AddressMappings for a slice -func (os OrganizationSlice) LoadCountAddressMappings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountAddressMappings(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountParcelMappings loads the count of ParcelMappings into the C struct -func (o *Organization) LoadCountParcelMappings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.ParcelMappings(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.ParcelMappings = &count - return nil -} - -// LoadCountParcelMappings loads the count of ParcelMappings for a slice -func (os OrganizationSlice) LoadCountParcelMappings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountParcelMappings(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountEmailContacts loads the count of EmailContacts into the C struct -func (o *Organization) LoadCountEmailContacts(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.EmailContacts(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.EmailContacts = &count - return nil -} - -// LoadCountEmailContacts loads the count of EmailContacts for a slice -func (os OrganizationSlice) LoadCountEmailContacts(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountEmailContacts(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountPhones loads the count of Phones into the C struct -func (o *Organization) LoadCountPhones(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Phones(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Phones = &count - return nil -} - -// LoadCountPhones loads the count of Phones for a slice -func (os OrganizationSlice) LoadCountPhones(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountPhones(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountContainerrelates loads the count of Containerrelates into the C struct -func (o *Organization) LoadCountContainerrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Containerrelates(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Containerrelates = &count - return nil -} - -// LoadCountContainerrelates loads the count of Containerrelates for a slice -func (os OrganizationSlice) LoadCountContainerrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountContainerrelates(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountFieldscoutinglogs loads the count of Fieldscoutinglogs into the C struct -func (o *Organization) LoadCountFieldscoutinglogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Fieldscoutinglogs(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Fieldscoutinglogs = &count - return nil -} - -// LoadCountFieldscoutinglogs loads the count of Fieldscoutinglogs for a slice -func (os OrganizationSlice) LoadCountFieldscoutinglogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountFieldscoutinglogs(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountHabitatrelates loads the count of Habitatrelates into the C struct -func (o *Organization) LoadCountHabitatrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Habitatrelates(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Habitatrelates = &count - return nil -} - -// LoadCountHabitatrelates loads the count of Habitatrelates for a slice -func (os OrganizationSlice) LoadCountHabitatrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountHabitatrelates(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountInspectionsamples loads the count of Inspectionsamples into the C struct -func (o *Organization) LoadCountInspectionsamples(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Inspectionsamples(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Inspectionsamples = &count - return nil -} - -// LoadCountInspectionsamples loads the count of Inspectionsamples for a slice -func (os OrganizationSlice) LoadCountInspectionsamples(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountInspectionsamples(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountInspectionsampledetails loads the count of Inspectionsampledetails into the C struct -func (o *Organization) LoadCountInspectionsampledetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Inspectionsampledetails(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Inspectionsampledetails = &count - return nil -} - -// LoadCountInspectionsampledetails loads the count of Inspectionsampledetails for a slice -func (os OrganizationSlice) LoadCountInspectionsampledetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountInspectionsampledetails(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountLinelocations loads the count of Linelocations into the C struct -func (o *Organization) LoadCountLinelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Linelocations(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Linelocations = &count - return nil -} - -// LoadCountLinelocations loads the count of Linelocations for a slice -func (os OrganizationSlice) LoadCountLinelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountLinelocations(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountLocationtrackings loads the count of Locationtrackings into the C struct -func (o *Organization) LoadCountLocationtrackings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Locationtrackings(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Locationtrackings = &count - return nil -} - -// LoadCountLocationtrackings loads the count of Locationtrackings for a slice -func (os OrganizationSlice) LoadCountLocationtrackings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountLocationtrackings(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountMosquitoinspections loads the count of Mosquitoinspections into the C struct -func (o *Organization) LoadCountMosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Mosquitoinspections(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Mosquitoinspections = &count - return nil -} - -// LoadCountMosquitoinspections loads the count of Mosquitoinspections for a slice -func (os OrganizationSlice) LoadCountMosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountMosquitoinspections(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountPointlocations loads the count of Pointlocations into the C struct -func (o *Organization) LoadCountPointlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Pointlocations(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Pointlocations = &count - return nil -} - -// LoadCountPointlocations loads the count of Pointlocations for a slice -func (os OrganizationSlice) LoadCountPointlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountPointlocations(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountPolygonlocations loads the count of Polygonlocations into the C struct -func (o *Organization) LoadCountPolygonlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Polygonlocations(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Polygonlocations = &count - return nil -} - -// LoadCountPolygonlocations loads the count of Polygonlocations for a slice -func (os OrganizationSlice) LoadCountPolygonlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountPolygonlocations(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountFieldseekerPool loads the count of FieldseekerPool into the C struct -func (o *Organization) LoadCountFieldseekerPool(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.FieldseekerPool(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.FieldseekerPool = &count - return nil -} - -// LoadCountFieldseekerPool loads the count of FieldseekerPool for a slice -func (os OrganizationSlice) LoadCountFieldseekerPool(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountFieldseekerPool(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountPooldetails loads the count of Pooldetails into the C struct -func (o *Organization) LoadCountPooldetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Pooldetails(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Pooldetails = &count - return nil -} - -// LoadCountPooldetails loads the count of Pooldetails for a slice -func (os OrganizationSlice) LoadCountPooldetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountPooldetails(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountProposedtreatmentareas loads the count of Proposedtreatmentareas into the C struct -func (o *Organization) LoadCountProposedtreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Proposedtreatmentareas(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Proposedtreatmentareas = &count - return nil -} - -// LoadCountProposedtreatmentareas loads the count of Proposedtreatmentareas for a slice -func (os OrganizationSlice) LoadCountProposedtreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountProposedtreatmentareas(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountQamosquitoinspections loads the count of Qamosquitoinspections into the C struct -func (o *Organization) LoadCountQamosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Qamosquitoinspections(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Qamosquitoinspections = &count - return nil -} - -// LoadCountQamosquitoinspections loads the count of Qamosquitoinspections for a slice -func (os OrganizationSlice) LoadCountQamosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountQamosquitoinspections(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountRodentlocations loads the count of Rodentlocations into the C struct -func (o *Organization) LoadCountRodentlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Rodentlocations(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Rodentlocations = &count - return nil -} - -// LoadCountRodentlocations loads the count of Rodentlocations for a slice -func (os OrganizationSlice) LoadCountRodentlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountRodentlocations(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountSamplecollections loads the count of Samplecollections into the C struct -func (o *Organization) LoadCountSamplecollections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Samplecollections(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Samplecollections = &count - return nil -} - -// LoadCountSamplecollections loads the count of Samplecollections for a slice -func (os OrganizationSlice) LoadCountSamplecollections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountSamplecollections(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountSamplelocations loads the count of Samplelocations into the C struct -func (o *Organization) LoadCountSamplelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Samplelocations(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Samplelocations = &count - return nil -} - -// LoadCountSamplelocations loads the count of Samplelocations for a slice -func (os OrganizationSlice) LoadCountSamplelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountSamplelocations(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountServicerequests loads the count of Servicerequests into the C struct -func (o *Organization) LoadCountServicerequests(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Servicerequests(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Servicerequests = &count - return nil -} - -// LoadCountServicerequests loads the count of Servicerequests for a slice -func (os OrganizationSlice) LoadCountServicerequests(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountServicerequests(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountSpeciesabundances loads the count of Speciesabundances into the C struct -func (o *Organization) LoadCountSpeciesabundances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Speciesabundances(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Speciesabundances = &count - return nil -} - -// LoadCountSpeciesabundances loads the count of Speciesabundances for a slice -func (os OrganizationSlice) LoadCountSpeciesabundances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountSpeciesabundances(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountStormdrains loads the count of Stormdrains into the C struct -func (o *Organization) LoadCountStormdrains(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Stormdrains(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Stormdrains = &count - return nil -} - -// LoadCountStormdrains loads the count of Stormdrains for a slice -func (os OrganizationSlice) LoadCountStormdrains(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountStormdrains(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountTimecards loads the count of Timecards into the C struct -func (o *Organization) LoadCountTimecards(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Timecards(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Timecards = &count - return nil -} - -// LoadCountTimecards loads the count of Timecards for a slice -func (os OrganizationSlice) LoadCountTimecards(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountTimecards(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountTrapdata loads the count of Trapdata into the C struct -func (o *Organization) LoadCountTrapdata(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Trapdata(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Trapdata = &count - return nil -} - -// LoadCountTrapdata loads the count of Trapdata for a slice -func (os OrganizationSlice) LoadCountTrapdata(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountTrapdata(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountTraplocations loads the count of Traplocations into the C struct -func (o *Organization) LoadCountTraplocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Traplocations(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Traplocations = &count - return nil -} - -// LoadCountTraplocations loads the count of Traplocations for a slice -func (os OrganizationSlice) LoadCountTraplocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountTraplocations(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountTreatments loads the count of Treatments into the C struct -func (o *Organization) LoadCountTreatments(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Treatments(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Treatments = &count - return nil -} - -// LoadCountTreatments loads the count of Treatments for a slice -func (os OrganizationSlice) LoadCountTreatments(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountTreatments(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountTreatmentareas loads the count of Treatmentareas into the C struct -func (o *Organization) LoadCountTreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Treatmentareas(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Treatmentareas = &count - return nil -} - -// LoadCountTreatmentareas loads the count of Treatmentareas for a slice -func (os OrganizationSlice) LoadCountTreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountTreatmentareas(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountZones loads the count of Zones into the C struct -func (o *Organization) LoadCountZones(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Zones(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Zones = &count - return nil -} - -// LoadCountZones loads the count of Zones for a slice -func (os OrganizationSlice) LoadCountZones(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountZones(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountZones2s loads the count of Zones2s into the C struct -func (o *Organization) LoadCountZones2s(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Zones2s(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Zones2s = &count - return nil -} - -// LoadCountZones2s loads the count of Zones2s for a slice -func (os OrganizationSlice) LoadCountZones2s(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountZones2s(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountFieldseekerSyncs loads the count of FieldseekerSyncs into the C struct -func (o *Organization) LoadCountFieldseekerSyncs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.FieldseekerSyncs(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.FieldseekerSyncs = &count - return nil -} - -// LoadCountFieldseekerSyncs loads the count of FieldseekerSyncs for a slice -func (os OrganizationSlice) LoadCountFieldseekerSyncs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountFieldseekerSyncs(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountFiles loads the count of Files into the C struct -func (o *Organization) LoadCountFiles(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Files(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Files = &count - return nil -} - -// LoadCountFiles loads the count of Files for a slice -func (os OrganizationSlice) LoadCountFiles(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountFiles(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountH3Aggregations loads the count of H3Aggregations into the C struct -func (o *Organization) LoadCountH3Aggregations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.H3Aggregations(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.H3Aggregations = &count - return nil -} - -// LoadCountH3Aggregations loads the count of H3Aggregations for a slice -func (os OrganizationSlice) LoadCountH3Aggregations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountH3Aggregations(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountLeads loads the count of Leads into the C struct -func (o *Organization) LoadCountLeads(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Leads(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Leads = &count - return nil -} - -// LoadCountLeads loads the count of Leads for a slice -func (os OrganizationSlice) LoadCountLeads(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountLeads(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountNoteAudios loads the count of NoteAudios into the C struct -func (o *Organization) LoadCountNoteAudios(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.NoteAudios(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.NoteAudios = &count - return nil -} - -// LoadCountNoteAudios loads the count of NoteAudios for a slice -func (os OrganizationSlice) LoadCountNoteAudios(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountNoteAudios(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountNoteImages loads the count of NoteImages into the C struct -func (o *Organization) LoadCountNoteImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.NoteImages(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.NoteImages = &count - return nil -} - -// LoadCountNoteImages loads the count of NoteImages for a slice -func (os OrganizationSlice) LoadCountNoteImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountNoteImages(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountNuisances loads the count of Nuisances into the C struct -func (o *Organization) LoadCountNuisances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Nuisances(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Nuisances = &count - return nil -} - -// LoadCountNuisances loads the count of Nuisances for a slice -func (os OrganizationSlice) LoadCountNuisances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountNuisances(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountPublicreportPool loads the count of PublicreportPool into the C struct -func (o *Organization) LoadCountPublicreportPool(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.PublicreportPool(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.PublicreportPool = &count - return nil -} - -// LoadCountPublicreportPool loads the count of PublicreportPool for a slice -func (os OrganizationSlice) LoadCountPublicreportPool(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountPublicreportPool(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountQuicks loads the count of Quicks into the C struct -func (o *Organization) LoadCountQuicks(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Quicks(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Quicks = &count - return nil -} - -// LoadCountQuicks loads the count of Quicks for a slice -func (os OrganizationSlice) LoadCountQuicks(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountQuicks(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountSignals loads the count of Signals into the C struct -func (o *Organization) LoadCountSignals(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Signals(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Signals = &count - return nil -} - -// LoadCountSignals loads the count of Signals for a slice -func (os OrganizationSlice) LoadCountSignals(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountSignals(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountUser loads the count of User into the C struct -func (o *Organization) LoadCountUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.User(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.User = &count - return nil -} - -// LoadCountUser loads the count of User for a slice -func (os OrganizationSlice) LoadCountUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountUser(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type organizationJoins[Q dialect.Joinable] struct { - typ string - Accounts modAs[Q, arcgisAccountColumns] - AddressMappings modAs[Q, arcgisAddressMappingColumns] - ParcelMappings modAs[Q, arcgisParcelMappingColumns] - EmailContacts modAs[Q, commsEmailContactColumns] - Phones modAs[Q, commsPhoneColumns] - 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] - FieldseekerPool 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] - Files modAs[Q, fileuploadFileColumns] - H3Aggregations modAs[Q, h3AggregationColumns] - Leads modAs[Q, leadColumns] - NoteAudios modAs[Q, noteAudioColumns] - NoteImages modAs[Q, noteImageColumns] - ArcgisAccountAccount modAs[Q, arcgisAccountColumns] - FieldseekerServiceFeatureItemServiceFeature modAs[Q, arcgisServiceFeatureColumns] - Nuisances modAs[Q, publicreportNuisanceColumns] - PublicreportPool modAs[Q, publicreportPoolColumns] - Quicks modAs[Q, publicreportQuickColumns] - Signals modAs[Q, signalColumns] - User modAs[Q, userColumns] -} - -func (j organizationJoins[Q]) aliasedAs(alias string) organizationJoins[Q] { - return buildOrganizationJoins[Q](buildOrganizationColumns(alias), j.typ) -} - -func buildOrganizationJoins[Q dialect.Joinable](cols organizationColumns, typ string) organizationJoins[Q] { - return organizationJoins[Q]{ - typ: typ, - Accounts: modAs[Q, arcgisAccountColumns]{ - c: ArcgisAccounts.Columns, - f: func(to arcgisAccountColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisAccounts.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - AddressMappings: modAs[Q, arcgisAddressMappingColumns]{ - c: ArcgisAddressMappings.Columns, - f: func(to arcgisAddressMappingColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisAddressMappings.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - ParcelMappings: modAs[Q, arcgisParcelMappingColumns]{ - c: ArcgisParcelMappings.Columns, - f: func(to arcgisParcelMappingColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisParcelMappings.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - EmailContacts: modAs[Q, commsEmailContactColumns]{ - c: CommsEmailContacts.Columns, - f: func(to commsEmailContactColumns) bob.Mod[Q] { - random := strconv.FormatInt(randInt(), 10) - mods := make(mods.QueryMods[Q], 0, 2) - - { - to := DistrictSubscriptionEmails.Columns.AliasedAs(DistrictSubscriptionEmails.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, DistrictSubscriptionEmails.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - { - cols := DistrictSubscriptionEmails.Columns.AliasedAs(DistrictSubscriptionEmails.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, CommsEmailContacts.Name().As(to.Alias())).On( - to.Address.EQ(cols.EmailContactAddress), - )) - } - - return mods - }, - }, - Phones: modAs[Q, commsPhoneColumns]{ - c: CommsPhones.Columns, - f: func(to commsPhoneColumns) bob.Mod[Q] { - random := strconv.FormatInt(randInt(), 10) - mods := make(mods.QueryMods[Q], 0, 2) - - { - to := DistrictSubscriptionPhones.Columns.AliasedAs(DistrictSubscriptionPhones.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, DistrictSubscriptionPhones.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - { - cols := DistrictSubscriptionPhones.Columns.AliasedAs(DistrictSubscriptionPhones.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, CommsPhones.Name().As(to.Alias())).On( - to.E164.EQ(cols.PhoneE164), - )) - } - - return mods - }, - }, - 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 - }, - }, - FieldseekerPool: 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] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FieldseekerSyncs.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - Files: modAs[Q, fileuploadFileColumns]{ - c: FileuploadFiles.Columns, - f: func(to fileuploadFileColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FileuploadFiles.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] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, H3Aggregations.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - Leads: modAs[Q, leadColumns]{ - c: Leads.Columns, - f: func(to leadColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Leads.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - 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, NoteAudios.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - 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, NoteImages.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - ArcgisAccountAccount: modAs[Q, arcgisAccountColumns]{ - c: ArcgisAccounts.Columns, - f: func(to arcgisAccountColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisAccounts.Name().As(to.Alias())).On( - to.ID.EQ(cols.ArcgisAccountID), - )) - } - - return mods - }, - }, - FieldseekerServiceFeatureItemServiceFeature: modAs[Q, arcgisServiceFeatureColumns]{ - c: ArcgisServiceFeatures.Columns, - f: func(to arcgisServiceFeatureColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisServiceFeatures.Name().As(to.Alias())).On( - to.ItemID.EQ(cols.FieldseekerServiceFeatureItemID), - )) - } - - return mods - }, - }, - Nuisances: modAs[Q, publicreportNuisanceColumns]{ - c: PublicreportNuisances.Columns, - f: func(to publicreportNuisanceColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportNuisances.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - PublicreportPool: modAs[Q, publicreportPoolColumns]{ - c: PublicreportPools.Columns, - f: func(to publicreportPoolColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportPools.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - Quicks: modAs[Q, publicreportQuickColumns]{ - c: PublicreportQuicks.Columns, - f: func(to publicreportQuickColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportQuicks.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - Signals: modAs[Q, signalColumns]{ - c: Signals.Columns, - f: func(to signalColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Signals.Name().As(to.Alias())).On( - to.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - User: 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.OrganizationID.EQ(cols.ID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/parcel.bob.go b/db/models/parcel.bob.go index d39dc09a..8f9a1427 100644 --- a/db/models/parcel.bob.go +++ b/db/models/parcel.bob.go @@ -15,7 +15,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/null" @@ -31,8 +30,6 @@ type Parcel struct { Geometry string `db:"geometry" ` R parcelR `db:"-" ` - - C parcelC `db:"-" ` } // ParcelSlice is an alias for a slice of pointers to Parcel. @@ -643,125 +640,3 @@ func (os ParcelSlice) LoadSites(ctx context.Context, exec bob.Executor, mods ... return nil } - -// parcelC is where relationship counts are stored. -type parcelC struct { - Sites *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *Parcel) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "Sites": - o.C.Sites = &count - } - return nil -} - -type parcelCountPreloader struct { - Sites func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildParcelCountPreloader() parcelCountPreloader { - return parcelCountPreloader{ - Sites: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Parcel]("Sites", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Parcels.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(Sites.Name()), - sm.Where(psql.Quote(Sites.Alias(), "parcel_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type parcelCountThenLoader[Q orm.Loadable] struct { - Sites func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildParcelCountThenLoader[Q orm.Loadable]() parcelCountThenLoader[Q] { - type SitesCountInterface interface { - LoadCountSites(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return parcelCountThenLoader[Q]{ - Sites: countThenLoadBuilder[Q]( - "Sites", - func(ctx context.Context, exec bob.Executor, retrieved SitesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountSites(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountSites loads the count of Sites into the C struct -func (o *Parcel) LoadCountSites(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Sites(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Sites = &count - return nil -} - -// LoadCountSites loads the count of Sites for a slice -func (os ParcelSlice) LoadCountSites(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountSites(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type parcelJoins[Q dialect.Joinable] struct { - typ string - Sites modAs[Q, siteColumns] -} - -func (j parcelJoins[Q]) aliasedAs(alias string) parcelJoins[Q] { - return buildParcelJoins[Q](buildParcelColumns(alias), j.typ) -} - -func buildParcelJoins[Q dialect.Joinable](cols parcelColumns, typ string) parcelJoins[Q] { - return parcelJoins[Q]{ - typ: typ, - Sites: modAs[Q, siteColumns]{ - c: Sites.Columns, - f: func(to siteColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Sites.Name().As(to.Alias())).On( - to.ParcelID.EQ(cols.ID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/pool.bob.go b/db/models/pool.bob.go deleted file mode 100644 index 6263bd50..00000000 --- a/db/models/pool.bob.go +++ /dev/null @@ -1,1136 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/dialect/psql" - "github.com/Gleipnir-Technology/bob/dialect/psql/dialect" - "github.com/Gleipnir-Technology/bob/dialect/psql/dm" - "github.com/Gleipnir-Technology/bob/dialect/psql/sm" - "github.com/Gleipnir-Technology/bob/dialect/psql/um" - "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" - "github.com/Gleipnir-Technology/bob/orm" - "github.com/Gleipnir-Technology/bob/types/pgtypes" - enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" - "github.com/aarondl/opt/null" - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" -) - -// Pool is an object representing the database table. -type Pool struct { - Condition enums.Poolconditiontype `db:"condition" ` - Created time.Time `db:"created" ` - CreatorID int32 `db:"creator_id" ` - ID int32 `db:"id,pk" ` - SiteID int32 `db:"site_id" ` - SiteVersion int32 `db:"site_version" ` - Geometry null.Val[string] `db:"geometry" ` - - R poolR `db:"-" ` - - C poolC `db:"-" ` -} - -// PoolSlice is an alias for a slice of pointers to Pool. -// This should almost always be used instead of []*Pool. -type PoolSlice []*Pool - -// Pools contains methods to work with the pool table -var Pools = psql.NewTablex[*Pool, PoolSlice, *PoolSetter]("", "pool", buildPoolColumns("pool")) - -// PoolsQuery is a query on the pool table -type PoolsQuery = *psql.ViewQuery[*Pool, PoolSlice] - -// poolR is where relationships are stored. -type poolR struct { - CreatorUser *User // pool.pool_creator_id_fkey - Site *Site // pool.pool_site_id_site_version_fkey - SignalPools SignalPoolSlice // signal_pool.signal_pool_pool_id_fkey -} - -func buildPoolColumns(alias string) poolColumns { - return poolColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "condition", "created", "creator_id", "id", "site_id", "site_version", "geometry", - ).WithParent("pool"), - tableAlias: alias, - Condition: psql.Quote(alias, "condition"), - Created: psql.Quote(alias, "created"), - CreatorID: psql.Quote(alias, "creator_id"), - ID: psql.Quote(alias, "id"), - SiteID: psql.Quote(alias, "site_id"), - SiteVersion: psql.Quote(alias, "site_version"), - Geometry: psql.Quote(alias, "geometry"), - } -} - -type poolColumns struct { - expr.ColumnsExpr - tableAlias string - Condition psql.Expression - Created psql.Expression - CreatorID psql.Expression - ID psql.Expression - SiteID psql.Expression - SiteVersion psql.Expression - Geometry psql.Expression -} - -func (c poolColumns) Alias() string { - return c.tableAlias -} - -func (poolColumns) AliasedAs(alias string) poolColumns { - return buildPoolColumns(alias) -} - -// PoolSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type PoolSetter struct { - Condition omit.Val[enums.Poolconditiontype] `db:"condition" ` - Created omit.Val[time.Time] `db:"created" ` - CreatorID omit.Val[int32] `db:"creator_id" ` - ID omit.Val[int32] `db:"id,pk" ` - SiteID omit.Val[int32] `db:"site_id" ` - SiteVersion omit.Val[int32] `db:"site_version" ` - Geometry omitnull.Val[string] `db:"geometry" ` -} - -func (s PoolSetter) SetColumns() []string { - vals := make([]string, 0, 7) - if s.Condition.IsValue() { - vals = append(vals, "condition") - } - if s.Created.IsValue() { - vals = append(vals, "created") - } - if s.CreatorID.IsValue() { - vals = append(vals, "creator_id") - } - if s.ID.IsValue() { - vals = append(vals, "id") - } - if s.SiteID.IsValue() { - vals = append(vals, "site_id") - } - if s.SiteVersion.IsValue() { - vals = append(vals, "site_version") - } - if !s.Geometry.IsUnset() { - vals = append(vals, "geometry") - } - return vals -} - -func (s PoolSetter) Overwrite(t *Pool) { - if s.Condition.IsValue() { - t.Condition = s.Condition.MustGet() - } - if s.Created.IsValue() { - t.Created = s.Created.MustGet() - } - if s.CreatorID.IsValue() { - t.CreatorID = s.CreatorID.MustGet() - } - if s.ID.IsValue() { - t.ID = s.ID.MustGet() - } - if s.SiteID.IsValue() { - t.SiteID = s.SiteID.MustGet() - } - if s.SiteVersion.IsValue() { - t.SiteVersion = s.SiteVersion.MustGet() - } - if !s.Geometry.IsUnset() { - t.Geometry = s.Geometry.MustGetNull() - } -} - -func (s *PoolSetter) Apply(q *dialect.InsertQuery) { - q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { - return Pools.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.Condition.IsValue() { - vals[0] = psql.Arg(s.Condition.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.CreatorID.IsValue() { - vals[2] = psql.Arg(s.CreatorID.MustGet()) - } else { - vals[2] = psql.Raw("DEFAULT") - } - - if s.ID.IsValue() { - vals[3] = psql.Arg(s.ID.MustGet()) - } else { - vals[3] = psql.Raw("DEFAULT") - } - - if s.SiteID.IsValue() { - vals[4] = psql.Arg(s.SiteID.MustGet()) - } else { - vals[4] = psql.Raw("DEFAULT") - } - - if s.SiteVersion.IsValue() { - vals[5] = psql.Arg(s.SiteVersion.MustGet()) - } else { - vals[5] = psql.Raw("DEFAULT") - } - - if !s.Geometry.IsUnset() { - vals[6] = psql.Arg(s.Geometry.MustGetNull()) - } else { - vals[6] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s PoolSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s PoolSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 7) - - if s.Condition.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "condition")...), - psql.Arg(s.Condition), - }}) - } - - 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.ID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "id")...), - psql.Arg(s.ID), - }}) - } - - if s.SiteID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "site_id")...), - psql.Arg(s.SiteID), - }}) - } - - if s.SiteVersion.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "site_version")...), - psql.Arg(s.SiteVersion), - }}) - } - - if !s.Geometry.IsUnset() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "geometry")...), - psql.Arg(s.Geometry), - }}) - } - - return exprs -} - -// FindPool retrieves a single record by primary key -// If cols is empty Find will return all columns. -func FindPool(ctx context.Context, exec bob.Executor, IDPK int32, cols ...string) (*Pool, error) { - if len(cols) == 0 { - return Pools.Query( - sm.Where(Pools.Columns.ID.EQ(psql.Arg(IDPK))), - ).One(ctx, exec) - } - - return Pools.Query( - sm.Where(Pools.Columns.ID.EQ(psql.Arg(IDPK))), - sm.Columns(Pools.Columns.Only(cols...)), - ).One(ctx, exec) -} - -// PoolExists checks the presence of a single record by primary key -func PoolExists(ctx context.Context, exec bob.Executor, IDPK int32) (bool, error) { - return Pools.Query( - sm.Where(Pools.Columns.ID.EQ(psql.Arg(IDPK))), - ).Exists(ctx, exec) -} - -// AfterQueryHook is called after Pool is retrieved from the database -func (o *Pool) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = Pools.AfterSelectHooks.RunHooks(ctx, exec, PoolSlice{o}) - case bob.QueryTypeInsert: - ctx, err = Pools.AfterInsertHooks.RunHooks(ctx, exec, PoolSlice{o}) - case bob.QueryTypeUpdate: - ctx, err = Pools.AfterUpdateHooks.RunHooks(ctx, exec, PoolSlice{o}) - case bob.QueryTypeDelete: - ctx, err = Pools.AfterDeleteHooks.RunHooks(ctx, exec, PoolSlice{o}) - } - - return err -} - -// primaryKeyVals returns the primary key values of the Pool -func (o *Pool) primaryKeyVals() bob.Expression { - return psql.Arg(o.ID) -} - -func (o *Pool) pkEQ() dialect.Expression { - return psql.Quote("pool", "id").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 Pool -func (o *Pool) Update(ctx context.Context, exec bob.Executor, s *PoolSetter) error { - v, err := Pools.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 Pool record with an executor -func (o *Pool) Delete(ctx context.Context, exec bob.Executor) error { - _, err := Pools.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) - return err -} - -// Reload refreshes the Pool using the executor -func (o *Pool) Reload(ctx context.Context, exec bob.Executor) error { - o2, err := Pools.Query( - sm.Where(Pools.Columns.ID.EQ(psql.Arg(o.ID))), - ).One(ctx, exec) - if err != nil { - return err - } - o2.R = o.R - *o = *o2 - - return nil -} - -// AfterQueryHook is called after PoolSlice is retrieved from the database -func (o PoolSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = Pools.AfterSelectHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeInsert: - ctx, err = Pools.AfterInsertHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeUpdate: - ctx, err = Pools.AfterUpdateHooks.RunHooks(ctx, exec, o) - case bob.QueryTypeDelete: - ctx, err = Pools.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err -} - -func (o PoolSlice) pkIN() dialect.Expression { - if len(o) == 0 { - return psql.Raw("NULL") - } - - return psql.Quote("pool", "id").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 PoolSlice) copyMatchingRows(from ...*Pool) { - for i, old := range o { - for _, new := range from { - if new.ID != old.ID { - continue - } - new.R = old.R - o[i] = new - break - } - } -} - -// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" -func (o PoolSlice) 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 Pools.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 *Pool: - o.copyMatchingRows(retrieved) - case []*Pool: - o.copyMatchingRows(retrieved...) - case PoolSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a Pool or a slice of Pool - // then run the AfterUpdateHooks on the slice - _, err = Pools.AfterUpdateHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" -func (o PoolSlice) 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 Pools.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 *Pool: - o.copyMatchingRows(retrieved) - case []*Pool: - o.copyMatchingRows(retrieved...) - case PoolSlice: - o.copyMatchingRows(retrieved...) - default: - // If the retrieved value is not a Pool or a slice of Pool - // then run the AfterDeleteHooks on the slice - _, err = Pools.AfterDeleteHooks.RunHooks(ctx, exec, o) - } - - return err - })) - - q.AppendWhere(o.pkIN()) - }) -} - -func (o PoolSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals PoolSetter) error { - if len(o) == 0 { - return nil - } - - _, err := Pools.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) - return err -} - -func (o PoolSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - _, err := Pools.Delete(o.DeleteMod()).Exec(ctx, exec) - return err -} - -func (o PoolSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { - if len(o) == 0 { - return nil - } - - o2, err := Pools.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 *Pool) CreatorUser(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery { - return Users.Query(append(mods, - sm.Where(Users.Columns.ID.EQ(psql.Arg(o.CreatorID))), - )...) -} - -func (os PoolSlice) 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)), - )...) -} - -// Site starts a query for related objects on site -func (o *Pool) Site(mods ...bob.Mod[*dialect.SelectQuery]) SitesQuery { - return Sites.Query(append(mods, - sm.Where(Sites.Columns.ID.EQ(psql.Arg(o.SiteID))), sm.Where(Sites.Columns.Version.EQ(psql.Arg(o.SiteVersion))), - )...) -} - -func (os PoolSlice) Site(mods ...bob.Mod[*dialect.SelectQuery]) SitesQuery { - pkSiteID := make(pgtypes.Array[int32], 0, len(os)) - - pkSiteVersion := make(pgtypes.Array[int32], 0, len(os)) - for _, o := range os { - if o == nil { - continue - } - pkSiteID = append(pkSiteID, o.SiteID) - pkSiteVersion = append(pkSiteVersion, o.SiteVersion) - } - PKArgExpr := psql.Select(sm.Columns( - psql.F("unnest", psql.Cast(psql.Arg(pkSiteID), "integer[]")), - psql.F("unnest", psql.Cast(psql.Arg(pkSiteVersion), "integer[]")), - )) - - return Sites.Query(append(mods, - sm.Where(psql.Group(Sites.Columns.ID, Sites.Columns.Version).OP("IN", PKArgExpr)), - )...) -} - -// SignalPools starts a query for related objects on signal_pool -func (o *Pool) SignalPools(mods ...bob.Mod[*dialect.SelectQuery]) SignalPoolsQuery { - return SignalPools.Query(append(mods, - sm.Where(SignalPools.Columns.PoolID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os PoolSlice) SignalPools(mods ...bob.Mod[*dialect.SelectQuery]) SignalPoolsQuery { - 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 SignalPools.Query(append(mods, - sm.Where(psql.Group(SignalPools.Columns.PoolID).OP("IN", PKArgExpr)), - )...) -} - -func attachPoolCreatorUser0(ctx context.Context, exec bob.Executor, count int, pool0 *Pool, user1 *User) (*Pool, error) { - setter := &PoolSetter{ - CreatorID: omit.From(user1.ID), - } - - err := pool0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachPoolCreatorUser0: %w", err) - } - - return pool0, nil -} - -func (pool0 *Pool) 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 = attachPoolCreatorUser0(ctx, exec, 1, pool0, user1) - if err != nil { - return err - } - - pool0.R.CreatorUser = user1 - - user1.R.CreatorPools = append(user1.R.CreatorPools, pool0) - - return nil -} - -func (pool0 *Pool) AttachCreatorUser(ctx context.Context, exec bob.Executor, user1 *User) error { - var err error - - _, err = attachPoolCreatorUser0(ctx, exec, 1, pool0, user1) - if err != nil { - return err - } - - pool0.R.CreatorUser = user1 - - user1.R.CreatorPools = append(user1.R.CreatorPools, pool0) - - return nil -} - -func attachPoolSite0(ctx context.Context, exec bob.Executor, count int, pool0 *Pool, site1 *Site) (*Pool, error) { - setter := &PoolSetter{ - SiteID: omit.From(site1.ID), - SiteVersion: omit.From(site1.Version), - } - - err := pool0.Update(ctx, exec, setter) - if err != nil { - return nil, fmt.Errorf("attachPoolSite0: %w", err) - } - - return pool0, nil -} - -func (pool0 *Pool) InsertSite(ctx context.Context, exec bob.Executor, related *SiteSetter) error { - var err error - - site1, err := Sites.Insert(related).One(ctx, exec) - if err != nil { - return fmt.Errorf("inserting related objects: %w", err) - } - - _, err = attachPoolSite0(ctx, exec, 1, pool0, site1) - if err != nil { - return err - } - - pool0.R.Site = site1 - - site1.R.Pools = append(site1.R.Pools, pool0) - - return nil -} - -func (pool0 *Pool) AttachSite(ctx context.Context, exec bob.Executor, site1 *Site) error { - var err error - - _, err = attachPoolSite0(ctx, exec, 1, pool0, site1) - if err != nil { - return err - } - - pool0.R.Site = site1 - - site1.R.Pools = append(site1.R.Pools, pool0) - - return nil -} - -type poolWhere[Q psql.Filterable] struct { - Condition psql.WhereMod[Q, enums.Poolconditiontype] - Created psql.WhereMod[Q, time.Time] - CreatorID psql.WhereMod[Q, int32] - ID psql.WhereMod[Q, int32] - SiteID psql.WhereMod[Q, int32] - SiteVersion psql.WhereMod[Q, int32] - Geometry psql.WhereNullMod[Q, string] -} - -func (poolWhere[Q]) AliasedAs(alias string) poolWhere[Q] { - return buildPoolWhere[Q](buildPoolColumns(alias)) -} - -func buildPoolWhere[Q psql.Filterable](cols poolColumns) poolWhere[Q] { - return poolWhere[Q]{ - Condition: psql.Where[Q, enums.Poolconditiontype](cols.Condition), - Created: psql.Where[Q, time.Time](cols.Created), - CreatorID: psql.Where[Q, int32](cols.CreatorID), - ID: psql.Where[Q, int32](cols.ID), - SiteID: psql.Where[Q, int32](cols.SiteID), - SiteVersion: psql.Where[Q, int32](cols.SiteVersion), - Geometry: psql.WhereNull[Q, string](cols.Geometry), - } -} - -func (o *Pool) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "CreatorUser": - rel, ok := retrieved.(*User) - if !ok { - return fmt.Errorf("pool cannot load %T as %q", retrieved, name) - } - - o.R.CreatorUser = rel - - if rel != nil { - rel.R.CreatorPools = PoolSlice{o} - } - return nil - case "Site": - rel, ok := retrieved.(*Site) - if !ok { - return fmt.Errorf("pool cannot load %T as %q", retrieved, name) - } - - o.R.Site = rel - - if rel != nil { - rel.R.Pools = PoolSlice{o} - } - return nil - case "SignalPools": - rels, ok := retrieved.(SignalPoolSlice) - if !ok { - return fmt.Errorf("pool cannot load %T as %q", retrieved, name) - } - - o.R.SignalPools = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Pool = o - } - } - return nil - default: - return fmt.Errorf("pool has no relationship %q", name) - } -} - -type poolPreloader struct { - CreatorUser func(...psql.PreloadOption) psql.Preloader - Site func(...psql.PreloadOption) psql.Preloader -} - -func buildPoolPreloader() poolPreloader { - return poolPreloader{ - CreatorUser: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*User, UserSlice](psql.PreloadRel{ - Name: "CreatorUser", - Sides: []psql.PreloadSide{ - { - From: Pools, - To: Users, - FromColumns: []string{"creator_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Users.Columns.Names(), opts...) - }, - Site: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Site, SiteSlice](psql.PreloadRel{ - Name: "Site", - Sides: []psql.PreloadSide{ - { - From: Pools, - To: Sites, - FromColumns: []string{"site_id", "site_version"}, - ToColumns: []string{"id", "version"}, - }, - }, - }, Sites.Columns.Names(), opts...) - }, - } -} - -type poolThenLoader[Q orm.Loadable] struct { - CreatorUser func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - Site func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - SignalPools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildPoolThenLoader[Q orm.Loadable]() poolThenLoader[Q] { - type CreatorUserLoadInterface interface { - LoadCreatorUser(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type SiteLoadInterface interface { - LoadSite(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type SignalPoolsLoadInterface interface { - LoadSignalPools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return poolThenLoader[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...) - }, - ), - Site: thenLoadBuilder[Q]( - "Site", - func(ctx context.Context, exec bob.Executor, retrieved SiteLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadSite(ctx, exec, mods...) - }, - ), - SignalPools: thenLoadBuilder[Q]( - "SignalPools", - func(ctx context.Context, exec bob.Executor, retrieved SignalPoolsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadSignalPools(ctx, exec, mods...) - }, - ), - } -} - -// LoadCreatorUser loads the pool's CreatorUser into the .R struct -func (o *Pool) 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.CreatorPools = PoolSlice{o} - - o.R.CreatorUser = related - return nil -} - -// LoadCreatorUser loads the pool's CreatorUser into the .R struct -func (os PoolSlice) 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.CreatorPools = append(rel.R.CreatorPools, o) - - o.R.CreatorUser = rel - break - } - } - - return nil -} - -// LoadSite loads the pool's Site into the .R struct -func (o *Pool) LoadSite(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.Site = nil - - related, err := o.Site(mods...).One(ctx, exec) - if err != nil { - return err - } - - related.R.Pools = PoolSlice{o} - - o.R.Site = related - return nil -} - -// LoadSite loads the pool's Site into the .R struct -func (os PoolSlice) LoadSite(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - sites, err := os.Site(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range sites { - - if !(o.SiteID == rel.ID) { - continue - } - - if !(o.SiteVersion == rel.Version) { - continue - } - - rel.R.Pools = append(rel.R.Pools, o) - - o.R.Site = rel - break - } - } - - return nil -} - -// LoadSignalPools loads the pool's SignalPools into the .R struct -func (o *Pool) LoadSignalPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.SignalPools = nil - - related, err := o.SignalPools(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Pool = o - } - - o.R.SignalPools = related - return nil -} - -// LoadSignalPools loads the pool's SignalPools into the .R struct -func (os PoolSlice) LoadSignalPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - signalPools, err := os.SignalPools(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.SignalPools = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range signalPools { - - if !(o.ID == rel.PoolID) { - continue - } - - rel.R.Pool = o - - o.R.SignalPools = append(o.R.SignalPools, rel) - } - } - - return nil -} - -// poolC is where relationship counts are stored. -type poolC struct { - SignalPools *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *Pool) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "SignalPools": - o.C.SignalPools = &count - } - return nil -} - -type poolCountPreloader struct { - SignalPools func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildPoolCountPreloader() poolCountPreloader { - return poolCountPreloader{ - SignalPools: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Pool]("SignalPools", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Pools.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(SignalPools.Name()), - sm.Where(psql.Quote(SignalPools.Alias(), "pool_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type poolCountThenLoader[Q orm.Loadable] struct { - SignalPools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildPoolCountThenLoader[Q orm.Loadable]() poolCountThenLoader[Q] { - type SignalPoolsCountInterface interface { - LoadCountSignalPools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return poolCountThenLoader[Q]{ - SignalPools: countThenLoadBuilder[Q]( - "SignalPools", - func(ctx context.Context, exec bob.Executor, retrieved SignalPoolsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountSignalPools(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountSignalPools loads the count of SignalPools into the C struct -func (o *Pool) LoadCountSignalPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.SignalPools(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.SignalPools = &count - return nil -} - -// LoadCountSignalPools loads the count of SignalPools for a slice -func (os PoolSlice) LoadCountSignalPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountSignalPools(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type poolJoins[Q dialect.Joinable] struct { - typ string - CreatorUser modAs[Q, userColumns] - Site modAs[Q, siteColumns] - SignalPools modAs[Q, signalPoolColumns] -} - -func (j poolJoins[Q]) aliasedAs(alias string) poolJoins[Q] { - return buildPoolJoins[Q](buildPoolColumns(alias), j.typ) -} - -func buildPoolJoins[Q dialect.Joinable](cols poolColumns, typ string) poolJoins[Q] { - return poolJoins[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 - }, - }, - Site: modAs[Q, siteColumns]{ - c: Sites.Columns, - f: func(to siteColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Sites.Name().As(to.Alias())).On( - to.ID.EQ(cols.SiteID), to.Version.EQ(cols.SiteVersion), - )) - } - - return mods - }, - }, - SignalPools: modAs[Q, signalPoolColumns]{ - c: SignalPools.Columns, - f: func(to signalPoolColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, SignalPools.Name().As(to.Alias())).On( - to.PoolID.EQ(cols.ID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/publicreport.image.bob.go b/db/models/publicreport.image.bob.go index 939d4b23..3abfd024 100644 --- a/db/models/publicreport.image.bob.go +++ b/db/models/publicreport.image.bob.go @@ -7,7 +7,6 @@ import ( "context" "fmt" "io" - "strconv" "time" "github.com/Gleipnir-Technology/bob" @@ -17,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/null" @@ -40,8 +38,6 @@ type PublicreportImage struct { UploadedFilename string `db:"uploaded_filename" ` R publicreportImageR `db:"-" ` - - C publicreportImageC `db:"-" ` } // PublicreportImageSlice is an alias for a slice of pointers to PublicreportImage. @@ -1369,386 +1365,3 @@ func (os PublicreportImageSlice) LoadQuicks(ctx context.Context, exec bob.Execut return nil } - -// publicreportImageC is where relationship counts are stored. -type publicreportImageC struct { - ImageExifs *int64 - Nuisances *int64 - Pools *int64 - Quicks *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *PublicreportImage) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "ImageExifs": - o.C.ImageExifs = &count - case "Nuisances": - o.C.Nuisances = &count - case "Pools": - o.C.Pools = &count - case "Quicks": - o.C.Quicks = &count - } - return nil -} - -type publicreportImageCountPreloader struct { - ImageExifs func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Nuisances func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Pools func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Quicks func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildPublicreportImageCountPreloader() publicreportImageCountPreloader { - return publicreportImageCountPreloader{ - ImageExifs: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*PublicreportImage]("ImageExifs", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = PublicreportImages.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(PublicreportImageExifs.Name()), - sm.Where(psql.Quote(PublicreportImageExifs.Alias(), "image_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Nuisances: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*PublicreportImage]("Nuisances", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = PublicreportImages.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(PublicreportNuisanceImages.Name()), - sm.Where(psql.Quote(PublicreportNuisanceImages.Alias(), "image_id").EQ(psql.Quote(parent, "id"))), - sm.InnerJoin(PublicreportNuisances.Name()).On( - psql.Quote(PublicreportNuisances.Alias(), "id").EQ(psql.Quote(PublicreportNuisanceImages.Alias(), "nuisance_id")), - ), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Pools: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*PublicreportImage]("Pools", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = PublicreportImages.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(PublicreportPoolImages.Name()), - sm.Where(psql.Quote(PublicreportPoolImages.Alias(), "image_id").EQ(psql.Quote(parent, "id"))), - sm.InnerJoin(PublicreportPools.Name()).On( - psql.Quote(PublicreportPools.Alias(), "id").EQ(psql.Quote(PublicreportPoolImages.Alias(), "pool_id")), - ), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Quicks: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*PublicreportImage]("Quicks", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = PublicreportImages.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(PublicreportQuickImages.Name()), - sm.Where(psql.Quote(PublicreportQuickImages.Alias(), "image_id").EQ(psql.Quote(parent, "id"))), - sm.InnerJoin(PublicreportQuicks.Name()).On( - psql.Quote(PublicreportQuicks.Alias(), "id").EQ(psql.Quote(PublicreportQuickImages.Alias(), "quick_id")), - ), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type publicreportImageCountThenLoader[Q orm.Loadable] struct { - ImageExifs func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - Nuisances func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - Pools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - Quicks func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildPublicreportImageCountThenLoader[Q orm.Loadable]() publicreportImageCountThenLoader[Q] { - type ImageExifsCountInterface interface { - LoadCountImageExifs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type NuisancesCountInterface interface { - LoadCountNuisances(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type PoolsCountInterface interface { - LoadCountPools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type QuicksCountInterface interface { - LoadCountQuicks(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return publicreportImageCountThenLoader[Q]{ - ImageExifs: countThenLoadBuilder[Q]( - "ImageExifs", - func(ctx context.Context, exec bob.Executor, retrieved ImageExifsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountImageExifs(ctx, exec, mods...) - }, - ), - Nuisances: countThenLoadBuilder[Q]( - "Nuisances", - func(ctx context.Context, exec bob.Executor, retrieved NuisancesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountNuisances(ctx, exec, mods...) - }, - ), - Pools: countThenLoadBuilder[Q]( - "Pools", - func(ctx context.Context, exec bob.Executor, retrieved PoolsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountPools(ctx, exec, mods...) - }, - ), - Quicks: countThenLoadBuilder[Q]( - "Quicks", - func(ctx context.Context, exec bob.Executor, retrieved QuicksCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountQuicks(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountImageExifs loads the count of ImageExifs into the C struct -func (o *PublicreportImage) LoadCountImageExifs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.ImageExifs(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.ImageExifs = &count - return nil -} - -// LoadCountImageExifs loads the count of ImageExifs for a slice -func (os PublicreportImageSlice) LoadCountImageExifs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountImageExifs(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountNuisances loads the count of Nuisances into the C struct -func (o *PublicreportImage) LoadCountNuisances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Nuisances(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Nuisances = &count - return nil -} - -// LoadCountNuisances loads the count of Nuisances for a slice -func (os PublicreportImageSlice) LoadCountNuisances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountNuisances(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountPools loads the count of Pools into the C struct -func (o *PublicreportImage) LoadCountPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Pools(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Pools = &count - return nil -} - -// LoadCountPools loads the count of Pools for a slice -func (os PublicreportImageSlice) LoadCountPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountPools(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountQuicks loads the count of Quicks into the C struct -func (o *PublicreportImage) LoadCountQuicks(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Quicks(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Quicks = &count - return nil -} - -// LoadCountQuicks loads the count of Quicks for a slice -func (os PublicreportImageSlice) LoadCountQuicks(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountQuicks(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type publicreportImageJoins[Q dialect.Joinable] struct { - typ string - ImageExifs modAs[Q, publicreportImageExifColumns] - Nuisances modAs[Q, publicreportNuisanceColumns] - Pools modAs[Q, publicreportPoolColumns] - Quicks modAs[Q, publicreportQuickColumns] -} - -func (j publicreportImageJoins[Q]) aliasedAs(alias string) publicreportImageJoins[Q] { - return buildPublicreportImageJoins[Q](buildPublicreportImageColumns(alias), j.typ) -} - -func buildPublicreportImageJoins[Q dialect.Joinable](cols publicreportImageColumns, typ string) publicreportImageJoins[Q] { - return publicreportImageJoins[Q]{ - typ: typ, - ImageExifs: modAs[Q, publicreportImageExifColumns]{ - c: PublicreportImageExifs.Columns, - f: func(to publicreportImageExifColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportImageExifs.Name().As(to.Alias())).On( - to.ImageID.EQ(cols.ID), - )) - } - - return mods - }, - }, - Nuisances: modAs[Q, publicreportNuisanceColumns]{ - c: PublicreportNuisances.Columns, - f: func(to publicreportNuisanceColumns) bob.Mod[Q] { - random := strconv.FormatInt(randInt(), 10) - mods := make(mods.QueryMods[Q], 0, 2) - - { - to := PublicreportNuisanceImages.Columns.AliasedAs(PublicreportNuisanceImages.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, PublicreportNuisanceImages.Name().As(to.Alias())).On( - to.ImageID.EQ(cols.ID), - )) - } - { - cols := PublicreportNuisanceImages.Columns.AliasedAs(PublicreportNuisanceImages.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, PublicreportNuisances.Name().As(to.Alias())).On( - to.ID.EQ(cols.NuisanceID), - )) - } - - return mods - }, - }, - Pools: modAs[Q, publicreportPoolColumns]{ - c: PublicreportPools.Columns, - f: func(to publicreportPoolColumns) bob.Mod[Q] { - random := strconv.FormatInt(randInt(), 10) - mods := make(mods.QueryMods[Q], 0, 2) - - { - to := PublicreportPoolImages.Columns.AliasedAs(PublicreportPoolImages.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, PublicreportPoolImages.Name().As(to.Alias())).On( - to.ImageID.EQ(cols.ID), - )) - } - { - cols := PublicreportPoolImages.Columns.AliasedAs(PublicreportPoolImages.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, PublicreportPools.Name().As(to.Alias())).On( - to.ID.EQ(cols.PoolID), - )) - } - - return mods - }, - }, - Quicks: modAs[Q, publicreportQuickColumns]{ - c: PublicreportQuicks.Columns, - f: func(to publicreportQuickColumns) bob.Mod[Q] { - random := strconv.FormatInt(randInt(), 10) - mods := make(mods.QueryMods[Q], 0, 2) - - { - to := PublicreportQuickImages.Columns.AliasedAs(PublicreportQuickImages.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, PublicreportQuickImages.Name().As(to.Alias())).On( - to.ImageID.EQ(cols.ID), - )) - } - { - cols := PublicreportQuickImages.Columns.AliasedAs(PublicreportQuickImages.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, PublicreportQuicks.Name().As(to.Alias())).On( - to.ID.EQ(cols.QuickID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/publicreport.image_exif.bob.go b/db/models/publicreport.image_exif.bob.go index d7050087..3a539d95 100644 --- a/db/models/publicreport.image_exif.bob.go +++ b/db/models/publicreport.image_exif.bob.go @@ -15,7 +15,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/omit" @@ -614,32 +613,3 @@ func (os PublicreportImageExifSlice) LoadImage(ctx context.Context, exec bob.Exe return nil } - -type publicreportImageExifJoins[Q dialect.Joinable] struct { - typ string - Image modAs[Q, publicreportImageColumns] -} - -func (j publicreportImageExifJoins[Q]) aliasedAs(alias string) publicreportImageExifJoins[Q] { - return buildPublicreportImageExifJoins[Q](buildPublicreportImageExifColumns(alias), j.typ) -} - -func buildPublicreportImageExifJoins[Q dialect.Joinable](cols publicreportImageExifColumns, typ string) publicreportImageExifJoins[Q] { - return publicreportImageExifJoins[Q]{ - typ: typ, - Image: modAs[Q, publicreportImageColumns]{ - c: PublicreportImages.Columns, - f: func(to publicreportImageColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportImages.Name().As(to.Alias())).On( - to.ID.EQ(cols.ImageID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/publicreport.notify_email_nuisance.bob.go b/db/models/publicreport.notify_email_nuisance.bob.go index 09cff97e..0c3c75ad 100644 --- a/db/models/publicreport.notify_email_nuisance.bob.go +++ b/db/models/publicreport.notify_email_nuisance.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/null" @@ -795,47 +794,3 @@ func (os PublicreportNotifyEmailNuisanceSlice) LoadNuisance(ctx context.Context, return nil } - -type publicreportNotifyEmailNuisanceJoins[Q dialect.Joinable] struct { - typ string - EmailAddressEmailContact modAs[Q, commsEmailContactColumns] - Nuisance modAs[Q, publicreportNuisanceColumns] -} - -func (j publicreportNotifyEmailNuisanceJoins[Q]) aliasedAs(alias string) publicreportNotifyEmailNuisanceJoins[Q] { - return buildPublicreportNotifyEmailNuisanceJoins[Q](buildPublicreportNotifyEmailNuisanceColumns(alias), j.typ) -} - -func buildPublicreportNotifyEmailNuisanceJoins[Q dialect.Joinable](cols publicreportNotifyEmailNuisanceColumns, typ string) publicreportNotifyEmailNuisanceJoins[Q] { - return publicreportNotifyEmailNuisanceJoins[Q]{ - typ: typ, - EmailAddressEmailContact: modAs[Q, commsEmailContactColumns]{ - c: CommsEmailContacts.Columns, - f: func(to commsEmailContactColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsEmailContacts.Name().As(to.Alias())).On( - to.Address.EQ(cols.EmailAddress), - )) - } - - return mods - }, - }, - Nuisance: modAs[Q, publicreportNuisanceColumns]{ - c: PublicreportNuisances.Columns, - f: func(to publicreportNuisanceColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportNuisances.Name().As(to.Alias())).On( - to.ID.EQ(cols.NuisanceID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/publicreport.notify_email_pool.bob.go b/db/models/publicreport.notify_email_pool.bob.go index 97f68e2b..34eaba58 100644 --- a/db/models/publicreport.notify_email_pool.bob.go +++ b/db/models/publicreport.notify_email_pool.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/null" @@ -795,47 +794,3 @@ func (os PublicreportNotifyEmailPoolSlice) LoadPool(ctx context.Context, exec bo return nil } - -type publicreportNotifyEmailPoolJoins[Q dialect.Joinable] struct { - typ string - EmailAddressEmailContact modAs[Q, commsEmailContactColumns] - Pool modAs[Q, publicreportPoolColumns] -} - -func (j publicreportNotifyEmailPoolJoins[Q]) aliasedAs(alias string) publicreportNotifyEmailPoolJoins[Q] { - return buildPublicreportNotifyEmailPoolJoins[Q](buildPublicreportNotifyEmailPoolColumns(alias), j.typ) -} - -func buildPublicreportNotifyEmailPoolJoins[Q dialect.Joinable](cols publicreportNotifyEmailPoolColumns, typ string) publicreportNotifyEmailPoolJoins[Q] { - return publicreportNotifyEmailPoolJoins[Q]{ - typ: typ, - EmailAddressEmailContact: modAs[Q, commsEmailContactColumns]{ - c: CommsEmailContacts.Columns, - f: func(to commsEmailContactColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsEmailContacts.Name().As(to.Alias())).On( - to.Address.EQ(cols.EmailAddress), - )) - } - - return mods - }, - }, - Pool: modAs[Q, publicreportPoolColumns]{ - c: PublicreportPools.Columns, - f: func(to publicreportPoolColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportPools.Name().As(to.Alias())).On( - to.ID.EQ(cols.PoolID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/publicreport.notify_phone_nuisance.bob.go b/db/models/publicreport.notify_phone_nuisance.bob.go index d37386e8..a88f06ec 100644 --- a/db/models/publicreport.notify_phone_nuisance.bob.go +++ b/db/models/publicreport.notify_phone_nuisance.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/null" @@ -795,47 +794,3 @@ func (os PublicreportNotifyPhoneNuisanceSlice) LoadPhoneE164Phone(ctx context.Co return nil } - -type publicreportNotifyPhoneNuisanceJoins[Q dialect.Joinable] struct { - typ string - Nuisance modAs[Q, publicreportNuisanceColumns] - PhoneE164Phone modAs[Q, commsPhoneColumns] -} - -func (j publicreportNotifyPhoneNuisanceJoins[Q]) aliasedAs(alias string) publicreportNotifyPhoneNuisanceJoins[Q] { - return buildPublicreportNotifyPhoneNuisanceJoins[Q](buildPublicreportNotifyPhoneNuisanceColumns(alias), j.typ) -} - -func buildPublicreportNotifyPhoneNuisanceJoins[Q dialect.Joinable](cols publicreportNotifyPhoneNuisanceColumns, typ string) publicreportNotifyPhoneNuisanceJoins[Q] { - return publicreportNotifyPhoneNuisanceJoins[Q]{ - typ: typ, - Nuisance: modAs[Q, publicreportNuisanceColumns]{ - c: PublicreportNuisances.Columns, - f: func(to publicreportNuisanceColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportNuisances.Name().As(to.Alias())).On( - to.ID.EQ(cols.NuisanceID), - )) - } - - return mods - }, - }, - PhoneE164Phone: modAs[Q, commsPhoneColumns]{ - c: CommsPhones.Columns, - f: func(to commsPhoneColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsPhones.Name().As(to.Alias())).On( - to.E164.EQ(cols.PhoneE164), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/publicreport.notify_phone_pool.bob.go b/db/models/publicreport.notify_phone_pool.bob.go index 8c60c3a7..eba92b9a 100644 --- a/db/models/publicreport.notify_phone_pool.bob.go +++ b/db/models/publicreport.notify_phone_pool.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/null" @@ -795,47 +794,3 @@ func (os PublicreportNotifyPhonePoolSlice) LoadPool(ctx context.Context, exec bo return nil } - -type publicreportNotifyPhonePoolJoins[Q dialect.Joinable] struct { - typ string - PhoneE164Phone modAs[Q, commsPhoneColumns] - Pool modAs[Q, publicreportPoolColumns] -} - -func (j publicreportNotifyPhonePoolJoins[Q]) aliasedAs(alias string) publicreportNotifyPhonePoolJoins[Q] { - return buildPublicreportNotifyPhonePoolJoins[Q](buildPublicreportNotifyPhonePoolColumns(alias), j.typ) -} - -func buildPublicreportNotifyPhonePoolJoins[Q dialect.Joinable](cols publicreportNotifyPhonePoolColumns, typ string) publicreportNotifyPhonePoolJoins[Q] { - return publicreportNotifyPhonePoolJoins[Q]{ - typ: typ, - PhoneE164Phone: modAs[Q, commsPhoneColumns]{ - c: CommsPhones.Columns, - f: func(to commsPhoneColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsPhones.Name().As(to.Alias())).On( - to.E164.EQ(cols.PhoneE164), - )) - } - - return mods - }, - }, - Pool: modAs[Q, publicreportPoolColumns]{ - c: PublicreportPools.Columns, - f: func(to publicreportPoolColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportPools.Name().As(to.Alias())).On( - to.ID.EQ(cols.PoolID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/publicreport.nuisance.bob.go b/db/models/publicreport.nuisance.bob.go index f0734de8..d997b53c 100644 --- a/db/models/publicreport.nuisance.bob.go +++ b/db/models/publicreport.nuisance.bob.go @@ -7,7 +7,6 @@ import ( "context" "fmt" "io" - "strconv" "time" "github.com/Gleipnir-Technology/bob" @@ -17,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -66,8 +64,6 @@ type PublicreportNuisance struct { ReporterContactConsent null.Val[bool] `db:"reporter_contact_consent" ` R publicreportNuisanceR `db:"-" ` - - C publicreportNuisanceC `db:"-" ` } // PublicreportNuisanceSlice is an alias for a slice of pointers to PublicreportNuisance. @@ -1963,303 +1959,3 @@ func (os PublicreportNuisanceSlice) LoadImages(ctx context.Context, exec bob.Exe return nil } - -// publicreportNuisanceC is where relationship counts are stored. -type publicreportNuisanceC struct { - NotifyEmailNuisances *int64 - NotifyPhoneNuisances *int64 - Images *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *PublicreportNuisance) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "NotifyEmailNuisances": - o.C.NotifyEmailNuisances = &count - case "NotifyPhoneNuisances": - o.C.NotifyPhoneNuisances = &count - case "Images": - o.C.Images = &count - } - return nil -} - -type publicreportNuisanceCountPreloader struct { - NotifyEmailNuisances func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - NotifyPhoneNuisances func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Images func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildPublicreportNuisanceCountPreloader() publicreportNuisanceCountPreloader { - return publicreportNuisanceCountPreloader{ - NotifyEmailNuisances: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*PublicreportNuisance]("NotifyEmailNuisances", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = PublicreportNuisances.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(PublicreportNotifyEmailNuisances.Name()), - sm.Where(psql.Quote(PublicreportNotifyEmailNuisances.Alias(), "nuisance_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - NotifyPhoneNuisances: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*PublicreportNuisance]("NotifyPhoneNuisances", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = PublicreportNuisances.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(PublicreportNotifyPhoneNuisances.Name()), - sm.Where(psql.Quote(PublicreportNotifyPhoneNuisances.Alias(), "nuisance_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Images: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*PublicreportNuisance]("Images", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = PublicreportNuisances.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(PublicreportNuisanceImages.Name()), - sm.Where(psql.Quote(PublicreportNuisanceImages.Alias(), "nuisance_id").EQ(psql.Quote(parent, "id"))), - sm.InnerJoin(PublicreportImages.Name()).On( - psql.Quote(PublicreportImages.Alias(), "id").EQ(psql.Quote(PublicreportNuisanceImages.Alias(), "image_id")), - ), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type publicreportNuisanceCountThenLoader[Q orm.Loadable] struct { - NotifyEmailNuisances func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - NotifyPhoneNuisances func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - Images func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildPublicreportNuisanceCountThenLoader[Q orm.Loadable]() publicreportNuisanceCountThenLoader[Q] { - type NotifyEmailNuisancesCountInterface interface { - LoadCountNotifyEmailNuisances(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type NotifyPhoneNuisancesCountInterface interface { - LoadCountNotifyPhoneNuisances(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type ImagesCountInterface interface { - LoadCountImages(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return publicreportNuisanceCountThenLoader[Q]{ - NotifyEmailNuisances: countThenLoadBuilder[Q]( - "NotifyEmailNuisances", - func(ctx context.Context, exec bob.Executor, retrieved NotifyEmailNuisancesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountNotifyEmailNuisances(ctx, exec, mods...) - }, - ), - NotifyPhoneNuisances: countThenLoadBuilder[Q]( - "NotifyPhoneNuisances", - func(ctx context.Context, exec bob.Executor, retrieved NotifyPhoneNuisancesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountNotifyPhoneNuisances(ctx, exec, mods...) - }, - ), - Images: countThenLoadBuilder[Q]( - "Images", - func(ctx context.Context, exec bob.Executor, retrieved ImagesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountImages(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountNotifyEmailNuisances loads the count of NotifyEmailNuisances into the C struct -func (o *PublicreportNuisance) LoadCountNotifyEmailNuisances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.NotifyEmailNuisances(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.NotifyEmailNuisances = &count - return nil -} - -// LoadCountNotifyEmailNuisances loads the count of NotifyEmailNuisances for a slice -func (os PublicreportNuisanceSlice) LoadCountNotifyEmailNuisances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountNotifyEmailNuisances(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountNotifyPhoneNuisances loads the count of NotifyPhoneNuisances into the C struct -func (o *PublicreportNuisance) LoadCountNotifyPhoneNuisances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.NotifyPhoneNuisances(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.NotifyPhoneNuisances = &count - return nil -} - -// LoadCountNotifyPhoneNuisances loads the count of NotifyPhoneNuisances for a slice -func (os PublicreportNuisanceSlice) LoadCountNotifyPhoneNuisances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountNotifyPhoneNuisances(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountImages loads the count of Images into the C struct -func (o *PublicreportNuisance) LoadCountImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Images(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Images = &count - return nil -} - -// LoadCountImages loads the count of Images for a slice -func (os PublicreportNuisanceSlice) LoadCountImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountImages(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type publicreportNuisanceJoins[Q dialect.Joinable] struct { - typ string - NotifyEmailNuisances modAs[Q, publicreportNotifyEmailNuisanceColumns] - NotifyPhoneNuisances modAs[Q, publicreportNotifyPhoneNuisanceColumns] - Organization modAs[Q, organizationColumns] - Images modAs[Q, publicreportImageColumns] -} - -func (j publicreportNuisanceJoins[Q]) aliasedAs(alias string) publicreportNuisanceJoins[Q] { - return buildPublicreportNuisanceJoins[Q](buildPublicreportNuisanceColumns(alias), j.typ) -} - -func buildPublicreportNuisanceJoins[Q dialect.Joinable](cols publicreportNuisanceColumns, typ string) publicreportNuisanceJoins[Q] { - return publicreportNuisanceJoins[Q]{ - typ: typ, - NotifyEmailNuisances: modAs[Q, publicreportNotifyEmailNuisanceColumns]{ - c: PublicreportNotifyEmailNuisances.Columns, - f: func(to publicreportNotifyEmailNuisanceColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportNotifyEmailNuisances.Name().As(to.Alias())).On( - to.NuisanceID.EQ(cols.ID), - )) - } - - return mods - }, - }, - NotifyPhoneNuisances: modAs[Q, publicreportNotifyPhoneNuisanceColumns]{ - c: PublicreportNotifyPhoneNuisances.Columns, - f: func(to publicreportNotifyPhoneNuisanceColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportNotifyPhoneNuisances.Name().As(to.Alias())).On( - to.NuisanceID.EQ(cols.ID), - )) - } - - 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 - }, - }, - Images: modAs[Q, publicreportImageColumns]{ - c: PublicreportImages.Columns, - f: func(to publicreportImageColumns) bob.Mod[Q] { - random := strconv.FormatInt(randInt(), 10) - mods := make(mods.QueryMods[Q], 0, 2) - - { - to := PublicreportNuisanceImages.Columns.AliasedAs(PublicreportNuisanceImages.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, PublicreportNuisanceImages.Name().As(to.Alias())).On( - to.NuisanceID.EQ(cols.ID), - )) - } - { - cols := PublicreportNuisanceImages.Columns.AliasedAs(PublicreportNuisanceImages.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, PublicreportImages.Name().As(to.Alias())).On( - to.ID.EQ(cols.ImageID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/publicreport.nuisance_image.bob.go b/db/models/publicreport.nuisance_image.bob.go index 5464a396..414782e8 100644 --- a/db/models/publicreport.nuisance_image.bob.go +++ b/db/models/publicreport.nuisance_image.bob.go @@ -15,7 +15,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/omit" @@ -720,47 +719,3 @@ func (os PublicreportNuisanceImageSlice) LoadNuisance(ctx context.Context, exec return nil } - -type publicreportNuisanceImageJoins[Q dialect.Joinable] struct { - typ string - Image modAs[Q, publicreportImageColumns] - Nuisance modAs[Q, publicreportNuisanceColumns] -} - -func (j publicreportNuisanceImageJoins[Q]) aliasedAs(alias string) publicreportNuisanceImageJoins[Q] { - return buildPublicreportNuisanceImageJoins[Q](buildPublicreportNuisanceImageColumns(alias), j.typ) -} - -func buildPublicreportNuisanceImageJoins[Q dialect.Joinable](cols publicreportNuisanceImageColumns, typ string) publicreportNuisanceImageJoins[Q] { - return publicreportNuisanceImageJoins[Q]{ - typ: typ, - Image: modAs[Q, publicreportImageColumns]{ - c: PublicreportImages.Columns, - f: func(to publicreportImageColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportImages.Name().As(to.Alias())).On( - to.ID.EQ(cols.ImageID), - )) - } - - return mods - }, - }, - Nuisance: modAs[Q, publicreportNuisanceColumns]{ - c: PublicreportNuisances.Columns, - f: func(to publicreportNuisanceColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportNuisances.Name().As(to.Alias())).On( - to.ID.EQ(cols.NuisanceID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/publicreport.pool.bob.go b/db/models/publicreport.pool.bob.go index 46b924cb..c806c622 100644 --- a/db/models/publicreport.pool.bob.go +++ b/db/models/publicreport.pool.bob.go @@ -7,7 +7,6 @@ import ( "context" "fmt" "io" - "strconv" "time" "github.com/Gleipnir-Technology/bob" @@ -17,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -65,8 +63,6 @@ type PublicreportPool struct { ReporterContactConsent null.Val[bool] `db:"reporter_contact_consent" ` R publicreportPoolR `db:"-" ` - - C publicreportPoolC `db:"-" ` } // PublicreportPoolSlice is an alias for a slice of pointers to PublicreportPool. @@ -1938,303 +1934,3 @@ func (os PublicreportPoolSlice) LoadImages(ctx context.Context, exec bob.Executo return nil } - -// publicreportPoolC is where relationship counts are stored. -type publicreportPoolC struct { - NotifyEmailPools *int64 - NotifyPhonePools *int64 - Images *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *PublicreportPool) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "NotifyEmailPools": - o.C.NotifyEmailPools = &count - case "NotifyPhonePools": - o.C.NotifyPhonePools = &count - case "Images": - o.C.Images = &count - } - return nil -} - -type publicreportPoolCountPreloader struct { - NotifyEmailPools func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - NotifyPhonePools func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Images func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildPublicreportPoolCountPreloader() publicreportPoolCountPreloader { - return publicreportPoolCountPreloader{ - NotifyEmailPools: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*PublicreportPool]("NotifyEmailPools", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = PublicreportPools.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(PublicreportNotifyEmailPools.Name()), - sm.Where(psql.Quote(PublicreportNotifyEmailPools.Alias(), "pool_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - NotifyPhonePools: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*PublicreportPool]("NotifyPhonePools", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = PublicreportPools.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(PublicreportNotifyPhonePools.Name()), - sm.Where(psql.Quote(PublicreportNotifyPhonePools.Alias(), "pool_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Images: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*PublicreportPool]("Images", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = PublicreportPools.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(PublicreportPoolImages.Name()), - sm.Where(psql.Quote(PublicreportPoolImages.Alias(), "pool_id").EQ(psql.Quote(parent, "id"))), - sm.InnerJoin(PublicreportImages.Name()).On( - psql.Quote(PublicreportImages.Alias(), "id").EQ(psql.Quote(PublicreportPoolImages.Alias(), "image_id")), - ), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type publicreportPoolCountThenLoader[Q orm.Loadable] struct { - NotifyEmailPools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - NotifyPhonePools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - Images func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildPublicreportPoolCountThenLoader[Q orm.Loadable]() publicreportPoolCountThenLoader[Q] { - type NotifyEmailPoolsCountInterface interface { - LoadCountNotifyEmailPools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type NotifyPhonePoolsCountInterface interface { - LoadCountNotifyPhonePools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type ImagesCountInterface interface { - LoadCountImages(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return publicreportPoolCountThenLoader[Q]{ - NotifyEmailPools: countThenLoadBuilder[Q]( - "NotifyEmailPools", - func(ctx context.Context, exec bob.Executor, retrieved NotifyEmailPoolsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountNotifyEmailPools(ctx, exec, mods...) - }, - ), - NotifyPhonePools: countThenLoadBuilder[Q]( - "NotifyPhonePools", - func(ctx context.Context, exec bob.Executor, retrieved NotifyPhonePoolsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountNotifyPhonePools(ctx, exec, mods...) - }, - ), - Images: countThenLoadBuilder[Q]( - "Images", - func(ctx context.Context, exec bob.Executor, retrieved ImagesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountImages(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountNotifyEmailPools loads the count of NotifyEmailPools into the C struct -func (o *PublicreportPool) LoadCountNotifyEmailPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.NotifyEmailPools(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.NotifyEmailPools = &count - return nil -} - -// LoadCountNotifyEmailPools loads the count of NotifyEmailPools for a slice -func (os PublicreportPoolSlice) LoadCountNotifyEmailPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountNotifyEmailPools(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountNotifyPhonePools loads the count of NotifyPhonePools into the C struct -func (o *PublicreportPool) LoadCountNotifyPhonePools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.NotifyPhonePools(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.NotifyPhonePools = &count - return nil -} - -// LoadCountNotifyPhonePools loads the count of NotifyPhonePools for a slice -func (os PublicreportPoolSlice) LoadCountNotifyPhonePools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountNotifyPhonePools(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountImages loads the count of Images into the C struct -func (o *PublicreportPool) LoadCountImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Images(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Images = &count - return nil -} - -// LoadCountImages loads the count of Images for a slice -func (os PublicreportPoolSlice) LoadCountImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountImages(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type publicreportPoolJoins[Q dialect.Joinable] struct { - typ string - NotifyEmailPools modAs[Q, publicreportNotifyEmailPoolColumns] - NotifyPhonePools modAs[Q, publicreportNotifyPhonePoolColumns] - Organization modAs[Q, organizationColumns] - Images modAs[Q, publicreportImageColumns] -} - -func (j publicreportPoolJoins[Q]) aliasedAs(alias string) publicreportPoolJoins[Q] { - return buildPublicreportPoolJoins[Q](buildPublicreportPoolColumns(alias), j.typ) -} - -func buildPublicreportPoolJoins[Q dialect.Joinable](cols publicreportPoolColumns, typ string) publicreportPoolJoins[Q] { - return publicreportPoolJoins[Q]{ - typ: typ, - NotifyEmailPools: modAs[Q, publicreportNotifyEmailPoolColumns]{ - c: PublicreportNotifyEmailPools.Columns, - f: func(to publicreportNotifyEmailPoolColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportNotifyEmailPools.Name().As(to.Alias())).On( - to.PoolID.EQ(cols.ID), - )) - } - - return mods - }, - }, - NotifyPhonePools: modAs[Q, publicreportNotifyPhonePoolColumns]{ - c: PublicreportNotifyPhonePools.Columns, - f: func(to publicreportNotifyPhonePoolColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportNotifyPhonePools.Name().As(to.Alias())).On( - to.PoolID.EQ(cols.ID), - )) - } - - 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 - }, - }, - Images: modAs[Q, publicreportImageColumns]{ - c: PublicreportImages.Columns, - f: func(to publicreportImageColumns) bob.Mod[Q] { - random := strconv.FormatInt(randInt(), 10) - mods := make(mods.QueryMods[Q], 0, 2) - - { - to := PublicreportPoolImages.Columns.AliasedAs(PublicreportPoolImages.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, PublicreportPoolImages.Name().As(to.Alias())).On( - to.PoolID.EQ(cols.ID), - )) - } - { - cols := PublicreportPoolImages.Columns.AliasedAs(PublicreportPoolImages.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, PublicreportImages.Name().As(to.Alias())).On( - to.ID.EQ(cols.ImageID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/publicreport.pool_image.bob.go b/db/models/publicreport.pool_image.bob.go index 289ae655..8e1c3eab 100644 --- a/db/models/publicreport.pool_image.bob.go +++ b/db/models/publicreport.pool_image.bob.go @@ -15,7 +15,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/omit" @@ -720,47 +719,3 @@ func (os PublicreportPoolImageSlice) LoadPool(ctx context.Context, exec bob.Exec return nil } - -type publicreportPoolImageJoins[Q dialect.Joinable] struct { - typ string - Image modAs[Q, publicreportImageColumns] - Pool modAs[Q, publicreportPoolColumns] -} - -func (j publicreportPoolImageJoins[Q]) aliasedAs(alias string) publicreportPoolImageJoins[Q] { - return buildPublicreportPoolImageJoins[Q](buildPublicreportPoolImageColumns(alias), j.typ) -} - -func buildPublicreportPoolImageJoins[Q dialect.Joinable](cols publicreportPoolImageColumns, typ string) publicreportPoolImageJoins[Q] { - return publicreportPoolImageJoins[Q]{ - typ: typ, - Image: modAs[Q, publicreportImageColumns]{ - c: PublicreportImages.Columns, - f: func(to publicreportImageColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportImages.Name().As(to.Alias())).On( - to.ID.EQ(cols.ImageID), - )) - } - - return mods - }, - }, - Pool: modAs[Q, publicreportPoolColumns]{ - c: PublicreportPools.Columns, - f: func(to publicreportPoolColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportPools.Name().As(to.Alias())).On( - to.ID.EQ(cols.PoolID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/publicreport.quick.bob.go b/db/models/publicreport.quick.bob.go index 3e4ae67d..05a582ef 100644 --- a/db/models/publicreport.quick.bob.go +++ b/db/models/publicreport.quick.bob.go @@ -7,7 +7,6 @@ import ( "context" "fmt" "io" - "strconv" "time" "github.com/Gleipnir-Technology/bob" @@ -17,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -42,8 +40,6 @@ type PublicreportQuick struct { OrganizationID null.Val[int32] `db:"organization_id" ` R publicreportQuickR `db:"-" ` - - C publicreportQuickC `db:"-" ` } // PublicreportQuickSlice is an alias for a slice of pointers to PublicreportQuick. @@ -1007,151 +1003,3 @@ func (os PublicreportQuickSlice) LoadImages(ctx context.Context, exec bob.Execut return nil } - -// publicreportQuickC is where relationship counts are stored. -type publicreportQuickC struct { - Images *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *PublicreportQuick) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "Images": - o.C.Images = &count - } - return nil -} - -type publicreportQuickCountPreloader struct { - Images func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildPublicreportQuickCountPreloader() publicreportQuickCountPreloader { - return publicreportQuickCountPreloader{ - Images: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*PublicreportQuick]("Images", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = PublicreportQuicks.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(PublicreportQuickImages.Name()), - sm.Where(psql.Quote(PublicreportQuickImages.Alias(), "quick_id").EQ(psql.Quote(parent, "id"))), - sm.InnerJoin(PublicreportImages.Name()).On( - psql.Quote(PublicreportImages.Alias(), "id").EQ(psql.Quote(PublicreportQuickImages.Alias(), "image_id")), - ), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type publicreportQuickCountThenLoader[Q orm.Loadable] struct { - Images func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildPublicreportQuickCountThenLoader[Q orm.Loadable]() publicreportQuickCountThenLoader[Q] { - type ImagesCountInterface interface { - LoadCountImages(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return publicreportQuickCountThenLoader[Q]{ - Images: countThenLoadBuilder[Q]( - "Images", - func(ctx context.Context, exec bob.Executor, retrieved ImagesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountImages(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountImages loads the count of Images into the C struct -func (o *PublicreportQuick) LoadCountImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Images(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Images = &count - return nil -} - -// LoadCountImages loads the count of Images for a slice -func (os PublicreportQuickSlice) LoadCountImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountImages(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type publicreportQuickJoins[Q dialect.Joinable] struct { - typ string - Organization modAs[Q, organizationColumns] - Images modAs[Q, publicreportImageColumns] -} - -func (j publicreportQuickJoins[Q]) aliasedAs(alias string) publicreportQuickJoins[Q] { - return buildPublicreportQuickJoins[Q](buildPublicreportQuickColumns(alias), j.typ) -} - -func buildPublicreportQuickJoins[Q dialect.Joinable](cols publicreportQuickColumns, typ string) publicreportQuickJoins[Q] { - return publicreportQuickJoins[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 - }, - }, - Images: modAs[Q, publicreportImageColumns]{ - c: PublicreportImages.Columns, - f: func(to publicreportImageColumns) bob.Mod[Q] { - random := strconv.FormatInt(randInt(), 10) - mods := make(mods.QueryMods[Q], 0, 2) - - { - to := PublicreportQuickImages.Columns.AliasedAs(PublicreportQuickImages.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, PublicreportQuickImages.Name().As(to.Alias())).On( - to.QuickID.EQ(cols.ID), - )) - } - { - cols := PublicreportQuickImages.Columns.AliasedAs(PublicreportQuickImages.Columns.Alias() + random) - mods = append(mods, dialect.Join[Q](typ, PublicreportImages.Name().As(to.Alias())).On( - to.ID.EQ(cols.ImageID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/publicreport.quick_image.bob.go b/db/models/publicreport.quick_image.bob.go index 5bf0c644..38429e87 100644 --- a/db/models/publicreport.quick_image.bob.go +++ b/db/models/publicreport.quick_image.bob.go @@ -15,7 +15,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/omit" @@ -720,47 +719,3 @@ func (os PublicreportQuickImageSlice) LoadQuick(ctx context.Context, exec bob.Ex return nil } - -type publicreportQuickImageJoins[Q dialect.Joinable] struct { - typ string - Image modAs[Q, publicreportImageColumns] - Quick modAs[Q, publicreportQuickColumns] -} - -func (j publicreportQuickImageJoins[Q]) aliasedAs(alias string) publicreportQuickImageJoins[Q] { - return buildPublicreportQuickImageJoins[Q](buildPublicreportQuickImageColumns(alias), j.typ) -} - -func buildPublicreportQuickImageJoins[Q dialect.Joinable](cols publicreportQuickImageColumns, typ string) publicreportQuickImageJoins[Q] { - return publicreportQuickImageJoins[Q]{ - typ: typ, - Image: modAs[Q, publicreportImageColumns]{ - c: PublicreportImages.Columns, - f: func(to publicreportImageColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportImages.Name().As(to.Alias())).On( - to.ID.EQ(cols.ImageID), - )) - } - - return mods - }, - }, - Quick: modAs[Q, publicreportQuickColumns]{ - c: PublicreportQuicks.Columns, - f: func(to publicreportQuickColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, PublicreportQuicks.Name().As(to.Alias())).On( - to.ID.EQ(cols.QuickID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/publicreport.subscribe_email.bob.go b/db/models/publicreport.subscribe_email.bob.go index 82f5b547..ff986bee 100644 --- a/db/models/publicreport.subscribe_email.bob.go +++ b/db/models/publicreport.subscribe_email.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/null" @@ -624,32 +623,3 @@ func (os PublicreportSubscribeEmailSlice) LoadEmailAddressEmailContact(ctx conte return nil } - -type publicreportSubscribeEmailJoins[Q dialect.Joinable] struct { - typ string - EmailAddressEmailContact modAs[Q, commsEmailContactColumns] -} - -func (j publicreportSubscribeEmailJoins[Q]) aliasedAs(alias string) publicreportSubscribeEmailJoins[Q] { - return buildPublicreportSubscribeEmailJoins[Q](buildPublicreportSubscribeEmailColumns(alias), j.typ) -} - -func buildPublicreportSubscribeEmailJoins[Q dialect.Joinable](cols publicreportSubscribeEmailColumns, typ string) publicreportSubscribeEmailJoins[Q] { - return publicreportSubscribeEmailJoins[Q]{ - typ: typ, - EmailAddressEmailContact: modAs[Q, commsEmailContactColumns]{ - c: CommsEmailContacts.Columns, - f: func(to commsEmailContactColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsEmailContacts.Name().As(to.Alias())).On( - to.Address.EQ(cols.EmailAddress), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/publicreport.subscribe_phone.bob.go b/db/models/publicreport.subscribe_phone.bob.go index b9d60783..17324877 100644 --- a/db/models/publicreport.subscribe_phone.bob.go +++ b/db/models/publicreport.subscribe_phone.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/null" @@ -624,32 +623,3 @@ func (os PublicreportSubscribePhoneSlice) LoadPhoneE164Phone(ctx context.Context return nil } - -type publicreportSubscribePhoneJoins[Q dialect.Joinable] struct { - typ string - PhoneE164Phone modAs[Q, commsPhoneColumns] -} - -func (j publicreportSubscribePhoneJoins[Q]) aliasedAs(alias string) publicreportSubscribePhoneJoins[Q] { - return buildPublicreportSubscribePhoneJoins[Q](buildPublicreportSubscribePhoneColumns(alias), j.typ) -} - -func buildPublicreportSubscribePhoneJoins[Q dialect.Joinable](cols publicreportSubscribePhoneColumns, typ string) publicreportSubscribePhoneJoins[Q] { - return publicreportSubscribePhoneJoins[Q]{ - typ: typ, - PhoneE164Phone: modAs[Q, commsPhoneColumns]{ - c: CommsPhones.Columns, - f: func(to commsPhoneColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsPhones.Name().As(to.Alias())).On( - to.E164.EQ(cols.PhoneE164), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/resident.bob.go b/db/models/resident.bob.go index 919d2877..7148c45a 100644 --- a/db/models/resident.bob.go +++ b/db/models/resident.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/null" @@ -1219,77 +1218,3 @@ func (os ResidentSlice) LoadSite(ctx context.Context, exec bob.Executor, mods .. return nil } - -type residentJoins[Q dialect.Joinable] struct { - typ string - Address modAs[Q, addressColumns] - CreatorUser modAs[Q, userColumns] - PhoneMobilePhone modAs[Q, commsPhoneColumns] - Site modAs[Q, siteColumns] -} - -func (j residentJoins[Q]) aliasedAs(alias string) residentJoins[Q] { - return buildResidentJoins[Q](buildResidentColumns(alias), j.typ) -} - -func buildResidentJoins[Q dialect.Joinable](cols residentColumns, typ string) residentJoins[Q] { - return residentJoins[Q]{ - typ: typ, - Address: modAs[Q, addressColumns]{ - c: Addresses.Columns, - f: func(to addressColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Addresses.Name().As(to.Alias())).On( - to.ID.EQ(cols.AddressID), - )) - } - - return mods - }, - }, - 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.Creator), - )) - } - - return mods - }, - }, - PhoneMobilePhone: modAs[Q, commsPhoneColumns]{ - c: CommsPhones.Columns, - f: func(to commsPhoneColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, CommsPhones.Name().As(to.Alias())).On( - to.E164.EQ(cols.PhoneMobile), - )) - } - - return mods - }, - }, - Site: modAs[Q, siteColumns]{ - c: Sites.Columns, - f: func(to siteColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Sites.Name().As(to.Alias())).On( - to.ID.EQ(cols.SiteID), to.Version.EQ(cols.SiteVersion), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/review_task.bob.go b/db/models/review_task.bob.go new file mode 100644 index 00000000..01d21f7d --- /dev/null +++ b/db/models/review_task.bob.go @@ -0,0 +1,1170 @@ +// Code generated by BobGen psql v0.42.5. 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/Gleipnir-Technology/bob" + "github.com/Gleipnir-Technology/bob/dialect/psql" + "github.com/Gleipnir-Technology/bob/dialect/psql/dialect" + "github.com/Gleipnir-Technology/bob/dialect/psql/dm" + "github.com/Gleipnir-Technology/bob/dialect/psql/sm" + "github.com/Gleipnir-Technology/bob/dialect/psql/um" + "github.com/Gleipnir-Technology/bob/expr" + "github.com/Gleipnir-Technology/bob/orm" + "github.com/Gleipnir-Technology/bob/types/pgtypes" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" +) + +// ReviewTask is an object representing the database table. +type ReviewTask struct { + Created time.Time `db:"created" ` + CreatorID null.Val[int32] `db:"creator_id" ` + ID int32 `db:"id,pk" ` + OrganizationID int32 `db:"organization_id" ` + Reviewed null.Val[time.Time] `db:"reviewed" ` + ReviewerID null.Val[int32] `db:"reviewer_id" ` + + R reviewTaskR `db:"-" ` +} + +// ReviewTaskSlice is an alias for a slice of pointers to ReviewTask. +// This should almost always be used instead of []*ReviewTask. +type ReviewTaskSlice []*ReviewTask + +// ReviewTasks contains methods to work with the review_task table +var ReviewTasks = psql.NewTablex[*ReviewTask, ReviewTaskSlice, *ReviewTaskSetter]("", "review_task", buildReviewTaskColumns("review_task")) + +// ReviewTasksQuery is a query on the review_task table +type ReviewTasksQuery = *psql.ViewQuery[*ReviewTask, ReviewTaskSlice] + +// reviewTaskR is where relationships are stored. +type reviewTaskR struct { + CreatorUser *User // review_task.review_task_creator_id_fkey + Organization *Organization // review_task.review_task_organization_id_fkey + ReviewerUser *User // review_task.review_task_reviewer_id_fkey + ReviewTaskPool *ReviewTaskPool // review_task_pool.review_task_pool_review_task_id_fkey +} + +func buildReviewTaskColumns(alias string) reviewTaskColumns { + return reviewTaskColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "created", "creator_id", "id", "organization_id", "reviewed", "reviewer_id", + ).WithParent("review_task"), + tableAlias: alias, + Created: psql.Quote(alias, "created"), + CreatorID: psql.Quote(alias, "creator_id"), + ID: psql.Quote(alias, "id"), + OrganizationID: psql.Quote(alias, "organization_id"), + Reviewed: psql.Quote(alias, "reviewed"), + ReviewerID: psql.Quote(alias, "reviewer_id"), + } +} + +type reviewTaskColumns struct { + expr.ColumnsExpr + tableAlias string + Created psql.Expression + CreatorID psql.Expression + ID psql.Expression + OrganizationID psql.Expression + Reviewed psql.Expression + ReviewerID psql.Expression +} + +func (c reviewTaskColumns) Alias() string { + return c.tableAlias +} + +func (reviewTaskColumns) AliasedAs(alias string) reviewTaskColumns { + return buildReviewTaskColumns(alias) +} + +// ReviewTaskSetter is used for insert/upsert/update operations +// All values are optional, and do not have to be set +// Generated columns are not included +type ReviewTaskSetter struct { + Created omit.Val[time.Time] `db:"created" ` + CreatorID omitnull.Val[int32] `db:"creator_id" ` + ID omit.Val[int32] `db:"id,pk" ` + OrganizationID omit.Val[int32] `db:"organization_id" ` + Reviewed omitnull.Val[time.Time] `db:"reviewed" ` + ReviewerID omitnull.Val[int32] `db:"reviewer_id" ` +} + +func (s ReviewTaskSetter) SetColumns() []string { + vals := make([]string, 0, 6) + if s.Created.IsValue() { + vals = append(vals, "created") + } + if !s.CreatorID.IsUnset() { + vals = append(vals, "creator_id") + } + if s.ID.IsValue() { + vals = append(vals, "id") + } + if s.OrganizationID.IsValue() { + vals = append(vals, "organization_id") + } + if !s.Reviewed.IsUnset() { + vals = append(vals, "reviewed") + } + if !s.ReviewerID.IsUnset() { + vals = append(vals, "reviewer_id") + } + return vals +} + +func (s ReviewTaskSetter) Overwrite(t *ReviewTask) { + if s.Created.IsValue() { + t.Created = s.Created.MustGet() + } + if !s.CreatorID.IsUnset() { + t.CreatorID = s.CreatorID.MustGetNull() + } + if s.ID.IsValue() { + t.ID = s.ID.MustGet() + } + if s.OrganizationID.IsValue() { + t.OrganizationID = s.OrganizationID.MustGet() + } + if !s.Reviewed.IsUnset() { + t.Reviewed = s.Reviewed.MustGetNull() + } + if !s.ReviewerID.IsUnset() { + t.ReviewerID = s.ReviewerID.MustGetNull() + } +} + +func (s *ReviewTaskSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return ReviewTasks.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.Created.IsValue() { + vals[0] = psql.Arg(s.Created.MustGet()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.CreatorID.IsUnset() { + vals[1] = psql.Arg(s.CreatorID.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if s.ID.IsValue() { + vals[2] = psql.Arg(s.ID.MustGet()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if s.OrganizationID.IsValue() { + vals[3] = psql.Arg(s.OrganizationID.MustGet()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + if !s.Reviewed.IsUnset() { + vals[4] = psql.Arg(s.Reviewed.MustGetNull()) + } else { + vals[4] = psql.Raw("DEFAULT") + } + + if !s.ReviewerID.IsUnset() { + vals[5] = psql.Arg(s.ReviewerID.MustGetNull()) + } else { + vals[5] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s ReviewTaskSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s ReviewTaskSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 6) + + 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.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "creator_id")...), + psql.Arg(s.CreatorID), + }}) + } + + if s.ID.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "id")...), + psql.Arg(s.ID), + }}) + } + + 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.Reviewed.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewed")...), + psql.Arg(s.Reviewed), + }}) + } + + if !s.ReviewerID.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "reviewer_id")...), + psql.Arg(s.ReviewerID), + }}) + } + + return exprs +} + +// FindReviewTask retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindReviewTask(ctx context.Context, exec bob.Executor, IDPK int32, cols ...string) (*ReviewTask, error) { + if len(cols) == 0 { + return ReviewTasks.Query( + sm.Where(ReviewTasks.Columns.ID.EQ(psql.Arg(IDPK))), + ).One(ctx, exec) + } + + return ReviewTasks.Query( + sm.Where(ReviewTasks.Columns.ID.EQ(psql.Arg(IDPK))), + sm.Columns(ReviewTasks.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// ReviewTaskExists checks the presence of a single record by primary key +func ReviewTaskExists(ctx context.Context, exec bob.Executor, IDPK int32) (bool, error) { + return ReviewTasks.Query( + sm.Where(ReviewTasks.Columns.ID.EQ(psql.Arg(IDPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after ReviewTask is retrieved from the database +func (o *ReviewTask) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = ReviewTasks.AfterSelectHooks.RunHooks(ctx, exec, ReviewTaskSlice{o}) + case bob.QueryTypeInsert: + ctx, err = ReviewTasks.AfterInsertHooks.RunHooks(ctx, exec, ReviewTaskSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = ReviewTasks.AfterUpdateHooks.RunHooks(ctx, exec, ReviewTaskSlice{o}) + case bob.QueryTypeDelete: + ctx, err = ReviewTasks.AfterDeleteHooks.RunHooks(ctx, exec, ReviewTaskSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the ReviewTask +func (o *ReviewTask) primaryKeyVals() bob.Expression { + return psql.Arg(o.ID) +} + +func (o *ReviewTask) pkEQ() dialect.Expression { + return psql.Quote("review_task", "id").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 ReviewTask +func (o *ReviewTask) Update(ctx context.Context, exec bob.Executor, s *ReviewTaskSetter) error { + v, err := ReviewTasks.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 ReviewTask record with an executor +func (o *ReviewTask) Delete(ctx context.Context, exec bob.Executor) error { + _, err := ReviewTasks.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the ReviewTask using the executor +func (o *ReviewTask) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := ReviewTasks.Query( + sm.Where(ReviewTasks.Columns.ID.EQ(psql.Arg(o.ID))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after ReviewTaskSlice is retrieved from the database +func (o ReviewTaskSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = ReviewTasks.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = ReviewTasks.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = ReviewTasks.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = ReviewTasks.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o ReviewTaskSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("review_task", "id").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 ReviewTaskSlice) copyMatchingRows(from ...*ReviewTask) { + for i, old := range o { + for _, new := range from { + if new.ID != old.ID { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o ReviewTaskSlice) 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 ReviewTasks.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 *ReviewTask: + o.copyMatchingRows(retrieved) + case []*ReviewTask: + o.copyMatchingRows(retrieved...) + case ReviewTaskSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a ReviewTask or a slice of ReviewTask + // then run the AfterUpdateHooks on the slice + _, err = ReviewTasks.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o ReviewTaskSlice) 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 ReviewTasks.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 *ReviewTask: + o.copyMatchingRows(retrieved) + case []*ReviewTask: + o.copyMatchingRows(retrieved...) + case ReviewTaskSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a ReviewTask or a slice of ReviewTask + // then run the AfterDeleteHooks on the slice + _, err = ReviewTasks.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o ReviewTaskSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals ReviewTaskSetter) error { + if len(o) == 0 { + return nil + } + + _, err := ReviewTasks.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o ReviewTaskSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := ReviewTasks.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o ReviewTaskSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := ReviewTasks.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 *ReviewTask) CreatorUser(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery { + return Users.Query(append(mods, + sm.Where(Users.Columns.ID.EQ(psql.Arg(o.CreatorID))), + )...) +} + +func (os ReviewTaskSlice) CreatorUser(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery { + pkCreatorID := make(pgtypes.Array[null.Val[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)), + )...) +} + +// Organization starts a query for related objects on organization +func (o *ReviewTask) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery { + return Organizations.Query(append(mods, + sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))), + )...) +} + +func (os ReviewTaskSlice) 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)), + )...) +} + +// ReviewerUser starts a query for related objects on user_ +func (o *ReviewTask) ReviewerUser(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery { + return Users.Query(append(mods, + sm.Where(Users.Columns.ID.EQ(psql.Arg(o.ReviewerID))), + )...) +} + +func (os ReviewTaskSlice) ReviewerUser(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery { + pkReviewerID := make(pgtypes.Array[null.Val[int32]], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkReviewerID = append(pkReviewerID, o.ReviewerID) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkReviewerID), "integer[]")), + )) + + return Users.Query(append(mods, + sm.Where(psql.Group(Users.Columns.ID).OP("IN", PKArgExpr)), + )...) +} + +// ReviewTaskPool starts a query for related objects on review_task_pool +func (o *ReviewTask) ReviewTaskPool(mods ...bob.Mod[*dialect.SelectQuery]) ReviewTaskPoolsQuery { + return ReviewTaskPools.Query(append(mods, + sm.Where(ReviewTaskPools.Columns.ReviewTaskID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os ReviewTaskSlice) ReviewTaskPool(mods ...bob.Mod[*dialect.SelectQuery]) ReviewTaskPoolsQuery { + 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 ReviewTaskPools.Query(append(mods, + sm.Where(psql.Group(ReviewTaskPools.Columns.ReviewTaskID).OP("IN", PKArgExpr)), + )...) +} + +func attachReviewTaskCreatorUser0(ctx context.Context, exec bob.Executor, count int, reviewTask0 *ReviewTask, user1 *User) (*ReviewTask, error) { + setter := &ReviewTaskSetter{ + CreatorID: omitnull.From(user1.ID), + } + + err := reviewTask0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachReviewTaskCreatorUser0: %w", err) + } + + return reviewTask0, nil +} + +func (reviewTask0 *ReviewTask) 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 = attachReviewTaskCreatorUser0(ctx, exec, 1, reviewTask0, user1) + if err != nil { + return err + } + + reviewTask0.R.CreatorUser = user1 + + user1.R.CreatorReviewTasks = append(user1.R.CreatorReviewTasks, reviewTask0) + + return nil +} + +func (reviewTask0 *ReviewTask) AttachCreatorUser(ctx context.Context, exec bob.Executor, user1 *User) error { + var err error + + _, err = attachReviewTaskCreatorUser0(ctx, exec, 1, reviewTask0, user1) + if err != nil { + return err + } + + reviewTask0.R.CreatorUser = user1 + + user1.R.CreatorReviewTasks = append(user1.R.CreatorReviewTasks, reviewTask0) + + return nil +} + +func attachReviewTaskOrganization0(ctx context.Context, exec bob.Executor, count int, reviewTask0 *ReviewTask, organization1 *Organization) (*ReviewTask, error) { + setter := &ReviewTaskSetter{ + OrganizationID: omit.From(organization1.ID), + } + + err := reviewTask0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachReviewTaskOrganization0: %w", err) + } + + return reviewTask0, nil +} + +func (reviewTask0 *ReviewTask) 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 = attachReviewTaskOrganization0(ctx, exec, 1, reviewTask0, organization1) + if err != nil { + return err + } + + reviewTask0.R.Organization = organization1 + + organization1.R.ReviewTasks = append(organization1.R.ReviewTasks, reviewTask0) + + return nil +} + +func (reviewTask0 *ReviewTask) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error { + var err error + + _, err = attachReviewTaskOrganization0(ctx, exec, 1, reviewTask0, organization1) + if err != nil { + return err + } + + reviewTask0.R.Organization = organization1 + + organization1.R.ReviewTasks = append(organization1.R.ReviewTasks, reviewTask0) + + return nil +} + +func attachReviewTaskReviewerUser0(ctx context.Context, exec bob.Executor, count int, reviewTask0 *ReviewTask, user1 *User) (*ReviewTask, error) { + setter := &ReviewTaskSetter{ + ReviewerID: omitnull.From(user1.ID), + } + + err := reviewTask0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachReviewTaskReviewerUser0: %w", err) + } + + return reviewTask0, nil +} + +func (reviewTask0 *ReviewTask) InsertReviewerUser(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 = attachReviewTaskReviewerUser0(ctx, exec, 1, reviewTask0, user1) + if err != nil { + return err + } + + reviewTask0.R.ReviewerUser = user1 + + user1.R.ReviewerReviewTasks = append(user1.R.ReviewerReviewTasks, reviewTask0) + + return nil +} + +func (reviewTask0 *ReviewTask) AttachReviewerUser(ctx context.Context, exec bob.Executor, user1 *User) error { + var err error + + _, err = attachReviewTaskReviewerUser0(ctx, exec, 1, reviewTask0, user1) + if err != nil { + return err + } + + reviewTask0.R.ReviewerUser = user1 + + user1.R.ReviewerReviewTasks = append(user1.R.ReviewerReviewTasks, reviewTask0) + + return nil +} + +func insertReviewTaskReviewTaskPool0(ctx context.Context, exec bob.Executor, reviewTaskPool1 *ReviewTaskPoolSetter, reviewTask0 *ReviewTask) (*ReviewTaskPool, error) { + reviewTaskPool1.ReviewTaskID = omit.From(reviewTask0.ID) + + ret, err := ReviewTaskPools.Insert(reviewTaskPool1).One(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertReviewTaskReviewTaskPool0: %w", err) + } + + return ret, nil +} + +func attachReviewTaskReviewTaskPool0(ctx context.Context, exec bob.Executor, count int, reviewTaskPool1 *ReviewTaskPool, reviewTask0 *ReviewTask) (*ReviewTaskPool, error) { + setter := &ReviewTaskPoolSetter{ + ReviewTaskID: omit.From(reviewTask0.ID), + } + + err := reviewTaskPool1.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachReviewTaskReviewTaskPool0: %w", err) + } + + return reviewTaskPool1, nil +} + +func (reviewTask0 *ReviewTask) InsertReviewTaskPool(ctx context.Context, exec bob.Executor, related *ReviewTaskPoolSetter) error { + var err error + + reviewTaskPool1, err := insertReviewTaskReviewTaskPool0(ctx, exec, related, reviewTask0) + if err != nil { + return err + } + + reviewTask0.R.ReviewTaskPool = reviewTaskPool1 + + reviewTaskPool1.R.ReviewTask = reviewTask0 + + return nil +} + +func (reviewTask0 *ReviewTask) AttachReviewTaskPool(ctx context.Context, exec bob.Executor, reviewTaskPool1 *ReviewTaskPool) error { + var err error + + _, err = attachReviewTaskReviewTaskPool0(ctx, exec, 1, reviewTaskPool1, reviewTask0) + if err != nil { + return err + } + + reviewTask0.R.ReviewTaskPool = reviewTaskPool1 + + reviewTaskPool1.R.ReviewTask = reviewTask0 + + return nil +} + +type reviewTaskWhere[Q psql.Filterable] struct { + Created psql.WhereMod[Q, time.Time] + CreatorID psql.WhereNullMod[Q, int32] + ID psql.WhereMod[Q, int32] + OrganizationID psql.WhereMod[Q, int32] + Reviewed psql.WhereNullMod[Q, time.Time] + ReviewerID psql.WhereNullMod[Q, int32] +} + +func (reviewTaskWhere[Q]) AliasedAs(alias string) reviewTaskWhere[Q] { + return buildReviewTaskWhere[Q](buildReviewTaskColumns(alias)) +} + +func buildReviewTaskWhere[Q psql.Filterable](cols reviewTaskColumns) reviewTaskWhere[Q] { + return reviewTaskWhere[Q]{ + Created: psql.Where[Q, time.Time](cols.Created), + CreatorID: psql.WhereNull[Q, int32](cols.CreatorID), + ID: psql.Where[Q, int32](cols.ID), + OrganizationID: psql.Where[Q, int32](cols.OrganizationID), + Reviewed: psql.WhereNull[Q, time.Time](cols.Reviewed), + ReviewerID: psql.WhereNull[Q, int32](cols.ReviewerID), + } +} + +func (o *ReviewTask) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "CreatorUser": + rel, ok := retrieved.(*User) + if !ok { + return fmt.Errorf("reviewTask cannot load %T as %q", retrieved, name) + } + + o.R.CreatorUser = rel + + if rel != nil { + rel.R.CreatorReviewTasks = ReviewTaskSlice{o} + } + return nil + case "Organization": + rel, ok := retrieved.(*Organization) + if !ok { + return fmt.Errorf("reviewTask cannot load %T as %q", retrieved, name) + } + + o.R.Organization = rel + + if rel != nil { + rel.R.ReviewTasks = ReviewTaskSlice{o} + } + return nil + case "ReviewerUser": + rel, ok := retrieved.(*User) + if !ok { + return fmt.Errorf("reviewTask cannot load %T as %q", retrieved, name) + } + + o.R.ReviewerUser = rel + + if rel != nil { + rel.R.ReviewerReviewTasks = ReviewTaskSlice{o} + } + return nil + case "ReviewTaskPool": + rel, ok := retrieved.(*ReviewTaskPool) + if !ok { + return fmt.Errorf("reviewTask cannot load %T as %q", retrieved, name) + } + + o.R.ReviewTaskPool = rel + + if rel != nil { + rel.R.ReviewTask = o + } + return nil + default: + return fmt.Errorf("reviewTask has no relationship %q", name) + } +} + +type reviewTaskPreloader struct { + CreatorUser func(...psql.PreloadOption) psql.Preloader + Organization func(...psql.PreloadOption) psql.Preloader + ReviewerUser func(...psql.PreloadOption) psql.Preloader + ReviewTaskPool func(...psql.PreloadOption) psql.Preloader +} + +func buildReviewTaskPreloader() reviewTaskPreloader { + return reviewTaskPreloader{ + CreatorUser: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*User, UserSlice](psql.PreloadRel{ + Name: "CreatorUser", + Sides: []psql.PreloadSide{ + { + From: ReviewTasks, + To: Users, + FromColumns: []string{"creator_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: ReviewTasks, + To: Organizations, + FromColumns: []string{"organization_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Organizations.Columns.Names(), opts...) + }, + ReviewerUser: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*User, UserSlice](psql.PreloadRel{ + Name: "ReviewerUser", + Sides: []psql.PreloadSide{ + { + From: ReviewTasks, + To: Users, + FromColumns: []string{"reviewer_id"}, + ToColumns: []string{"id"}, + }, + }, + }, Users.Columns.Names(), opts...) + }, + ReviewTaskPool: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*ReviewTaskPool, ReviewTaskPoolSlice](psql.PreloadRel{ + Name: "ReviewTaskPool", + Sides: []psql.PreloadSide{ + { + From: ReviewTasks, + To: ReviewTaskPools, + FromColumns: []string{"id"}, + ToColumns: []string{"review_task_id"}, + }, + }, + }, ReviewTaskPools.Columns.Names(), opts...) + }, + } +} + +type reviewTaskThenLoader[Q orm.Loadable] struct { + CreatorUser func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + ReviewerUser func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + ReviewTaskPool func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildReviewTaskThenLoader[Q orm.Loadable]() reviewTaskThenLoader[Q] { + type CreatorUserLoadInterface interface { + LoadCreatorUser(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type OrganizationLoadInterface interface { + LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type ReviewerUserLoadInterface interface { + LoadReviewerUser(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type ReviewTaskPoolLoadInterface interface { + LoadReviewTaskPool(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return reviewTaskThenLoader[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...) + }, + ), + 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...) + }, + ), + ReviewerUser: thenLoadBuilder[Q]( + "ReviewerUser", + func(ctx context.Context, exec bob.Executor, retrieved ReviewerUserLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadReviewerUser(ctx, exec, mods...) + }, + ), + ReviewTaskPool: thenLoadBuilder[Q]( + "ReviewTaskPool", + func(ctx context.Context, exec bob.Executor, retrieved ReviewTaskPoolLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadReviewTaskPool(ctx, exec, mods...) + }, + ), + } +} + +// LoadCreatorUser loads the reviewTask's CreatorUser into the .R struct +func (o *ReviewTask) 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.CreatorReviewTasks = ReviewTaskSlice{o} + + o.R.CreatorUser = related + return nil +} + +// LoadCreatorUser loads the reviewTask's CreatorUser into the .R struct +func (os ReviewTaskSlice) 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.IsValue() { + continue + } + + if !(o.CreatorID.IsValue() && o.CreatorID.MustGet() == rel.ID) { + continue + } + + rel.R.CreatorReviewTasks = append(rel.R.CreatorReviewTasks, o) + + o.R.CreatorUser = rel + break + } + } + + return nil +} + +// LoadOrganization loads the reviewTask's Organization into the .R struct +func (o *ReviewTask) 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.ReviewTasks = ReviewTaskSlice{o} + + o.R.Organization = related + return nil +} + +// LoadOrganization loads the reviewTask's Organization into the .R struct +func (os ReviewTaskSlice) 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.ReviewTasks = append(rel.R.ReviewTasks, o) + + o.R.Organization = rel + break + } + } + + return nil +} + +// LoadReviewerUser loads the reviewTask's ReviewerUser into the .R struct +func (o *ReviewTask) LoadReviewerUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.ReviewerUser = nil + + related, err := o.ReviewerUser(mods...).One(ctx, exec) + if err != nil { + return err + } + + related.R.ReviewerReviewTasks = ReviewTaskSlice{o} + + o.R.ReviewerUser = related + return nil +} + +// LoadReviewerUser loads the reviewTask's ReviewerUser into the .R struct +func (os ReviewTaskSlice) LoadReviewerUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + users, err := os.ReviewerUser(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range users { + if !o.ReviewerID.IsValue() { + continue + } + + if !(o.ReviewerID.IsValue() && o.ReviewerID.MustGet() == rel.ID) { + continue + } + + rel.R.ReviewerReviewTasks = append(rel.R.ReviewerReviewTasks, o) + + o.R.ReviewerUser = rel + break + } + } + + return nil +} + +// LoadReviewTaskPool loads the reviewTask's ReviewTaskPool into the .R struct +func (o *ReviewTask) LoadReviewTaskPool(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.ReviewTaskPool = nil + + related, err := o.ReviewTaskPool(mods...).One(ctx, exec) + if err != nil { + return err + } + + related.R.ReviewTask = o + + o.R.ReviewTaskPool = related + return nil +} + +// LoadReviewTaskPool loads the reviewTask's ReviewTaskPool into the .R struct +func (os ReviewTaskSlice) LoadReviewTaskPool(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + reviewTaskPools, err := os.ReviewTaskPool(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range reviewTaskPools { + + if !(o.ID == rel.ReviewTaskID) { + continue + } + + rel.R.ReviewTask = o + + o.R.ReviewTaskPool = rel + break + } + } + + return nil +} diff --git a/db/models/review_task_pool.bob.go b/db/models/review_task_pool.bob.go new file mode 100644 index 00000000..8f4fb5e6 --- /dev/null +++ b/db/models/review_task_pool.bob.go @@ -0,0 +1,785 @@ +// Code generated by BobGen psql v0.42.5. 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" + + "github.com/Gleipnir-Technology/bob" + "github.com/Gleipnir-Technology/bob/dialect/psql" + "github.com/Gleipnir-Technology/bob/dialect/psql/dialect" + "github.com/Gleipnir-Technology/bob/dialect/psql/dm" + "github.com/Gleipnir-Technology/bob/dialect/psql/sm" + "github.com/Gleipnir-Technology/bob/dialect/psql/um" + "github.com/Gleipnir-Technology/bob/expr" + "github.com/Gleipnir-Technology/bob/orm" + "github.com/Gleipnir-Technology/bob/types/pgtypes" + "github.com/aarondl/opt/null" + "github.com/aarondl/opt/omit" + "github.com/aarondl/opt/omitnull" +) + +// ReviewTaskPool is an object representing the database table. +type ReviewTaskPool struct { + FeaturePool int32 `db:"feature_pool" ` + Location null.Val[string] `db:"location" ` + Geometry null.Val[string] `db:"geometry" ` + ReviewTaskID int32 `db:"review_task_id,pk" ` + + R reviewTaskPoolR `db:"-" ` +} + +// ReviewTaskPoolSlice is an alias for a slice of pointers to ReviewTaskPool. +// This should almost always be used instead of []*ReviewTaskPool. +type ReviewTaskPoolSlice []*ReviewTaskPool + +// ReviewTaskPools contains methods to work with the review_task_pool table +var ReviewTaskPools = psql.NewTablex[*ReviewTaskPool, ReviewTaskPoolSlice, *ReviewTaskPoolSetter]("", "review_task_pool", buildReviewTaskPoolColumns("review_task_pool")) + +// ReviewTaskPoolsQuery is a query on the review_task_pool table +type ReviewTaskPoolsQuery = *psql.ViewQuery[*ReviewTaskPool, ReviewTaskPoolSlice] + +// reviewTaskPoolR is where relationships are stored. +type reviewTaskPoolR struct { + FeaturePool *FeaturePool // review_task_pool.review_task_pool_feature_pool_fkey + ReviewTask *ReviewTask // review_task_pool.review_task_pool_review_task_id_fkey +} + +func buildReviewTaskPoolColumns(alias string) reviewTaskPoolColumns { + return reviewTaskPoolColumns{ + ColumnsExpr: expr.NewColumnsExpr( + "feature_pool", "location", "geometry", "review_task_id", + ).WithParent("review_task_pool"), + tableAlias: alias, + FeaturePool: psql.Quote(alias, "feature_pool"), + Location: psql.Quote(alias, "location"), + Geometry: psql.Quote(alias, "geometry"), + ReviewTaskID: psql.Quote(alias, "review_task_id"), + } +} + +type reviewTaskPoolColumns struct { + expr.ColumnsExpr + tableAlias string + FeaturePool psql.Expression + Location psql.Expression + Geometry psql.Expression + ReviewTaskID psql.Expression +} + +func (c reviewTaskPoolColumns) Alias() string { + return c.tableAlias +} + +func (reviewTaskPoolColumns) AliasedAs(alias string) reviewTaskPoolColumns { + return buildReviewTaskPoolColumns(alias) +} + +// ReviewTaskPoolSetter is used for insert/upsert/update operations +// All values are optional, and do not have to be set +// Generated columns are not included +type ReviewTaskPoolSetter struct { + FeaturePool omit.Val[int32] `db:"feature_pool" ` + Location omitnull.Val[string] `db:"location" ` + Geometry omitnull.Val[string] `db:"geometry" ` + ReviewTaskID omit.Val[int32] `db:"review_task_id,pk" ` +} + +func (s ReviewTaskPoolSetter) SetColumns() []string { + vals := make([]string, 0, 4) + if s.FeaturePool.IsValue() { + vals = append(vals, "feature_pool") + } + if !s.Location.IsUnset() { + vals = append(vals, "location") + } + if !s.Geometry.IsUnset() { + vals = append(vals, "geometry") + } + if s.ReviewTaskID.IsValue() { + vals = append(vals, "review_task_id") + } + return vals +} + +func (s ReviewTaskPoolSetter) Overwrite(t *ReviewTaskPool) { + if s.FeaturePool.IsValue() { + t.FeaturePool = s.FeaturePool.MustGet() + } + if !s.Location.IsUnset() { + t.Location = s.Location.MustGetNull() + } + if !s.Geometry.IsUnset() { + t.Geometry = s.Geometry.MustGetNull() + } + if s.ReviewTaskID.IsValue() { + t.ReviewTaskID = s.ReviewTaskID.MustGet() + } +} + +func (s *ReviewTaskPoolSetter) Apply(q *dialect.InsertQuery) { + q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { + return ReviewTaskPools.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.FeaturePool.IsValue() { + vals[0] = psql.Arg(s.FeaturePool.MustGet()) + } else { + vals[0] = psql.Raw("DEFAULT") + } + + if !s.Location.IsUnset() { + vals[1] = psql.Arg(s.Location.MustGetNull()) + } else { + vals[1] = psql.Raw("DEFAULT") + } + + if !s.Geometry.IsUnset() { + vals[2] = psql.Arg(s.Geometry.MustGetNull()) + } else { + vals[2] = psql.Raw("DEFAULT") + } + + if s.ReviewTaskID.IsValue() { + vals[3] = psql.Arg(s.ReviewTaskID.MustGet()) + } else { + vals[3] = psql.Raw("DEFAULT") + } + + return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") + })) +} + +func (s ReviewTaskPoolSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { + return um.Set(s.Expressions()...) +} + +func (s ReviewTaskPoolSetter) Expressions(prefix ...string) []bob.Expression { + exprs := make([]bob.Expression, 0, 4) + + if s.FeaturePool.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "feature_pool")...), + psql.Arg(s.FeaturePool), + }}) + } + + if !s.Location.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "location")...), + psql.Arg(s.Location), + }}) + } + + if !s.Geometry.IsUnset() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "geometry")...), + psql.Arg(s.Geometry), + }}) + } + + if s.ReviewTaskID.IsValue() { + exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ + psql.Quote(append(prefix, "review_task_id")...), + psql.Arg(s.ReviewTaskID), + }}) + } + + return exprs +} + +// FindReviewTaskPool retrieves a single record by primary key +// If cols is empty Find will return all columns. +func FindReviewTaskPool(ctx context.Context, exec bob.Executor, ReviewTaskIDPK int32, cols ...string) (*ReviewTaskPool, error) { + if len(cols) == 0 { + return ReviewTaskPools.Query( + sm.Where(ReviewTaskPools.Columns.ReviewTaskID.EQ(psql.Arg(ReviewTaskIDPK))), + ).One(ctx, exec) + } + + return ReviewTaskPools.Query( + sm.Where(ReviewTaskPools.Columns.ReviewTaskID.EQ(psql.Arg(ReviewTaskIDPK))), + sm.Columns(ReviewTaskPools.Columns.Only(cols...)), + ).One(ctx, exec) +} + +// ReviewTaskPoolExists checks the presence of a single record by primary key +func ReviewTaskPoolExists(ctx context.Context, exec bob.Executor, ReviewTaskIDPK int32) (bool, error) { + return ReviewTaskPools.Query( + sm.Where(ReviewTaskPools.Columns.ReviewTaskID.EQ(psql.Arg(ReviewTaskIDPK))), + ).Exists(ctx, exec) +} + +// AfterQueryHook is called after ReviewTaskPool is retrieved from the database +func (o *ReviewTaskPool) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = ReviewTaskPools.AfterSelectHooks.RunHooks(ctx, exec, ReviewTaskPoolSlice{o}) + case bob.QueryTypeInsert: + ctx, err = ReviewTaskPools.AfterInsertHooks.RunHooks(ctx, exec, ReviewTaskPoolSlice{o}) + case bob.QueryTypeUpdate: + ctx, err = ReviewTaskPools.AfterUpdateHooks.RunHooks(ctx, exec, ReviewTaskPoolSlice{o}) + case bob.QueryTypeDelete: + ctx, err = ReviewTaskPools.AfterDeleteHooks.RunHooks(ctx, exec, ReviewTaskPoolSlice{o}) + } + + return err +} + +// primaryKeyVals returns the primary key values of the ReviewTaskPool +func (o *ReviewTaskPool) primaryKeyVals() bob.Expression { + return psql.Arg(o.ReviewTaskID) +} + +func (o *ReviewTaskPool) pkEQ() dialect.Expression { + return psql.Quote("review_task_pool", "review_task_id").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 ReviewTaskPool +func (o *ReviewTaskPool) Update(ctx context.Context, exec bob.Executor, s *ReviewTaskPoolSetter) error { + v, err := ReviewTaskPools.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 ReviewTaskPool record with an executor +func (o *ReviewTaskPool) Delete(ctx context.Context, exec bob.Executor) error { + _, err := ReviewTaskPools.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) + return err +} + +// Reload refreshes the ReviewTaskPool using the executor +func (o *ReviewTaskPool) Reload(ctx context.Context, exec bob.Executor) error { + o2, err := ReviewTaskPools.Query( + sm.Where(ReviewTaskPools.Columns.ReviewTaskID.EQ(psql.Arg(o.ReviewTaskID))), + ).One(ctx, exec) + if err != nil { + return err + } + o2.R = o.R + *o = *o2 + + return nil +} + +// AfterQueryHook is called after ReviewTaskPoolSlice is retrieved from the database +func (o ReviewTaskPoolSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { + var err error + + switch queryType { + case bob.QueryTypeSelect: + ctx, err = ReviewTaskPools.AfterSelectHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeInsert: + ctx, err = ReviewTaskPools.AfterInsertHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeUpdate: + ctx, err = ReviewTaskPools.AfterUpdateHooks.RunHooks(ctx, exec, o) + case bob.QueryTypeDelete: + ctx, err = ReviewTaskPools.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err +} + +func (o ReviewTaskPoolSlice) pkIN() dialect.Expression { + if len(o) == 0 { + return psql.Raw("NULL") + } + + return psql.Quote("review_task_pool", "review_task_id").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 ReviewTaskPoolSlice) copyMatchingRows(from ...*ReviewTaskPool) { + for i, old := range o { + for _, new := range from { + if new.ReviewTaskID != old.ReviewTaskID { + continue + } + new.R = old.R + o[i] = new + break + } + } +} + +// UpdateMod modifies an update query with "WHERE primary_key IN (o...)" +func (o ReviewTaskPoolSlice) 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 ReviewTaskPools.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 *ReviewTaskPool: + o.copyMatchingRows(retrieved) + case []*ReviewTaskPool: + o.copyMatchingRows(retrieved...) + case ReviewTaskPoolSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a ReviewTaskPool or a slice of ReviewTaskPool + // then run the AfterUpdateHooks on the slice + _, err = ReviewTaskPools.AfterUpdateHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" +func (o ReviewTaskPoolSlice) 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 ReviewTaskPools.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 *ReviewTaskPool: + o.copyMatchingRows(retrieved) + case []*ReviewTaskPool: + o.copyMatchingRows(retrieved...) + case ReviewTaskPoolSlice: + o.copyMatchingRows(retrieved...) + default: + // If the retrieved value is not a ReviewTaskPool or a slice of ReviewTaskPool + // then run the AfterDeleteHooks on the slice + _, err = ReviewTaskPools.AfterDeleteHooks.RunHooks(ctx, exec, o) + } + + return err + })) + + q.AppendWhere(o.pkIN()) + }) +} + +func (o ReviewTaskPoolSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals ReviewTaskPoolSetter) error { + if len(o) == 0 { + return nil + } + + _, err := ReviewTaskPools.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec) + return err +} + +func (o ReviewTaskPoolSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + _, err := ReviewTaskPools.Delete(o.DeleteMod()).Exec(ctx, exec) + return err +} + +func (o ReviewTaskPoolSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { + if len(o) == 0 { + return nil + } + + o2, err := ReviewTaskPools.Query(sm.Where(o.pkIN())).All(ctx, exec) + if err != nil { + return err + } + + o.copyMatchingRows(o2...) + + return nil +} + +// FeaturePool starts a query for related objects on feature_pool +func (o *ReviewTaskPool) RelatedFeaturePool(mods ...bob.Mod[*dialect.SelectQuery]) FeaturePoolsQuery { + return FeaturePools.Query(append(mods, + sm.Where(FeaturePools.Columns.FeatureID.EQ(psql.Arg(o.FeaturePool))), + )...) +} + +func (os ReviewTaskPoolSlice) RelatedFeaturePool(mods ...bob.Mod[*dialect.SelectQuery]) FeaturePoolsQuery { + pkFeaturePool := make(pgtypes.Array[int32], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkFeaturePool = append(pkFeaturePool, o.FeaturePool) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkFeaturePool), "integer[]")), + )) + + return FeaturePools.Query(append(mods, + sm.Where(psql.Group(FeaturePools.Columns.FeatureID).OP("IN", PKArgExpr)), + )...) +} + +// ReviewTask starts a query for related objects on review_task +func (o *ReviewTaskPool) ReviewTask(mods ...bob.Mod[*dialect.SelectQuery]) ReviewTasksQuery { + return ReviewTasks.Query(append(mods, + sm.Where(ReviewTasks.Columns.ID.EQ(psql.Arg(o.ReviewTaskID))), + )...) +} + +func (os ReviewTaskPoolSlice) ReviewTask(mods ...bob.Mod[*dialect.SelectQuery]) ReviewTasksQuery { + pkReviewTaskID := make(pgtypes.Array[int32], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkReviewTaskID = append(pkReviewTaskID, o.ReviewTaskID) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkReviewTaskID), "integer[]")), + )) + + return ReviewTasks.Query(append(mods, + sm.Where(psql.Group(ReviewTasks.Columns.ID).OP("IN", PKArgExpr)), + )...) +} + +func attachReviewTaskPoolFeaturePool0(ctx context.Context, exec bob.Executor, count int, reviewTaskPool0 *ReviewTaskPool, featurePool1 *FeaturePool) (*ReviewTaskPool, error) { + setter := &ReviewTaskPoolSetter{ + FeaturePool: omit.From(featurePool1.FeatureID), + } + + err := reviewTaskPool0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachReviewTaskPoolFeaturePool0: %w", err) + } + + return reviewTaskPool0, nil +} + +func (reviewTaskPool0 *ReviewTaskPool) InsertFeaturePool(ctx context.Context, exec bob.Executor, related *FeaturePoolSetter) error { + var err error + + featurePool1, err := FeaturePools.Insert(related).One(ctx, exec) + if err != nil { + return fmt.Errorf("inserting related objects: %w", err) + } + + _, err = attachReviewTaskPoolFeaturePool0(ctx, exec, 1, reviewTaskPool0, featurePool1) + if err != nil { + return err + } + + reviewTaskPool0.R.FeaturePool = featurePool1 + + featurePool1.R.ReviewTaskPools = append(featurePool1.R.ReviewTaskPools, reviewTaskPool0) + + return nil +} + +func (reviewTaskPool0 *ReviewTaskPool) AttachFeaturePool(ctx context.Context, exec bob.Executor, featurePool1 *FeaturePool) error { + var err error + + _, err = attachReviewTaskPoolFeaturePool0(ctx, exec, 1, reviewTaskPool0, featurePool1) + if err != nil { + return err + } + + reviewTaskPool0.R.FeaturePool = featurePool1 + + featurePool1.R.ReviewTaskPools = append(featurePool1.R.ReviewTaskPools, reviewTaskPool0) + + return nil +} + +func attachReviewTaskPoolReviewTask0(ctx context.Context, exec bob.Executor, count int, reviewTaskPool0 *ReviewTaskPool, reviewTask1 *ReviewTask) (*ReviewTaskPool, error) { + setter := &ReviewTaskPoolSetter{ + ReviewTaskID: omit.From(reviewTask1.ID), + } + + err := reviewTaskPool0.Update(ctx, exec, setter) + if err != nil { + return nil, fmt.Errorf("attachReviewTaskPoolReviewTask0: %w", err) + } + + return reviewTaskPool0, nil +} + +func (reviewTaskPool0 *ReviewTaskPool) InsertReviewTask(ctx context.Context, exec bob.Executor, related *ReviewTaskSetter) error { + var err error + + reviewTask1, err := ReviewTasks.Insert(related).One(ctx, exec) + if err != nil { + return fmt.Errorf("inserting related objects: %w", err) + } + + _, err = attachReviewTaskPoolReviewTask0(ctx, exec, 1, reviewTaskPool0, reviewTask1) + if err != nil { + return err + } + + reviewTaskPool0.R.ReviewTask = reviewTask1 + + reviewTask1.R.ReviewTaskPool = reviewTaskPool0 + + return nil +} + +func (reviewTaskPool0 *ReviewTaskPool) AttachReviewTask(ctx context.Context, exec bob.Executor, reviewTask1 *ReviewTask) error { + var err error + + _, err = attachReviewTaskPoolReviewTask0(ctx, exec, 1, reviewTaskPool0, reviewTask1) + if err != nil { + return err + } + + reviewTaskPool0.R.ReviewTask = reviewTask1 + + reviewTask1.R.ReviewTaskPool = reviewTaskPool0 + + return nil +} + +type reviewTaskPoolWhere[Q psql.Filterable] struct { + FeaturePool psql.WhereMod[Q, int32] + Location psql.WhereNullMod[Q, string] + Geometry psql.WhereNullMod[Q, string] + ReviewTaskID psql.WhereMod[Q, int32] +} + +func (reviewTaskPoolWhere[Q]) AliasedAs(alias string) reviewTaskPoolWhere[Q] { + return buildReviewTaskPoolWhere[Q](buildReviewTaskPoolColumns(alias)) +} + +func buildReviewTaskPoolWhere[Q psql.Filterable](cols reviewTaskPoolColumns) reviewTaskPoolWhere[Q] { + return reviewTaskPoolWhere[Q]{ + FeaturePool: psql.Where[Q, int32](cols.FeaturePool), + Location: psql.WhereNull[Q, string](cols.Location), + Geometry: psql.WhereNull[Q, string](cols.Geometry), + ReviewTaskID: psql.Where[Q, int32](cols.ReviewTaskID), + } +} + +func (o *ReviewTaskPool) Preload(name string, retrieved any) error { + if o == nil { + return nil + } + + switch name { + case "FeaturePool": + rel, ok := retrieved.(*FeaturePool) + if !ok { + return fmt.Errorf("reviewTaskPool cannot load %T as %q", retrieved, name) + } + + o.R.FeaturePool = rel + + if rel != nil { + rel.R.ReviewTaskPools = ReviewTaskPoolSlice{o} + } + return nil + case "ReviewTask": + rel, ok := retrieved.(*ReviewTask) + if !ok { + return fmt.Errorf("reviewTaskPool cannot load %T as %q", retrieved, name) + } + + o.R.ReviewTask = rel + + if rel != nil { + rel.R.ReviewTaskPool = o + } + return nil + default: + return fmt.Errorf("reviewTaskPool has no relationship %q", name) + } +} + +type reviewTaskPoolPreloader struct { + FeaturePool func(...psql.PreloadOption) psql.Preloader + ReviewTask func(...psql.PreloadOption) psql.Preloader +} + +func buildReviewTaskPoolPreloader() reviewTaskPoolPreloader { + return reviewTaskPoolPreloader{ + FeaturePool: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*FeaturePool, FeaturePoolSlice](psql.PreloadRel{ + Name: "FeaturePool", + Sides: []psql.PreloadSide{ + { + From: ReviewTaskPools, + To: FeaturePools, + FromColumns: []string{"feature_pool"}, + ToColumns: []string{"feature_id"}, + }, + }, + }, FeaturePools.Columns.Names(), opts...) + }, + ReviewTask: func(opts ...psql.PreloadOption) psql.Preloader { + return psql.Preload[*ReviewTask, ReviewTaskSlice](psql.PreloadRel{ + Name: "ReviewTask", + Sides: []psql.PreloadSide{ + { + From: ReviewTaskPools, + To: ReviewTasks, + FromColumns: []string{"review_task_id"}, + ToColumns: []string{"id"}, + }, + }, + }, ReviewTasks.Columns.Names(), opts...) + }, + } +} + +type reviewTaskPoolThenLoader[Q orm.Loadable] struct { + FeaturePool func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + ReviewTask func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] +} + +func buildReviewTaskPoolThenLoader[Q orm.Loadable]() reviewTaskPoolThenLoader[Q] { + type FeaturePoolLoadInterface interface { + LoadFeaturePool(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type ReviewTaskLoadInterface interface { + LoadReviewTask(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + + return reviewTaskPoolThenLoader[Q]{ + FeaturePool: thenLoadBuilder[Q]( + "FeaturePool", + func(ctx context.Context, exec bob.Executor, retrieved FeaturePoolLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFeaturePool(ctx, exec, mods...) + }, + ), + ReviewTask: thenLoadBuilder[Q]( + "ReviewTask", + func(ctx context.Context, exec bob.Executor, retrieved ReviewTaskLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadReviewTask(ctx, exec, mods...) + }, + ), + } +} + +// LoadFeaturePool loads the reviewTaskPool's FeaturePool into the .R struct +func (o *ReviewTaskPool) LoadFeaturePool(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.FeaturePool = nil + + related, err := o.RelatedFeaturePool(mods...).One(ctx, exec) + if err != nil { + return err + } + + related.R.ReviewTaskPools = ReviewTaskPoolSlice{o} + + o.R.FeaturePool = related + return nil +} + +// LoadFeaturePool loads the reviewTaskPool's FeaturePool into the .R struct +func (os ReviewTaskPoolSlice) LoadFeaturePool(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + featurePools, err := os.RelatedFeaturePool(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range featurePools { + + if !(o.FeaturePool == rel.FeatureID) { + continue + } + + rel.R.ReviewTaskPools = append(rel.R.ReviewTaskPools, o) + + o.R.FeaturePool = rel + break + } + } + + return nil +} + +// LoadReviewTask loads the reviewTaskPool's ReviewTask into the .R struct +func (o *ReviewTaskPool) LoadReviewTask(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.ReviewTask = nil + + related, err := o.ReviewTask(mods...).One(ctx, exec) + if err != nil { + return err + } + + related.R.ReviewTaskPool = o + + o.R.ReviewTask = related + return nil +} + +// LoadReviewTask loads the reviewTaskPool's ReviewTask into the .R struct +func (os ReviewTaskPoolSlice) LoadReviewTask(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + reviewTasks, err := os.ReviewTask(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range reviewTasks { + + if !(o.ReviewTaskID == rel.ID) { + continue + } + + rel.R.ReviewTaskPool = o + + o.R.ReviewTask = rel + break + } + } + + return nil +} diff --git a/db/models/signal.bob.go b/db/models/signal.bob.go index 4fa502a1..fa3c2610 100644 --- a/db/models/signal.bob.go +++ b/db/models/signal.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -38,8 +37,6 @@ type Signal struct { Type enums.Signaltype `db:"type_" ` R signalR `db:"-" ` - - C signalC `db:"-" ` } // SignalSlice is an alias for a slice of pointers to Signal. @@ -54,10 +51,9 @@ type SignalsQuery = *psql.ViewQuery[*Signal, SignalSlice] // signalR is where relationships are stored. type signalR struct { - AddressorUser *User // signal.signal_addressor_fkey - CreatorUser *User // signal.signal_creator_fkey - Organization *Organization // signal.signal_organization_id_fkey - SignalPools SignalPoolSlice // signal_pool.signal_pool_signal_id_fkey + AddressorUser *User // signal.signal_addressor_fkey + CreatorUser *User // signal.signal_creator_fkey + Organization *Organization // signal.signal_organization_id_fkey } func buildSignalColumns(alias string) signalColumns { @@ -610,30 +606,6 @@ func (os SignalSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) Organi )...) } -// SignalPools starts a query for related objects on signal_pool -func (o *Signal) SignalPools(mods ...bob.Mod[*dialect.SelectQuery]) SignalPoolsQuery { - return SignalPools.Query(append(mods, - sm.Where(SignalPools.Columns.SignalID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os SignalSlice) SignalPools(mods ...bob.Mod[*dialect.SelectQuery]) SignalPoolsQuery { - 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 SignalPools.Query(append(mods, - sm.Where(psql.Group(SignalPools.Columns.SignalID).OP("IN", PKArgExpr)), - )...) -} - func attachSignalAddressorUser0(ctx context.Context, exec bob.Executor, count int, signal0 *Signal, user1 *User) (*Signal, error) { setter := &SignalSetter{ Addressor: omitnull.From(user1.ID), @@ -850,20 +822,6 @@ func (o *Signal) Preload(name string, retrieved any) error { rel.R.Signals = SignalSlice{o} } return nil - case "SignalPools": - rels, ok := retrieved.(SignalPoolSlice) - if !ok { - return fmt.Errorf("signal cannot load %T as %q", retrieved, name) - } - - o.R.SignalPools = rels - - for _, rel := range rels { - if rel != nil { - rel.R.Signal = o - } - } - return nil default: return fmt.Errorf("signal has no relationship %q", name) } @@ -923,7 +881,6 @@ type signalThenLoader[Q orm.Loadable] struct { AddressorUser func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] CreatorUser func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - SignalPools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] } func buildSignalThenLoader[Q orm.Loadable]() signalThenLoader[Q] { @@ -936,9 +893,6 @@ func buildSignalThenLoader[Q orm.Loadable]() signalThenLoader[Q] { type OrganizationLoadInterface interface { LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } - type SignalPoolsLoadInterface interface { - LoadSignalPools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } return signalThenLoader[Q]{ AddressorUser: thenLoadBuilder[Q]( @@ -959,12 +913,6 @@ func buildSignalThenLoader[Q orm.Loadable]() signalThenLoader[Q] { return retrieved.LoadOrganization(ctx, exec, mods...) }, ), - SignalPools: thenLoadBuilder[Q]( - "SignalPools", - func(ctx context.Context, exec bob.Executor, retrieved SignalPoolsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadSignalPools(ctx, exec, mods...) - }, - ), } } @@ -1126,231 +1074,3 @@ func (os SignalSlice) LoadOrganization(ctx context.Context, exec bob.Executor, m return nil } - -// LoadSignalPools loads the signal's SignalPools into the .R struct -func (o *Signal) LoadSignalPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.SignalPools = nil - - related, err := o.SignalPools(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.Signal = o - } - - o.R.SignalPools = related - return nil -} - -// LoadSignalPools loads the signal's SignalPools into the .R struct -func (os SignalSlice) LoadSignalPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - signalPools, err := os.SignalPools(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.SignalPools = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range signalPools { - - if !(o.ID == rel.SignalID) { - continue - } - - rel.R.Signal = o - - o.R.SignalPools = append(o.R.SignalPools, rel) - } - } - - return nil -} - -// signalC is where relationship counts are stored. -type signalC struct { - SignalPools *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *Signal) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "SignalPools": - o.C.SignalPools = &count - } - return nil -} - -type signalCountPreloader struct { - SignalPools func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildSignalCountPreloader() signalCountPreloader { - return signalCountPreloader{ - SignalPools: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Signal]("SignalPools", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Signals.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(SignalPools.Name()), - sm.Where(psql.Quote(SignalPools.Alias(), "signal_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type signalCountThenLoader[Q orm.Loadable] struct { - SignalPools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildSignalCountThenLoader[Q orm.Loadable]() signalCountThenLoader[Q] { - type SignalPoolsCountInterface interface { - LoadCountSignalPools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return signalCountThenLoader[Q]{ - SignalPools: countThenLoadBuilder[Q]( - "SignalPools", - func(ctx context.Context, exec bob.Executor, retrieved SignalPoolsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountSignalPools(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountSignalPools loads the count of SignalPools into the C struct -func (o *Signal) LoadCountSignalPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.SignalPools(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.SignalPools = &count - return nil -} - -// LoadCountSignalPools loads the count of SignalPools for a slice -func (os SignalSlice) LoadCountSignalPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountSignalPools(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type signalJoins[Q dialect.Joinable] struct { - typ string - AddressorUser modAs[Q, userColumns] - CreatorUser modAs[Q, userColumns] - Organization modAs[Q, organizationColumns] - SignalPools modAs[Q, signalPoolColumns] -} - -func (j signalJoins[Q]) aliasedAs(alias string) signalJoins[Q] { - return buildSignalJoins[Q](buildSignalColumns(alias), j.typ) -} - -func buildSignalJoins[Q dialect.Joinable](cols signalColumns, typ string) signalJoins[Q] { - return signalJoins[Q]{ - typ: typ, - AddressorUser: 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.Addressor), - )) - } - - return mods - }, - }, - 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.Creator), - )) - } - - 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 - }, - }, - SignalPools: modAs[Q, signalPoolColumns]{ - c: SignalPools.Columns, - f: func(to signalPoolColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, SignalPools.Name().As(to.Alias())).On( - to.SignalID.EQ(cols.ID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/signal_pool.bob.go b/db/models/signal_pool.bob.go deleted file mode 100644 index a13d2271..00000000 --- a/db/models/signal_pool.bob.go +++ /dev/null @@ -1,478 +0,0 @@ -// Code generated by BobGen psql v0.42.5. 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" - - "github.com/Gleipnir-Technology/bob" - "github.com/Gleipnir-Technology/bob/dialect/psql" - "github.com/Gleipnir-Technology/bob/dialect/psql/dialect" - "github.com/Gleipnir-Technology/bob/dialect/psql/sm" - "github.com/Gleipnir-Technology/bob/dialect/psql/um" - "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" - "github.com/Gleipnir-Technology/bob/orm" - "github.com/Gleipnir-Technology/bob/types/pgtypes" - "github.com/aarondl/opt/omit" -) - -// SignalPool is an object representing the database table. -type SignalPool struct { - PoolID int32 `db:"pool_id" ` - SignalID int32 `db:"signal_id" ` - - R signalPoolR `db:"-" ` -} - -// SignalPoolSlice is an alias for a slice of pointers to SignalPool. -// This should almost always be used instead of []*SignalPool. -type SignalPoolSlice []*SignalPool - -// SignalPools contains methods to work with the signal_pool view -var SignalPools = psql.NewViewx[*SignalPool, SignalPoolSlice]("", "signal_pool", buildSignalPoolColumns("signal_pool")) - -// SignalPoolsQuery is a query on the signal_pool view -type SignalPoolsQuery = *psql.ViewQuery[*SignalPool, SignalPoolSlice] - -// signalPoolR is where relationships are stored. -type signalPoolR struct { - Pool *Pool // signal_pool.signal_pool_pool_id_fkey - Signal *Signal // signal_pool.signal_pool_signal_id_fkey -} - -func buildSignalPoolColumns(alias string) signalPoolColumns { - return signalPoolColumns{ - ColumnsExpr: expr.NewColumnsExpr( - "pool_id", "signal_id", - ).WithParent("signal_pool"), - tableAlias: alias, - PoolID: psql.Quote(alias, "pool_id"), - SignalID: psql.Quote(alias, "signal_id"), - } -} - -type signalPoolColumns struct { - expr.ColumnsExpr - tableAlias string - PoolID psql.Expression - SignalID psql.Expression -} - -func (c signalPoolColumns) Alias() string { - return c.tableAlias -} - -func (signalPoolColumns) AliasedAs(alias string) signalPoolColumns { - return buildSignalPoolColumns(alias) -} - -// SignalPoolSetter is used for insert/upsert/update operations -// All values are optional, and do not have to be set -// Generated columns are not included -type SignalPoolSetter struct { - PoolID omit.Val[int32] `db:"pool_id" ` - SignalID omit.Val[int32] `db:"signal_id" ` -} - -func (s SignalPoolSetter) SetColumns() []string { - vals := make([]string, 0, 2) - if s.PoolID.IsValue() { - vals = append(vals, "pool_id") - } - if s.SignalID.IsValue() { - vals = append(vals, "signal_id") - } - return vals -} - -func (s SignalPoolSetter) Overwrite(t *SignalPool) { - if s.PoolID.IsValue() { - t.PoolID = s.PoolID.MustGet() - } - if s.SignalID.IsValue() { - t.SignalID = s.SignalID.MustGet() - } -} - -func (s *SignalPoolSetter) 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, 2) - if s.PoolID.IsValue() { - vals[0] = psql.Arg(s.PoolID.MustGet()) - } else { - vals[0] = psql.Raw("DEFAULT") - } - - if s.SignalID.IsValue() { - vals[1] = psql.Arg(s.SignalID.MustGet()) - } else { - vals[1] = psql.Raw("DEFAULT") - } - - return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "") - })) -} - -func (s SignalPoolSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { - return um.Set(s.Expressions()...) -} - -func (s SignalPoolSetter) Expressions(prefix ...string) []bob.Expression { - exprs := make([]bob.Expression, 0, 2) - - if s.PoolID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "pool_id")...), - psql.Arg(s.PoolID), - }}) - } - - if s.SignalID.IsValue() { - exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ - psql.Quote(append(prefix, "signal_id")...), - psql.Arg(s.SignalID), - }}) - } - - return exprs -} - -// AfterQueryHook is called after SignalPool is retrieved from the database -func (o *SignalPool) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = SignalPools.AfterSelectHooks.RunHooks(ctx, exec, SignalPoolSlice{o}) - } - - return err -} - -// AfterQueryHook is called after SignalPoolSlice is retrieved from the database -func (o SignalPoolSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { - var err error - - switch queryType { - case bob.QueryTypeSelect: - ctx, err = SignalPools.AfterSelectHooks.RunHooks(ctx, exec, o) - } - - return err -} - -// Pool starts a query for related objects on pool -func (o *SignalPool) Pool(mods ...bob.Mod[*dialect.SelectQuery]) PoolsQuery { - return Pools.Query(append(mods, - sm.Where(Pools.Columns.ID.EQ(psql.Arg(o.PoolID))), - )...) -} - -func (os SignalPoolSlice) Pool(mods ...bob.Mod[*dialect.SelectQuery]) PoolsQuery { - pkPoolID := make(pgtypes.Array[int32], 0, len(os)) - for _, o := range os { - if o == nil { - continue - } - pkPoolID = append(pkPoolID, o.PoolID) - } - PKArgExpr := psql.Select(sm.Columns( - psql.F("unnest", psql.Cast(psql.Arg(pkPoolID), "integer[]")), - )) - - return Pools.Query(append(mods, - sm.Where(psql.Group(Pools.Columns.ID).OP("IN", PKArgExpr)), - )...) -} - -// Signal starts a query for related objects on signal -func (o *SignalPool) Signal(mods ...bob.Mod[*dialect.SelectQuery]) SignalsQuery { - return Signals.Query(append(mods, - sm.Where(Signals.Columns.ID.EQ(psql.Arg(o.SignalID))), - )...) -} - -func (os SignalPoolSlice) Signal(mods ...bob.Mod[*dialect.SelectQuery]) SignalsQuery { - pkSignalID := make(pgtypes.Array[int32], 0, len(os)) - for _, o := range os { - if o == nil { - continue - } - pkSignalID = append(pkSignalID, o.SignalID) - } - PKArgExpr := psql.Select(sm.Columns( - psql.F("unnest", psql.Cast(psql.Arg(pkSignalID), "integer[]")), - )) - - return Signals.Query(append(mods, - sm.Where(psql.Group(Signals.Columns.ID).OP("IN", PKArgExpr)), - )...) -} - -type signalPoolWhere[Q psql.Filterable] struct { - PoolID psql.WhereMod[Q, int32] - SignalID psql.WhereMod[Q, int32] -} - -func (signalPoolWhere[Q]) AliasedAs(alias string) signalPoolWhere[Q] { - return buildSignalPoolWhere[Q](buildSignalPoolColumns(alias)) -} - -func buildSignalPoolWhere[Q psql.Filterable](cols signalPoolColumns) signalPoolWhere[Q] { - return signalPoolWhere[Q]{ - PoolID: psql.Where[Q, int32](cols.PoolID), - SignalID: psql.Where[Q, int32](cols.SignalID), - } -} - -func (o *SignalPool) Preload(name string, retrieved any) error { - if o == nil { - return nil - } - - switch name { - case "Pool": - rel, ok := retrieved.(*Pool) - if !ok { - return fmt.Errorf("signalPool cannot load %T as %q", retrieved, name) - } - - o.R.Pool = rel - - if rel != nil { - rel.R.SignalPools = SignalPoolSlice{o} - } - return nil - case "Signal": - rel, ok := retrieved.(*Signal) - if !ok { - return fmt.Errorf("signalPool cannot load %T as %q", retrieved, name) - } - - o.R.Signal = rel - - if rel != nil { - rel.R.SignalPools = SignalPoolSlice{o} - } - return nil - default: - return fmt.Errorf("signalPool has no relationship %q", name) - } -} - -type signalPoolPreloader struct { - Pool func(...psql.PreloadOption) psql.Preloader - Signal func(...psql.PreloadOption) psql.Preloader -} - -func buildSignalPoolPreloader() signalPoolPreloader { - return signalPoolPreloader{ - Pool: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Pool, PoolSlice](psql.PreloadRel{ - Name: "Pool", - Sides: []psql.PreloadSide{ - { - From: SignalPools, - To: Pools, - FromColumns: []string{"pool_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Pools.Columns.Names(), opts...) - }, - Signal: func(opts ...psql.PreloadOption) psql.Preloader { - return psql.Preload[*Signal, SignalSlice](psql.PreloadRel{ - Name: "Signal", - Sides: []psql.PreloadSide{ - { - From: SignalPools, - To: Signals, - FromColumns: []string{"signal_id"}, - ToColumns: []string{"id"}, - }, - }, - }, Signals.Columns.Names(), opts...) - }, - } -} - -type signalPoolThenLoader[Q orm.Loadable] struct { - Pool func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - Signal func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildSignalPoolThenLoader[Q orm.Loadable]() signalPoolThenLoader[Q] { - type PoolLoadInterface interface { - LoadPool(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type SignalLoadInterface interface { - LoadSignal(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return signalPoolThenLoader[Q]{ - Pool: thenLoadBuilder[Q]( - "Pool", - func(ctx context.Context, exec bob.Executor, retrieved PoolLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadPool(ctx, exec, mods...) - }, - ), - Signal: thenLoadBuilder[Q]( - "Signal", - func(ctx context.Context, exec bob.Executor, retrieved SignalLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadSignal(ctx, exec, mods...) - }, - ), - } -} - -// LoadPool loads the signalPool's Pool into the .R struct -func (o *SignalPool) LoadPool(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.Pool = nil - - related, err := o.Pool(mods...).One(ctx, exec) - if err != nil { - return err - } - - related.R.SignalPools = SignalPoolSlice{o} - - o.R.Pool = related - return nil -} - -// LoadPool loads the signalPool's Pool into the .R struct -func (os SignalPoolSlice) LoadPool(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - pools, err := os.Pool(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range pools { - - if !(o.PoolID == rel.ID) { - continue - } - - rel.R.SignalPools = append(rel.R.SignalPools, o) - - o.R.Pool = rel - break - } - } - - return nil -} - -// LoadSignal loads the signalPool's Signal into the .R struct -func (o *SignalPool) LoadSignal(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.Signal = nil - - related, err := o.Signal(mods...).One(ctx, exec) - if err != nil { - return err - } - - related.R.SignalPools = SignalPoolSlice{o} - - o.R.Signal = related - return nil -} - -// LoadSignal loads the signalPool's Signal into the .R struct -func (os SignalPoolSlice) LoadSignal(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - signals, err := os.Signal(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range signals { - - if !(o.SignalID == rel.ID) { - continue - } - - rel.R.SignalPools = append(rel.R.SignalPools, o) - - o.R.Signal = rel - break - } - } - - return nil -} - -type signalPoolJoins[Q dialect.Joinable] struct { - typ string - Pool modAs[Q, poolColumns] - Signal modAs[Q, signalColumns] -} - -func (j signalPoolJoins[Q]) aliasedAs(alias string) signalPoolJoins[Q] { - return buildSignalPoolJoins[Q](buildSignalPoolColumns(alias), j.typ) -} - -func buildSignalPoolJoins[Q dialect.Joinable](cols signalPoolColumns, typ string) signalPoolJoins[Q] { - return signalPoolJoins[Q]{ - typ: typ, - Pool: modAs[Q, poolColumns]{ - c: Pools.Columns, - f: func(to poolColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Pools.Name().As(to.Alias())).On( - to.ID.EQ(cols.PoolID), - )) - } - - return mods - }, - }, - Signal: modAs[Q, signalColumns]{ - c: Signals.Columns, - f: func(to signalColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Signals.Name().As(to.Alias())).On( - to.ID.EQ(cols.SignalID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/site.bob.go b/db/models/site.bob.go index 3527d03f..8caab07d 100644 --- a/db/models/site.bob.go +++ b/db/models/site.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" "github.com/aarondl/opt/null" @@ -41,8 +40,6 @@ type Site struct { Version int32 `db:"version,pk" ` R siteR `db:"-" ` - - C siteC `db:"-" ` } // SiteSlice is an alias for a slice of pointers to Site. @@ -57,8 +54,8 @@ type SitesQuery = *psql.ViewQuery[*Site, SiteSlice] // siteR is where relationships are stored. type siteR struct { + Features FeatureSlice // feature.feature_site_id_site_version_fkey Leads LeadSlice // lead.lead_site_id_site_version_fkey - Pools PoolSlice // pool.pool_site_id_site_version_fkey Residents ResidentSlice // resident.resident_site_id_site_version_fkey Address *Address // site.site_address_id_fkey CreatorUser *User // site.site_creator_id_fkey @@ -642,6 +639,34 @@ func (o SiteSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { return nil } +// Features starts a query for related objects on feature +func (o *Site) Features(mods ...bob.Mod[*dialect.SelectQuery]) FeaturesQuery { + return Features.Query(append(mods, + sm.Where(Features.Columns.SiteID.EQ(psql.Arg(o.ID))), sm.Where(Features.Columns.SiteVersion.EQ(psql.Arg(o.Version))), + )...) +} + +func (os SiteSlice) Features(mods ...bob.Mod[*dialect.SelectQuery]) FeaturesQuery { + pkID := make(pgtypes.Array[int32], 0, len(os)) + + pkVersion := make(pgtypes.Array[int32], 0, len(os)) + for _, o := range os { + if o == nil { + continue + } + pkID = append(pkID, o.ID) + pkVersion = append(pkVersion, o.Version) + } + PKArgExpr := psql.Select(sm.Columns( + psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")), + psql.F("unnest", psql.Cast(psql.Arg(pkVersion), "integer[]")), + )) + + return Features.Query(append(mods, + sm.Where(psql.Group(Features.Columns.SiteID, Features.Columns.SiteVersion).OP("IN", PKArgExpr)), + )...) +} + // Leads starts a query for related objects on lead func (o *Site) Leads(mods ...bob.Mod[*dialect.SelectQuery]) LeadsQuery { return Leads.Query(append(mods, @@ -670,34 +695,6 @@ func (os SiteSlice) Leads(mods ...bob.Mod[*dialect.SelectQuery]) LeadsQuery { )...) } -// Pools starts a query for related objects on pool -func (o *Site) Pools(mods ...bob.Mod[*dialect.SelectQuery]) PoolsQuery { - return Pools.Query(append(mods, - sm.Where(Pools.Columns.SiteID.EQ(psql.Arg(o.ID))), sm.Where(Pools.Columns.SiteVersion.EQ(psql.Arg(o.Version))), - )...) -} - -func (os SiteSlice) Pools(mods ...bob.Mod[*dialect.SelectQuery]) PoolsQuery { - pkID := make(pgtypes.Array[int32], 0, len(os)) - - pkVersion := make(pgtypes.Array[int32], 0, len(os)) - for _, o := range os { - if o == nil { - continue - } - pkID = append(pkID, o.ID) - pkVersion = append(pkVersion, o.Version) - } - PKArgExpr := psql.Select(sm.Columns( - psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")), - psql.F("unnest", psql.Cast(psql.Arg(pkVersion), "integer[]")), - )) - - return Pools.Query(append(mods, - sm.Where(psql.Group(Pools.Columns.SiteID, Pools.Columns.SiteVersion).OP("IN", PKArgExpr)), - )...) -} - // Residents starts a query for related objects on resident func (o *Site) Residents(mods ...bob.Mod[*dialect.SelectQuery]) ResidentsQuery { return Residents.Query(append(mods, @@ -822,6 +819,76 @@ func (os SiteSlice) Parcel(mods ...bob.Mod[*dialect.SelectQuery]) ParcelsQuery { )...) } +func insertSiteFeatures0(ctx context.Context, exec bob.Executor, features1 []*FeatureSetter, site0 *Site) (FeatureSlice, error) { + for i := range features1 { + features1[i].SiteID = omit.From(site0.ID) + features1[i].SiteVersion = omit.From(site0.Version) + } + + ret, err := Features.Insert(bob.ToMods(features1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertSiteFeatures0: %w", err) + } + + return ret, nil +} + +func attachSiteFeatures0(ctx context.Context, exec bob.Executor, count int, features1 FeatureSlice, site0 *Site) (FeatureSlice, error) { + setter := &FeatureSetter{ + SiteID: omit.From(site0.ID), + SiteVersion: omit.From(site0.Version), + } + + err := features1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachSiteFeatures0: %w", err) + } + + return features1, nil +} + +func (site0 *Site) InsertFeatures(ctx context.Context, exec bob.Executor, related ...*FeatureSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + features1, err := insertSiteFeatures0(ctx, exec, related, site0) + if err != nil { + return err + } + + site0.R.Features = append(site0.R.Features, features1...) + + for _, rel := range features1 { + rel.R.Site = site0 + } + return nil +} + +func (site0 *Site) AttachFeatures(ctx context.Context, exec bob.Executor, related ...*Feature) error { + if len(related) == 0 { + return nil + } + + var err error + features1 := FeatureSlice(related) + + _, err = attachSiteFeatures0(ctx, exec, len(related), features1, site0) + if err != nil { + return err + } + + site0.R.Features = append(site0.R.Features, features1...) + + for _, rel := range related { + rel.R.Site = site0 + } + + return nil +} + func insertSiteLeads0(ctx context.Context, exec bob.Executor, leads1 []*LeadSetter, site0 *Site) (LeadSlice, error) { for i := range leads1 { leads1[i].SiteID = omitnull.From(site0.ID) @@ -892,76 +959,6 @@ func (site0 *Site) AttachLeads(ctx context.Context, exec bob.Executor, related . return nil } -func insertSitePools0(ctx context.Context, exec bob.Executor, pools1 []*PoolSetter, site0 *Site) (PoolSlice, error) { - for i := range pools1 { - pools1[i].SiteID = omit.From(site0.ID) - pools1[i].SiteVersion = omit.From(site0.Version) - } - - ret, err := Pools.Insert(bob.ToMods(pools1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertSitePools0: %w", err) - } - - return ret, nil -} - -func attachSitePools0(ctx context.Context, exec bob.Executor, count int, pools1 PoolSlice, site0 *Site) (PoolSlice, error) { - setter := &PoolSetter{ - SiteID: omit.From(site0.ID), - SiteVersion: omit.From(site0.Version), - } - - err := pools1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachSitePools0: %w", err) - } - - return pools1, nil -} - -func (site0 *Site) InsertPools(ctx context.Context, exec bob.Executor, related ...*PoolSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - pools1, err := insertSitePools0(ctx, exec, related, site0) - if err != nil { - return err - } - - site0.R.Pools = append(site0.R.Pools, pools1...) - - for _, rel := range pools1 { - rel.R.Site = site0 - } - return nil -} - -func (site0 *Site) AttachPools(ctx context.Context, exec bob.Executor, related ...*Pool) error { - if len(related) == 0 { - return nil - } - - var err error - pools1 := PoolSlice(related) - - _, err = attachSitePools0(ctx, exec, len(related), pools1, site0) - if err != nil { - return err - } - - site0.R.Pools = append(site0.R.Pools, pools1...) - - for _, rel := range related { - rel.R.Site = site0 - } - - return nil -} - func insertSiteResidents0(ctx context.Context, exec bob.Executor, residents1 []*ResidentSetter, site0 *Site) (ResidentSlice, error) { for i := range residents1 { residents1[i].SiteID = omit.From(site0.ID) @@ -1268,13 +1265,13 @@ func (o *Site) Preload(name string, retrieved any) error { } switch name { - case "Leads": - rels, ok := retrieved.(LeadSlice) + case "Features": + rels, ok := retrieved.(FeatureSlice) if !ok { return fmt.Errorf("site cannot load %T as %q", retrieved, name) } - o.R.Leads = rels + o.R.Features = rels for _, rel := range rels { if rel != nil { @@ -1282,13 +1279,13 @@ func (o *Site) Preload(name string, retrieved any) error { } } return nil - case "Pools": - rels, ok := retrieved.(PoolSlice) + case "Leads": + rels, ok := retrieved.(LeadSlice) if !ok { return fmt.Errorf("site cannot load %T as %q", retrieved, name) } - o.R.Pools = rels + o.R.Leads = rels for _, rel := range rels { if rel != nil { @@ -1428,8 +1425,8 @@ func buildSitePreloader() sitePreloader { } type siteThenLoader[Q orm.Loadable] struct { + Features func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] Leads func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - Pools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] Residents func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] Address func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] CreatorUser func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] @@ -1438,12 +1435,12 @@ type siteThenLoader[Q orm.Loadable] struct { } func buildSiteThenLoader[Q orm.Loadable]() siteThenLoader[Q] { + type FeaturesLoadInterface interface { + LoadFeatures(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } type LeadsLoadInterface interface { LoadLeads(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } - type PoolsLoadInterface interface { - LoadPools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } type ResidentsLoadInterface interface { LoadResidents(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } @@ -1461,18 +1458,18 @@ func buildSiteThenLoader[Q orm.Loadable]() siteThenLoader[Q] { } return siteThenLoader[Q]{ + Features: thenLoadBuilder[Q]( + "Features", + func(ctx context.Context, exec bob.Executor, retrieved FeaturesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadFeatures(ctx, exec, mods...) + }, + ), Leads: thenLoadBuilder[Q]( "Leads", func(ctx context.Context, exec bob.Executor, retrieved LeadsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { return retrieved.LoadLeads(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...) - }, - ), Residents: thenLoadBuilder[Q]( "Residents", func(ctx context.Context, exec bob.Executor, retrieved ResidentsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { @@ -1506,6 +1503,71 @@ func buildSiteThenLoader[Q orm.Loadable]() siteThenLoader[Q] { } } +// LoadFeatures loads the site's Features into the .R struct +func (o *Site) LoadFeatures(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.Features = nil + + related, err := o.Features(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.Site = o + } + + o.R.Features = related + return nil +} + +// LoadFeatures loads the site's Features into the .R struct +func (os SiteSlice) LoadFeatures(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + features, err := os.Features(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.Features = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range features { + + if !(o.ID == rel.SiteID) { + continue + } + + if !(o.Version == rel.SiteVersion) { + continue + } + + rel.R.Site = o + + o.R.Features = append(o.R.Features, rel) + } + } + + return nil +} + // LoadLeads loads the site's Leads into the .R struct func (o *Site) LoadLeads(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { @@ -1577,71 +1639,6 @@ func (os SiteSlice) LoadLeads(ctx context.Context, exec bob.Executor, mods ...bo return nil } -// LoadPools loads the site's Pools into the .R struct -func (o *Site) 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.Site = o - } - - o.R.Pools = related - return nil -} - -// LoadPools loads the site's Pools into the .R struct -func (os SiteSlice) LoadPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - pools, 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 pools { - - if !(o.ID == rel.SiteID) { - continue - } - - if !(o.Version == rel.SiteVersion) { - continue - } - - rel.R.Site = o - - o.R.Pools = append(o.R.Pools, rel) - } - } - - return nil -} - // LoadResidents loads the site's Residents into the .R struct func (o *Site) LoadResidents(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { @@ -1920,340 +1917,3 @@ func (os SiteSlice) LoadParcel(ctx context.Context, exec bob.Executor, mods ...b return nil } - -// siteC is where relationship counts are stored. -type siteC struct { - Leads *int64 - Pools *int64 - Residents *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *Site) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "Leads": - o.C.Leads = &count - case "Pools": - o.C.Pools = &count - case "Residents": - o.C.Residents = &count - } - return nil -} - -type siteCountPreloader struct { - Leads func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Pools func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - Residents func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildSiteCountPreloader() siteCountPreloader { - return siteCountPreloader{ - Leads: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Site]("Leads", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Sites.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(Leads.Name()), - sm.Where(psql.Quote(Leads.Alias(), "site_id").EQ(psql.Quote(parent, "id"))), - sm.Where(psql.Quote(Leads.Alias(), "site_version").EQ(psql.Quote(parent, "version"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Pools: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Site]("Pools", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Sites.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(Pools.Name()), - sm.Where(psql.Quote(Pools.Alias(), "site_id").EQ(psql.Quote(parent, "id"))), - sm.Where(psql.Quote(Pools.Alias(), "site_version").EQ(psql.Quote(parent, "version"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - Residents: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*Site]("Residents", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Sites.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(Residents.Name()), - sm.Where(psql.Quote(Residents.Alias(), "site_id").EQ(psql.Quote(parent, "id"))), - sm.Where(psql.Quote(Residents.Alias(), "site_version").EQ(psql.Quote(parent, "version"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type siteCountThenLoader[Q orm.Loadable] struct { - Leads func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - Pools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - Residents func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildSiteCountThenLoader[Q orm.Loadable]() siteCountThenLoader[Q] { - type LeadsCountInterface interface { - LoadCountLeads(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type PoolsCountInterface interface { - LoadCountPools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type ResidentsCountInterface interface { - LoadCountResidents(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return siteCountThenLoader[Q]{ - Leads: countThenLoadBuilder[Q]( - "Leads", - func(ctx context.Context, exec bob.Executor, retrieved LeadsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountLeads(ctx, exec, mods...) - }, - ), - Pools: countThenLoadBuilder[Q]( - "Pools", - func(ctx context.Context, exec bob.Executor, retrieved PoolsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountPools(ctx, exec, mods...) - }, - ), - Residents: countThenLoadBuilder[Q]( - "Residents", - func(ctx context.Context, exec bob.Executor, retrieved ResidentsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountResidents(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountLeads loads the count of Leads into the C struct -func (o *Site) LoadCountLeads(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Leads(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Leads = &count - return nil -} - -// LoadCountLeads loads the count of Leads for a slice -func (os SiteSlice) LoadCountLeads(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountLeads(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountPools loads the count of Pools into the C struct -func (o *Site) LoadCountPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Pools(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Pools = &count - return nil -} - -// LoadCountPools loads the count of Pools for a slice -func (os SiteSlice) LoadCountPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountPools(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountResidents loads the count of Residents into the C struct -func (o *Site) LoadCountResidents(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.Residents(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.Residents = &count - return nil -} - -// LoadCountResidents loads the count of Residents for a slice -func (os SiteSlice) LoadCountResidents(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountResidents(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type siteJoins[Q dialect.Joinable] struct { - typ string - Leads modAs[Q, leadColumns] - Pools modAs[Q, poolColumns] - Residents modAs[Q, residentColumns] - Address modAs[Q, addressColumns] - CreatorUser modAs[Q, userColumns] - File modAs[Q, fileuploadFileColumns] - Parcel modAs[Q, parcelColumns] -} - -func (j siteJoins[Q]) aliasedAs(alias string) siteJoins[Q] { - return buildSiteJoins[Q](buildSiteColumns(alias), j.typ) -} - -func buildSiteJoins[Q dialect.Joinable](cols siteColumns, typ string) siteJoins[Q] { - return siteJoins[Q]{ - typ: typ, - Leads: modAs[Q, leadColumns]{ - c: Leads.Columns, - f: func(to leadColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Leads.Name().As(to.Alias())).On( - to.SiteID.EQ(cols.ID), to.SiteVersion.EQ(cols.Version), - )) - } - - return mods - }, - }, - Pools: modAs[Q, poolColumns]{ - c: Pools.Columns, - f: func(to poolColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Pools.Name().As(to.Alias())).On( - to.SiteID.EQ(cols.ID), to.SiteVersion.EQ(cols.Version), - )) - } - - return mods - }, - }, - Residents: modAs[Q, residentColumns]{ - c: Residents.Columns, - f: func(to residentColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Residents.Name().As(to.Alias())).On( - to.SiteID.EQ(cols.ID), to.SiteVersion.EQ(cols.Version), - )) - } - - return mods - }, - }, - Address: modAs[Q, addressColumns]{ - c: Addresses.Columns, - f: func(to addressColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Addresses.Name().As(to.Alias())).On( - to.ID.EQ(cols.AddressID), - )) - } - - return mods - }, - }, - 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 - }, - }, - File: modAs[Q, fileuploadFileColumns]{ - c: FileuploadFiles.Columns, - f: func(to fileuploadFileColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FileuploadFiles.Name().As(to.Alias())).On( - to.ID.EQ(cols.FileID), - )) - } - - return mods - }, - }, - Parcel: modAs[Q, parcelColumns]{ - c: Parcels.Columns, - f: func(to parcelColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Parcels.Name().As(to.Alias())).On( - to.ID.EQ(cols.ParcelID), - )) - } - - return mods - }, - }, - } -} diff --git a/db/models/user_.bob.go b/db/models/user_.bob.go index 1408a10b..881d4b7e 100644 --- a/db/models/user_.bob.go +++ b/db/models/user_.bob.go @@ -16,7 +16,6 @@ import ( "github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/um" "github.com/Gleipnir-Technology/bob/expr" - "github.com/Gleipnir-Technology/bob/mods" "github.com/Gleipnir-Technology/bob/orm" "github.com/Gleipnir-Technology/bob/types/pgtypes" enums "github.com/Gleipnir-Technology/nidus-sync/db/enums" @@ -42,8 +41,6 @@ type User struct { Role enums.Userrole `db:"role" ` R userR `db:"-" ` - - C userC `db:"-" ` } // UserSlice is an alias for a slice of pointers to User. @@ -61,6 +58,7 @@ type userR struct { UserOauthTokens ArcgisOauthTokenSlice // arcgis.oauth_token.oauth_token_user_id_fkey PublicUserUser ArcgisUserSlice // arcgis.user_.user__public_user_id_fkey CreatorComplianceReportRequests ComplianceReportRequestSlice // compliance_report_request.compliance_report_request_creator_fkey + CreatorFeatures FeatureSlice // feature.feature_creator_id_fkey CommitterFiles FileuploadFileSlice // fileupload.file.file_committer_fkey CreatorFiles FileuploadFileSlice // fileupload.file.file_creator_id_fkey FileuploadPool FileuploadPoolSlice // fileupload.pool.pool_creator_id_fkey @@ -70,8 +68,9 @@ type userR struct { 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 - CreatorPools PoolSlice // pool.pool_creator_id_fkey CreatorResidents ResidentSlice // resident.resident_creator_fkey + CreatorReviewTasks ReviewTaskSlice // review_task.review_task_creator_id_fkey + ReviewerReviewTasks ReviewTaskSlice // review_task.review_task_reviewer_id_fkey AddressorSignals SignalSlice // signal.signal_addressor_fkey CreatorSignals SignalSlice // signal.signal_creator_fkey CreatorSites SiteSlice // site.site_creator_id_fkey @@ -716,6 +715,30 @@ func (os UserSlice) CreatorComplianceReportRequests(mods ...bob.Mod[*dialect.Sel )...) } +// CreatorFeatures starts a query for related objects on feature +func (o *User) CreatorFeatures(mods ...bob.Mod[*dialect.SelectQuery]) FeaturesQuery { + return Features.Query(append(mods, + sm.Where(Features.Columns.CreatorID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os UserSlice) CreatorFeatures(mods ...bob.Mod[*dialect.SelectQuery]) FeaturesQuery { + 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 Features.Query(append(mods, + sm.Where(psql.Group(Features.Columns.CreatorID).OP("IN", PKArgExpr)), + )...) +} + // CommitterFiles starts a query for related objects on fileupload.file func (o *User) CommitterFiles(mods ...bob.Mod[*dialect.SelectQuery]) FileuploadFilesQuery { return FileuploadFiles.Query(append(mods, @@ -932,30 +955,6 @@ func (os UserSlice) UserNotifications(mods ...bob.Mod[*dialect.SelectQuery]) Not )...) } -// CreatorPools starts a query for related objects on pool -func (o *User) CreatorPools(mods ...bob.Mod[*dialect.SelectQuery]) PoolsQuery { - return Pools.Query(append(mods, - sm.Where(Pools.Columns.CreatorID.EQ(psql.Arg(o.ID))), - )...) -} - -func (os UserSlice) CreatorPools(mods ...bob.Mod[*dialect.SelectQuery]) PoolsQuery { - 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 Pools.Query(append(mods, - sm.Where(psql.Group(Pools.Columns.CreatorID).OP("IN", PKArgExpr)), - )...) -} - // CreatorResidents starts a query for related objects on resident func (o *User) CreatorResidents(mods ...bob.Mod[*dialect.SelectQuery]) ResidentsQuery { return Residents.Query(append(mods, @@ -980,6 +979,54 @@ func (os UserSlice) CreatorResidents(mods ...bob.Mod[*dialect.SelectQuery]) Resi )...) } +// CreatorReviewTasks starts a query for related objects on review_task +func (o *User) CreatorReviewTasks(mods ...bob.Mod[*dialect.SelectQuery]) ReviewTasksQuery { + return ReviewTasks.Query(append(mods, + sm.Where(ReviewTasks.Columns.CreatorID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os UserSlice) CreatorReviewTasks(mods ...bob.Mod[*dialect.SelectQuery]) ReviewTasksQuery { + 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 ReviewTasks.Query(append(mods, + sm.Where(psql.Group(ReviewTasks.Columns.CreatorID).OP("IN", PKArgExpr)), + )...) +} + +// ReviewerReviewTasks starts a query for related objects on review_task +func (o *User) ReviewerReviewTasks(mods ...bob.Mod[*dialect.SelectQuery]) ReviewTasksQuery { + return ReviewTasks.Query(append(mods, + sm.Where(ReviewTasks.Columns.ReviewerID.EQ(psql.Arg(o.ID))), + )...) +} + +func (os UserSlice) ReviewerReviewTasks(mods ...bob.Mod[*dialect.SelectQuery]) ReviewTasksQuery { + 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 ReviewTasks.Query(append(mods, + sm.Where(psql.Group(ReviewTasks.Columns.ReviewerID).OP("IN", PKArgExpr)), + )...) +} + // AddressorSignals starts a query for related objects on signal func (o *User) AddressorSignals(mods ...bob.Mod[*dialect.SelectQuery]) SignalsQuery { return Signals.Query(append(mods, @@ -1280,6 +1327,74 @@ func (user0 *User) AttachCreatorComplianceReportRequests(ctx context.Context, ex return nil } +func insertUserCreatorFeatures0(ctx context.Context, exec bob.Executor, features1 []*FeatureSetter, user0 *User) (FeatureSlice, error) { + for i := range features1 { + features1[i].CreatorID = omit.From(user0.ID) + } + + ret, err := Features.Insert(bob.ToMods(features1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertUserCreatorFeatures0: %w", err) + } + + return ret, nil +} + +func attachUserCreatorFeatures0(ctx context.Context, exec bob.Executor, count int, features1 FeatureSlice, user0 *User) (FeatureSlice, error) { + setter := &FeatureSetter{ + CreatorID: omit.From(user0.ID), + } + + err := features1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachUserCreatorFeatures0: %w", err) + } + + return features1, nil +} + +func (user0 *User) InsertCreatorFeatures(ctx context.Context, exec bob.Executor, related ...*FeatureSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + features1, err := insertUserCreatorFeatures0(ctx, exec, related, user0) + if err != nil { + return err + } + + user0.R.CreatorFeatures = append(user0.R.CreatorFeatures, features1...) + + for _, rel := range features1 { + rel.R.CreatorUser = user0 + } + return nil +} + +func (user0 *User) AttachCreatorFeatures(ctx context.Context, exec bob.Executor, related ...*Feature) error { + if len(related) == 0 { + return nil + } + + var err error + features1 := FeatureSlice(related) + + _, err = attachUserCreatorFeatures0(ctx, exec, len(related), features1, user0) + if err != nil { + return err + } + + user0.R.CreatorFeatures = append(user0.R.CreatorFeatures, features1...) + + for _, rel := range related { + rel.R.CreatorUser = user0 + } + + return nil +} + func insertUserCommitterFiles0(ctx context.Context, exec bob.Executor, fileuploadFiles1 []*FileuploadFileSetter, user0 *User) (FileuploadFileSlice, error) { for i := range fileuploadFiles1 { fileuploadFiles1[i].Committer = omitnull.From(user0.ID) @@ -1892,74 +2007,6 @@ func (user0 *User) AttachUserNotifications(ctx context.Context, exec bob.Executo return nil } -func insertUserCreatorPools0(ctx context.Context, exec bob.Executor, pools1 []*PoolSetter, user0 *User) (PoolSlice, error) { - for i := range pools1 { - pools1[i].CreatorID = omit.From(user0.ID) - } - - ret, err := Pools.Insert(bob.ToMods(pools1...)).All(ctx, exec) - if err != nil { - return ret, fmt.Errorf("insertUserCreatorPools0: %w", err) - } - - return ret, nil -} - -func attachUserCreatorPools0(ctx context.Context, exec bob.Executor, count int, pools1 PoolSlice, user0 *User) (PoolSlice, error) { - setter := &PoolSetter{ - CreatorID: omit.From(user0.ID), - } - - err := pools1.UpdateAll(ctx, exec, *setter) - if err != nil { - return nil, fmt.Errorf("attachUserCreatorPools0: %w", err) - } - - return pools1, nil -} - -func (user0 *User) InsertCreatorPools(ctx context.Context, exec bob.Executor, related ...*PoolSetter) error { - if len(related) == 0 { - return nil - } - - var err error - - pools1, err := insertUserCreatorPools0(ctx, exec, related, user0) - if err != nil { - return err - } - - user0.R.CreatorPools = append(user0.R.CreatorPools, pools1...) - - for _, rel := range pools1 { - rel.R.CreatorUser = user0 - } - return nil -} - -func (user0 *User) AttachCreatorPools(ctx context.Context, exec bob.Executor, related ...*Pool) error { - if len(related) == 0 { - return nil - } - - var err error - pools1 := PoolSlice(related) - - _, err = attachUserCreatorPools0(ctx, exec, len(related), pools1, user0) - if err != nil { - return err - } - - user0.R.CreatorPools = append(user0.R.CreatorPools, pools1...) - - for _, rel := range related { - rel.R.CreatorUser = user0 - } - - return nil -} - func insertUserCreatorResidents0(ctx context.Context, exec bob.Executor, residents1 []*ResidentSetter, user0 *User) (ResidentSlice, error) { for i := range residents1 { residents1[i].Creator = omit.From(user0.ID) @@ -2028,6 +2075,142 @@ func (user0 *User) AttachCreatorResidents(ctx context.Context, exec bob.Executor return nil } +func insertUserCreatorReviewTasks0(ctx context.Context, exec bob.Executor, reviewTasks1 []*ReviewTaskSetter, user0 *User) (ReviewTaskSlice, error) { + for i := range reviewTasks1 { + reviewTasks1[i].CreatorID = omitnull.From(user0.ID) + } + + ret, err := ReviewTasks.Insert(bob.ToMods(reviewTasks1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertUserCreatorReviewTasks0: %w", err) + } + + return ret, nil +} + +func attachUserCreatorReviewTasks0(ctx context.Context, exec bob.Executor, count int, reviewTasks1 ReviewTaskSlice, user0 *User) (ReviewTaskSlice, error) { + setter := &ReviewTaskSetter{ + CreatorID: omitnull.From(user0.ID), + } + + err := reviewTasks1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachUserCreatorReviewTasks0: %w", err) + } + + return reviewTasks1, nil +} + +func (user0 *User) InsertCreatorReviewTasks(ctx context.Context, exec bob.Executor, related ...*ReviewTaskSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + reviewTasks1, err := insertUserCreatorReviewTasks0(ctx, exec, related, user0) + if err != nil { + return err + } + + user0.R.CreatorReviewTasks = append(user0.R.CreatorReviewTasks, reviewTasks1...) + + for _, rel := range reviewTasks1 { + rel.R.CreatorUser = user0 + } + return nil +} + +func (user0 *User) AttachCreatorReviewTasks(ctx context.Context, exec bob.Executor, related ...*ReviewTask) error { + if len(related) == 0 { + return nil + } + + var err error + reviewTasks1 := ReviewTaskSlice(related) + + _, err = attachUserCreatorReviewTasks0(ctx, exec, len(related), reviewTasks1, user0) + if err != nil { + return err + } + + user0.R.CreatorReviewTasks = append(user0.R.CreatorReviewTasks, reviewTasks1...) + + for _, rel := range related { + rel.R.CreatorUser = user0 + } + + return nil +} + +func insertUserReviewerReviewTasks0(ctx context.Context, exec bob.Executor, reviewTasks1 []*ReviewTaskSetter, user0 *User) (ReviewTaskSlice, error) { + for i := range reviewTasks1 { + reviewTasks1[i].ReviewerID = omitnull.From(user0.ID) + } + + ret, err := ReviewTasks.Insert(bob.ToMods(reviewTasks1...)).All(ctx, exec) + if err != nil { + return ret, fmt.Errorf("insertUserReviewerReviewTasks0: %w", err) + } + + return ret, nil +} + +func attachUserReviewerReviewTasks0(ctx context.Context, exec bob.Executor, count int, reviewTasks1 ReviewTaskSlice, user0 *User) (ReviewTaskSlice, error) { + setter := &ReviewTaskSetter{ + ReviewerID: omitnull.From(user0.ID), + } + + err := reviewTasks1.UpdateAll(ctx, exec, *setter) + if err != nil { + return nil, fmt.Errorf("attachUserReviewerReviewTasks0: %w", err) + } + + return reviewTasks1, nil +} + +func (user0 *User) InsertReviewerReviewTasks(ctx context.Context, exec bob.Executor, related ...*ReviewTaskSetter) error { + if len(related) == 0 { + return nil + } + + var err error + + reviewTasks1, err := insertUserReviewerReviewTasks0(ctx, exec, related, user0) + if err != nil { + return err + } + + user0.R.ReviewerReviewTasks = append(user0.R.ReviewerReviewTasks, reviewTasks1...) + + for _, rel := range reviewTasks1 { + rel.R.ReviewerUser = user0 + } + return nil +} + +func (user0 *User) AttachReviewerReviewTasks(ctx context.Context, exec bob.Executor, related ...*ReviewTask) error { + if len(related) == 0 { + return nil + } + + var err error + reviewTasks1 := ReviewTaskSlice(related) + + _, err = attachUserReviewerReviewTasks0(ctx, exec, len(related), reviewTasks1, user0) + if err != nil { + return err + } + + user0.R.ReviewerReviewTasks = append(user0.R.ReviewerReviewTasks, reviewTasks1...) + + for _, rel := range related { + rel.R.ReviewerUser = user0 + } + + return nil +} + func insertUserAddressorSignals0(ctx context.Context, exec bob.Executor, signals1 []*SignalSetter, user0 *User) (SignalSlice, error) { for i := range signals1 { signals1[i].Addressor = omitnull.From(user0.ID) @@ -2360,6 +2543,20 @@ func (o *User) Preload(name string, retrieved any) error { o.R.CreatorComplianceReportRequests = rels + for _, rel := range rels { + if rel != nil { + rel.R.CreatorUser = o + } + } + return nil + case "CreatorFeatures": + rels, ok := retrieved.(FeatureSlice) + if !ok { + return fmt.Errorf("user cannot load %T as %q", retrieved, name) + } + + o.R.CreatorFeatures = rels + for _, rel := range rels { if rel != nil { rel.R.CreatorUser = o @@ -2492,20 +2689,6 @@ func (o *User) Preload(name string, retrieved any) error { } } return nil - case "CreatorPools": - rels, ok := retrieved.(PoolSlice) - if !ok { - return fmt.Errorf("user cannot load %T as %q", retrieved, name) - } - - o.R.CreatorPools = rels - - for _, rel := range rels { - if rel != nil { - rel.R.CreatorUser = o - } - } - return nil case "CreatorResidents": rels, ok := retrieved.(ResidentSlice) if !ok { @@ -2520,6 +2703,34 @@ func (o *User) Preload(name string, retrieved any) error { } } return nil + case "CreatorReviewTasks": + rels, ok := retrieved.(ReviewTaskSlice) + if !ok { + return fmt.Errorf("user cannot load %T as %q", retrieved, name) + } + + o.R.CreatorReviewTasks = rels + + for _, rel := range rels { + if rel != nil { + rel.R.CreatorUser = o + } + } + return nil + case "ReviewerReviewTasks": + rels, ok := retrieved.(ReviewTaskSlice) + if !ok { + return fmt.Errorf("user cannot load %T as %q", retrieved, name) + } + + o.R.ReviewerReviewTasks = rels + + for _, rel := range rels { + if rel != nil { + rel.R.ReviewerUser = o + } + } + return nil case "AddressorSignals": rels, ok := retrieved.(SignalSlice) if !ok { @@ -2605,6 +2816,7 @@ type userThenLoader[Q orm.Loadable] struct { UserOauthTokens func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] PublicUserUser func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] CreatorComplianceReportRequests func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + CreatorFeatures func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] CommitterFiles func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] CreatorFiles func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] FileuploadPool func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] @@ -2614,8 +2826,9 @@ type userThenLoader[Q orm.Loadable] struct { 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] - CreatorPools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] CreatorResidents func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + CreatorReviewTasks func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] + ReviewerReviewTasks func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] AddressorSignals func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] CreatorSignals func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] CreatorSites func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] @@ -2632,6 +2845,9 @@ func buildUserThenLoader[Q orm.Loadable]() userThenLoader[Q] { type CreatorComplianceReportRequestsLoadInterface interface { LoadCreatorComplianceReportRequests(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } + type CreatorFeaturesLoadInterface interface { + LoadCreatorFeatures(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } type CommitterFilesLoadInterface interface { LoadCommitterFiles(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } @@ -2659,12 +2875,15 @@ func buildUserThenLoader[Q orm.Loadable]() userThenLoader[Q] { type UserNotificationsLoadInterface interface { LoadUserNotifications(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } - type CreatorPoolsLoadInterface interface { - LoadCreatorPools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } type CreatorResidentsLoadInterface interface { LoadCreatorResidents(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } + type CreatorReviewTasksLoadInterface interface { + LoadCreatorReviewTasks(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } + type ReviewerReviewTasksLoadInterface interface { + LoadReviewerReviewTasks(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error + } type AddressorSignalsLoadInterface interface { LoadAddressorSignals(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } @@ -2697,6 +2916,12 @@ func buildUserThenLoader[Q orm.Loadable]() userThenLoader[Q] { return retrieved.LoadCreatorComplianceReportRequests(ctx, exec, mods...) }, ), + CreatorFeatures: thenLoadBuilder[Q]( + "CreatorFeatures", + func(ctx context.Context, exec bob.Executor, retrieved CreatorFeaturesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadCreatorFeatures(ctx, exec, mods...) + }, + ), CommitterFiles: thenLoadBuilder[Q]( "CommitterFiles", func(ctx context.Context, exec bob.Executor, retrieved CommitterFilesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { @@ -2751,18 +2976,24 @@ func buildUserThenLoader[Q orm.Loadable]() userThenLoader[Q] { return retrieved.LoadUserNotifications(ctx, exec, mods...) }, ), - CreatorPools: thenLoadBuilder[Q]( - "CreatorPools", - func(ctx context.Context, exec bob.Executor, retrieved CreatorPoolsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCreatorPools(ctx, exec, mods...) - }, - ), CreatorResidents: thenLoadBuilder[Q]( "CreatorResidents", func(ctx context.Context, exec bob.Executor, retrieved CreatorResidentsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { return retrieved.LoadCreatorResidents(ctx, exec, mods...) }, ), + CreatorReviewTasks: thenLoadBuilder[Q]( + "CreatorReviewTasks", + func(ctx context.Context, exec bob.Executor, retrieved CreatorReviewTasksLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadCreatorReviewTasks(ctx, exec, mods...) + }, + ), + ReviewerReviewTasks: thenLoadBuilder[Q]( + "ReviewerReviewTasks", + func(ctx context.Context, exec bob.Executor, retrieved ReviewerReviewTasksLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { + return retrieved.LoadReviewerReviewTasks(ctx, exec, mods...) + }, + ), AddressorSignals: thenLoadBuilder[Q]( "AddressorSignals", func(ctx context.Context, exec bob.Executor, retrieved AddressorSignalsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { @@ -2973,6 +3204,67 @@ func (os UserSlice) LoadCreatorComplianceReportRequests(ctx context.Context, exe return nil } +// LoadCreatorFeatures loads the user's CreatorFeatures into the .R struct +func (o *User) LoadCreatorFeatures(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.CreatorFeatures = nil + + related, err := o.CreatorFeatures(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.CreatorUser = o + } + + o.R.CreatorFeatures = related + return nil +} + +// LoadCreatorFeatures loads the user's CreatorFeatures into the .R struct +func (os UserSlice) LoadCreatorFeatures(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + features, err := os.CreatorFeatures(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.CreatorFeatures = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range features { + + if !(o.ID == rel.CreatorID) { + continue + } + + rel.R.CreatorUser = o + + o.R.CreatorFeatures = append(o.R.CreatorFeatures, rel) + } + } + + return nil +} + // LoadCommitterFiles loads the user's CommitterFiles into the .R struct func (o *User) LoadCommitterFiles(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { @@ -3531,67 +3823,6 @@ func (os UserSlice) LoadUserNotifications(ctx context.Context, exec bob.Executor return nil } -// LoadCreatorPools loads the user's CreatorPools into the .R struct -func (o *User) LoadCreatorPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - // Reset the relationship - o.R.CreatorPools = nil - - related, err := o.CreatorPools(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, rel := range related { - rel.R.CreatorUser = o - } - - o.R.CreatorPools = related - return nil -} - -// LoadCreatorPools loads the user's CreatorPools into the .R struct -func (os UserSlice) LoadCreatorPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - pools, err := os.CreatorPools(mods...).All(ctx, exec) - if err != nil { - return err - } - - for _, o := range os { - if o == nil { - continue - } - - o.R.CreatorPools = nil - } - - for _, o := range os { - if o == nil { - continue - } - - for _, rel := range pools { - - if !(o.ID == rel.CreatorID) { - continue - } - - rel.R.CreatorUser = o - - o.R.CreatorPools = append(o.R.CreatorPools, rel) - } - } - - return nil -} - // LoadCreatorResidents loads the user's CreatorResidents into the .R struct func (o *User) LoadCreatorResidents(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { @@ -3653,6 +3884,134 @@ func (os UserSlice) LoadCreatorResidents(ctx context.Context, exec bob.Executor, return nil } +// LoadCreatorReviewTasks loads the user's CreatorReviewTasks into the .R struct +func (o *User) LoadCreatorReviewTasks(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.CreatorReviewTasks = nil + + related, err := o.CreatorReviewTasks(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.CreatorUser = o + } + + o.R.CreatorReviewTasks = related + return nil +} + +// LoadCreatorReviewTasks loads the user's CreatorReviewTasks into the .R struct +func (os UserSlice) LoadCreatorReviewTasks(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + reviewTasks, err := os.CreatorReviewTasks(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.CreatorReviewTasks = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range reviewTasks { + + if !rel.CreatorID.IsValue() { + continue + } + if !(rel.CreatorID.IsValue() && o.ID == rel.CreatorID.MustGet()) { + continue + } + + rel.R.CreatorUser = o + + o.R.CreatorReviewTasks = append(o.R.CreatorReviewTasks, rel) + } + } + + return nil +} + +// LoadReviewerReviewTasks loads the user's ReviewerReviewTasks into the .R struct +func (o *User) LoadReviewerReviewTasks(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if o == nil { + return nil + } + + // Reset the relationship + o.R.ReviewerReviewTasks = nil + + related, err := o.ReviewerReviewTasks(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, rel := range related { + rel.R.ReviewerUser = o + } + + o.R.ReviewerReviewTasks = related + return nil +} + +// LoadReviewerReviewTasks loads the user's ReviewerReviewTasks into the .R struct +func (os UserSlice) LoadReviewerReviewTasks(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { + if len(os) == 0 { + return nil + } + + reviewTasks, err := os.ReviewerReviewTasks(mods...).All(ctx, exec) + if err != nil { + return err + } + + for _, o := range os { + if o == nil { + continue + } + + o.R.ReviewerReviewTasks = nil + } + + for _, o := range os { + if o == nil { + continue + } + + for _, rel := range reviewTasks { + + if !rel.ReviewerID.IsValue() { + continue + } + if !(rel.ReviewerID.IsValue() && o.ID == rel.ReviewerID.MustGet()) { + continue + } + + rel.R.ReviewerUser = o + + o.R.ReviewerReviewTasks = append(o.R.ReviewerReviewTasks, rel) + } + } + + return nil +} + // LoadAddressorSignals loads the user's AddressorSignals into the .R struct func (o *User) LoadAddressorSignals(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { @@ -3890,1356 +4249,3 @@ func (os UserSlice) LoadOrganization(ctx context.Context, exec bob.Executor, mod return nil } - -// userC is where relationship counts are stored. -type userC struct { - UserOauthTokens *int64 - PublicUserUser *int64 - CreatorComplianceReportRequests *int64 - CommitterFiles *int64 - CreatorFiles *int64 - FileuploadPool *int64 - CreatorLeads *int64 - CreatorNoteAudios *int64 - DeletorNoteAudios *int64 - CreatorNoteImages *int64 - DeletorNoteImages *int64 - UserNotifications *int64 - CreatorPools *int64 - CreatorResidents *int64 - AddressorSignals *int64 - CreatorSignals *int64 - CreatorSites *int64 -} - -// PreloadCount sets a count in the C struct by name -func (o *User) PreloadCount(name string, count int64) error { - if o == nil { - return nil - } - - switch name { - case "UserOauthTokens": - o.C.UserOauthTokens = &count - case "PublicUserUser": - o.C.PublicUserUser = &count - case "CreatorComplianceReportRequests": - o.C.CreatorComplianceReportRequests = &count - case "CommitterFiles": - o.C.CommitterFiles = &count - case "CreatorFiles": - o.C.CreatorFiles = &count - case "FileuploadPool": - o.C.FileuploadPool = &count - case "CreatorLeads": - o.C.CreatorLeads = &count - case "CreatorNoteAudios": - o.C.CreatorNoteAudios = &count - case "DeletorNoteAudios": - o.C.DeletorNoteAudios = &count - case "CreatorNoteImages": - o.C.CreatorNoteImages = &count - case "DeletorNoteImages": - o.C.DeletorNoteImages = &count - case "UserNotifications": - o.C.UserNotifications = &count - case "CreatorPools": - o.C.CreatorPools = &count - case "CreatorResidents": - o.C.CreatorResidents = &count - case "AddressorSignals": - o.C.AddressorSignals = &count - case "CreatorSignals": - o.C.CreatorSignals = &count - case "CreatorSites": - o.C.CreatorSites = &count - } - return nil -} - -type userCountPreloader struct { - UserOauthTokens func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - PublicUserUser func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - CreatorComplianceReportRequests func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - CommitterFiles func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - CreatorFiles func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - FileuploadPool func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - CreatorLeads func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - CreatorNoteAudios func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - DeletorNoteAudios func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - CreatorNoteImages func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - DeletorNoteImages func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - UserNotifications func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - CreatorPools func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - CreatorResidents func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - AddressorSignals func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - CreatorSignals func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader - CreatorSites func(...bob.Mod[*dialect.SelectQuery]) psql.Preloader -} - -func buildUserCountPreloader() userCountPreloader { - return userCountPreloader{ - UserOauthTokens: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*User]("UserOauthTokens", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Users.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(ArcgisOauthTokens.Name()), - sm.Where(psql.Quote(ArcgisOauthTokens.Alias(), "user_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - PublicUserUser: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*User]("PublicUserUser", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Users.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(ArcgisUsers.Name()), - sm.Where(psql.Quote(ArcgisUsers.Alias(), "public_user_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - CreatorComplianceReportRequests: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*User]("CreatorComplianceReportRequests", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Users.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(ComplianceReportRequests.Name()), - sm.Where(psql.Quote(ComplianceReportRequests.Alias(), "creator").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - CommitterFiles: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*User]("CommitterFiles", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Users.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FileuploadFiles.Name()), - sm.Where(psql.Quote(FileuploadFiles.Alias(), "committer").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - CreatorFiles: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*User]("CreatorFiles", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Users.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FileuploadFiles.Name()), - sm.Where(psql.Quote(FileuploadFiles.Alias(), "creator_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - FileuploadPool: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*User]("FileuploadPool", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Users.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(FileuploadPools.Name()), - sm.Where(psql.Quote(FileuploadPools.Alias(), "creator_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - CreatorLeads: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*User]("CreatorLeads", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Users.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(Leads.Name()), - sm.Where(psql.Quote(Leads.Alias(), "creator").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - CreatorNoteAudios: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*User]("CreatorNoteAudios", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Users.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(NoteAudios.Name()), - sm.Where(psql.Quote(NoteAudios.Alias(), "creator_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - DeletorNoteAudios: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*User]("DeletorNoteAudios", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Users.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(NoteAudios.Name()), - sm.Where(psql.Quote(NoteAudios.Alias(), "deletor_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - CreatorNoteImages: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*User]("CreatorNoteImages", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Users.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(NoteImages.Name()), - sm.Where(psql.Quote(NoteImages.Alias(), "creator_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - DeletorNoteImages: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*User]("DeletorNoteImages", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Users.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(NoteImages.Name()), - sm.Where(psql.Quote(NoteImages.Alias(), "deletor_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - UserNotifications: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*User]("UserNotifications", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Users.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(Notifications.Name()), - sm.Where(psql.Quote(Notifications.Alias(), "user_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - CreatorPools: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*User]("CreatorPools", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Users.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(Pools.Name()), - sm.Where(psql.Quote(Pools.Alias(), "creator_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - CreatorResidents: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*User]("CreatorResidents", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Users.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(Residents.Name()), - sm.Where(psql.Quote(Residents.Alias(), "creator").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - AddressorSignals: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*User]("AddressorSignals", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Users.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(Signals.Name()), - sm.Where(psql.Quote(Signals.Alias(), "addressor").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - CreatorSignals: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*User]("CreatorSignals", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Users.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(Signals.Name()), - sm.Where(psql.Quote(Signals.Alias(), "creator").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - CreatorSites: func(mods ...bob.Mod[*dialect.SelectQuery]) psql.Preloader { - return countPreloader[*User]("CreatorSites", func(parent string) bob.Expression { - // Build a correlated subquery: (SELECT COUNT(*) FROM related WHERE fk = parent.pk) - if parent == "" { - parent = Users.Alias() - } - - subqueryMods := []bob.Mod[*dialect.SelectQuery]{ - sm.Columns(psql.Raw("count(*)")), - - sm.From(Sites.Name()), - sm.Where(psql.Quote(Sites.Alias(), "creator_id").EQ(psql.Quote(parent, "id"))), - } - subqueryMods = append(subqueryMods, mods...) - return psql.Group(psql.Select(subqueryMods...).Expression) - }) - }, - } -} - -type userCountThenLoader[Q orm.Loadable] struct { - UserOauthTokens func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - PublicUserUser func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - CreatorComplianceReportRequests func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - CommitterFiles func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - CreatorFiles func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - FileuploadPool func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - CreatorLeads func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - 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] - CreatorPools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - CreatorResidents func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - AddressorSignals func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - CreatorSignals func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] - CreatorSites func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] -} - -func buildUserCountThenLoader[Q orm.Loadable]() userCountThenLoader[Q] { - type UserOauthTokensCountInterface interface { - LoadCountUserOauthTokens(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type PublicUserUserCountInterface interface { - LoadCountPublicUserUser(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type CreatorComplianceReportRequestsCountInterface interface { - LoadCountCreatorComplianceReportRequests(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type CommitterFilesCountInterface interface { - LoadCountCommitterFiles(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type CreatorFilesCountInterface interface { - LoadCountCreatorFiles(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type FileuploadPoolCountInterface interface { - LoadCountFileuploadPool(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type CreatorLeadsCountInterface interface { - LoadCountCreatorLeads(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type CreatorNoteAudiosCountInterface interface { - LoadCountCreatorNoteAudios(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type DeletorNoteAudiosCountInterface interface { - LoadCountDeletorNoteAudios(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type CreatorNoteImagesCountInterface interface { - LoadCountCreatorNoteImages(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type DeletorNoteImagesCountInterface interface { - LoadCountDeletorNoteImages(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type UserNotificationsCountInterface interface { - LoadCountUserNotifications(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type CreatorPoolsCountInterface interface { - LoadCountCreatorPools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type CreatorResidentsCountInterface interface { - LoadCountCreatorResidents(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type AddressorSignalsCountInterface interface { - LoadCountAddressorSignals(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type CreatorSignalsCountInterface interface { - LoadCountCreatorSignals(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - type CreatorSitesCountInterface interface { - LoadCountCreatorSites(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error - } - - return userCountThenLoader[Q]{ - UserOauthTokens: countThenLoadBuilder[Q]( - "UserOauthTokens", - func(ctx context.Context, exec bob.Executor, retrieved UserOauthTokensCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountUserOauthTokens(ctx, exec, mods...) - }, - ), - PublicUserUser: countThenLoadBuilder[Q]( - "PublicUserUser", - func(ctx context.Context, exec bob.Executor, retrieved PublicUserUserCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountPublicUserUser(ctx, exec, mods...) - }, - ), - CreatorComplianceReportRequests: countThenLoadBuilder[Q]( - "CreatorComplianceReportRequests", - func(ctx context.Context, exec bob.Executor, retrieved CreatorComplianceReportRequestsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountCreatorComplianceReportRequests(ctx, exec, mods...) - }, - ), - CommitterFiles: countThenLoadBuilder[Q]( - "CommitterFiles", - func(ctx context.Context, exec bob.Executor, retrieved CommitterFilesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountCommitterFiles(ctx, exec, mods...) - }, - ), - CreatorFiles: countThenLoadBuilder[Q]( - "CreatorFiles", - func(ctx context.Context, exec bob.Executor, retrieved CreatorFilesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountCreatorFiles(ctx, exec, mods...) - }, - ), - FileuploadPool: countThenLoadBuilder[Q]( - "FileuploadPool", - func(ctx context.Context, exec bob.Executor, retrieved FileuploadPoolCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountFileuploadPool(ctx, exec, mods...) - }, - ), - CreatorLeads: countThenLoadBuilder[Q]( - "CreatorLeads", - func(ctx context.Context, exec bob.Executor, retrieved CreatorLeadsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountCreatorLeads(ctx, exec, mods...) - }, - ), - CreatorNoteAudios: countThenLoadBuilder[Q]( - "CreatorNoteAudios", - func(ctx context.Context, exec bob.Executor, retrieved CreatorNoteAudiosCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountCreatorNoteAudios(ctx, exec, mods...) - }, - ), - DeletorNoteAudios: countThenLoadBuilder[Q]( - "DeletorNoteAudios", - func(ctx context.Context, exec bob.Executor, retrieved DeletorNoteAudiosCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountDeletorNoteAudios(ctx, exec, mods...) - }, - ), - CreatorNoteImages: countThenLoadBuilder[Q]( - "CreatorNoteImages", - func(ctx context.Context, exec bob.Executor, retrieved CreatorNoteImagesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountCreatorNoteImages(ctx, exec, mods...) - }, - ), - DeletorNoteImages: countThenLoadBuilder[Q]( - "DeletorNoteImages", - func(ctx context.Context, exec bob.Executor, retrieved DeletorNoteImagesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountDeletorNoteImages(ctx, exec, mods...) - }, - ), - UserNotifications: countThenLoadBuilder[Q]( - "UserNotifications", - func(ctx context.Context, exec bob.Executor, retrieved UserNotificationsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountUserNotifications(ctx, exec, mods...) - }, - ), - CreatorPools: countThenLoadBuilder[Q]( - "CreatorPools", - func(ctx context.Context, exec bob.Executor, retrieved CreatorPoolsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountCreatorPools(ctx, exec, mods...) - }, - ), - CreatorResidents: countThenLoadBuilder[Q]( - "CreatorResidents", - func(ctx context.Context, exec bob.Executor, retrieved CreatorResidentsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountCreatorResidents(ctx, exec, mods...) - }, - ), - AddressorSignals: countThenLoadBuilder[Q]( - "AddressorSignals", - func(ctx context.Context, exec bob.Executor, retrieved AddressorSignalsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountAddressorSignals(ctx, exec, mods...) - }, - ), - CreatorSignals: countThenLoadBuilder[Q]( - "CreatorSignals", - func(ctx context.Context, exec bob.Executor, retrieved CreatorSignalsCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountCreatorSignals(ctx, exec, mods...) - }, - ), - CreatorSites: countThenLoadBuilder[Q]( - "CreatorSites", - func(ctx context.Context, exec bob.Executor, retrieved CreatorSitesCountInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { - return retrieved.LoadCountCreatorSites(ctx, exec, mods...) - }, - ), - } -} - -// LoadCountUserOauthTokens loads the count of UserOauthTokens into the C struct -func (o *User) LoadCountUserOauthTokens(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.UserOauthTokens(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.UserOauthTokens = &count - return nil -} - -// LoadCountUserOauthTokens loads the count of UserOauthTokens for a slice -func (os UserSlice) LoadCountUserOauthTokens(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountUserOauthTokens(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountPublicUserUser loads the count of PublicUserUser into the C struct -func (o *User) LoadCountPublicUserUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.PublicUserUser(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.PublicUserUser = &count - return nil -} - -// LoadCountPublicUserUser loads the count of PublicUserUser for a slice -func (os UserSlice) LoadCountPublicUserUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountPublicUserUser(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountCreatorComplianceReportRequests loads the count of CreatorComplianceReportRequests into the C struct -func (o *User) LoadCountCreatorComplianceReportRequests(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.CreatorComplianceReportRequests(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.CreatorComplianceReportRequests = &count - return nil -} - -// LoadCountCreatorComplianceReportRequests loads the count of CreatorComplianceReportRequests for a slice -func (os UserSlice) LoadCountCreatorComplianceReportRequests(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountCreatorComplianceReportRequests(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountCommitterFiles loads the count of CommitterFiles into the C struct -func (o *User) LoadCountCommitterFiles(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.CommitterFiles(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.CommitterFiles = &count - return nil -} - -// LoadCountCommitterFiles loads the count of CommitterFiles for a slice -func (os UserSlice) LoadCountCommitterFiles(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountCommitterFiles(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountCreatorFiles loads the count of CreatorFiles into the C struct -func (o *User) LoadCountCreatorFiles(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.CreatorFiles(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.CreatorFiles = &count - return nil -} - -// LoadCountCreatorFiles loads the count of CreatorFiles for a slice -func (os UserSlice) LoadCountCreatorFiles(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountCreatorFiles(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountFileuploadPool loads the count of FileuploadPool into the C struct -func (o *User) LoadCountFileuploadPool(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.FileuploadPool(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.FileuploadPool = &count - return nil -} - -// LoadCountFileuploadPool loads the count of FileuploadPool for a slice -func (os UserSlice) LoadCountFileuploadPool(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountFileuploadPool(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountCreatorLeads loads the count of CreatorLeads into the C struct -func (o *User) LoadCountCreatorLeads(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.CreatorLeads(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.CreatorLeads = &count - return nil -} - -// LoadCountCreatorLeads loads the count of CreatorLeads for a slice -func (os UserSlice) LoadCountCreatorLeads(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountCreatorLeads(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountCreatorNoteAudios loads the count of CreatorNoteAudios into the C struct -func (o *User) LoadCountCreatorNoteAudios(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.CreatorNoteAudios(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.CreatorNoteAudios = &count - return nil -} - -// LoadCountCreatorNoteAudios loads the count of CreatorNoteAudios for a slice -func (os UserSlice) LoadCountCreatorNoteAudios(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountCreatorNoteAudios(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountDeletorNoteAudios loads the count of DeletorNoteAudios into the C struct -func (o *User) LoadCountDeletorNoteAudios(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.DeletorNoteAudios(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.DeletorNoteAudios = &count - return nil -} - -// LoadCountDeletorNoteAudios loads the count of DeletorNoteAudios for a slice -func (os UserSlice) LoadCountDeletorNoteAudios(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountDeletorNoteAudios(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountCreatorNoteImages loads the count of CreatorNoteImages into the C struct -func (o *User) LoadCountCreatorNoteImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.CreatorNoteImages(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.CreatorNoteImages = &count - return nil -} - -// LoadCountCreatorNoteImages loads the count of CreatorNoteImages for a slice -func (os UserSlice) LoadCountCreatorNoteImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountCreatorNoteImages(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountDeletorNoteImages loads the count of DeletorNoteImages into the C struct -func (o *User) LoadCountDeletorNoteImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.DeletorNoteImages(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.DeletorNoteImages = &count - return nil -} - -// LoadCountDeletorNoteImages loads the count of DeletorNoteImages for a slice -func (os UserSlice) LoadCountDeletorNoteImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountDeletorNoteImages(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountUserNotifications loads the count of UserNotifications into the C struct -func (o *User) LoadCountUserNotifications(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.UserNotifications(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.UserNotifications = &count - return nil -} - -// LoadCountUserNotifications loads the count of UserNotifications for a slice -func (os UserSlice) LoadCountUserNotifications(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountUserNotifications(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountCreatorPools loads the count of CreatorPools into the C struct -func (o *User) LoadCountCreatorPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.CreatorPools(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.CreatorPools = &count - return nil -} - -// LoadCountCreatorPools loads the count of CreatorPools for a slice -func (os UserSlice) LoadCountCreatorPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountCreatorPools(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountCreatorResidents loads the count of CreatorResidents into the C struct -func (o *User) LoadCountCreatorResidents(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.CreatorResidents(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.CreatorResidents = &count - return nil -} - -// LoadCountCreatorResidents loads the count of CreatorResidents for a slice -func (os UserSlice) LoadCountCreatorResidents(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountCreatorResidents(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountAddressorSignals loads the count of AddressorSignals into the C struct -func (o *User) LoadCountAddressorSignals(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.AddressorSignals(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.AddressorSignals = &count - return nil -} - -// LoadCountAddressorSignals loads the count of AddressorSignals for a slice -func (os UserSlice) LoadCountAddressorSignals(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountAddressorSignals(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountCreatorSignals loads the count of CreatorSignals into the C struct -func (o *User) LoadCountCreatorSignals(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.CreatorSignals(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.CreatorSignals = &count - return nil -} - -// LoadCountCreatorSignals loads the count of CreatorSignals for a slice -func (os UserSlice) LoadCountCreatorSignals(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountCreatorSignals(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -// LoadCountCreatorSites loads the count of CreatorSites into the C struct -func (o *User) LoadCountCreatorSites(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if o == nil { - return nil - } - - count, err := o.CreatorSites(mods...).Count(ctx, exec) - if err != nil { - return err - } - - o.C.CreatorSites = &count - return nil -} - -// LoadCountCreatorSites loads the count of CreatorSites for a slice -func (os UserSlice) LoadCountCreatorSites(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { - if len(os) == 0 { - return nil - } - - for _, o := range os { - if err := o.LoadCountCreatorSites(ctx, exec, mods...); err != nil { - return err - } - } - - return nil -} - -type userJoins[Q dialect.Joinable] struct { - typ string - UserOauthTokens modAs[Q, arcgisOauthTokenColumns] - PublicUserUser modAs[Q, arcgisuserColumns] - CreatorComplianceReportRequests modAs[Q, complianceReportRequestColumns] - CommitterFiles modAs[Q, fileuploadFileColumns] - CreatorFiles modAs[Q, fileuploadFileColumns] - FileuploadPool modAs[Q, fileuploadPoolColumns] - CreatorLeads modAs[Q, leadColumns] - CreatorNoteAudios modAs[Q, noteAudioColumns] - DeletorNoteAudios modAs[Q, noteAudioColumns] - CreatorNoteImages modAs[Q, noteImageColumns] - DeletorNoteImages modAs[Q, noteImageColumns] - UserNotifications modAs[Q, notificationColumns] - CreatorPools modAs[Q, poolColumns] - CreatorResidents modAs[Q, residentColumns] - AddressorSignals modAs[Q, signalColumns] - CreatorSignals modAs[Q, signalColumns] - CreatorSites modAs[Q, siteColumns] - Organization modAs[Q, organizationColumns] -} - -func (j userJoins[Q]) aliasedAs(alias string) userJoins[Q] { - return buildUserJoins[Q](buildUserColumns(alias), j.typ) -} - -func buildUserJoins[Q dialect.Joinable](cols userColumns, typ string) userJoins[Q] { - return userJoins[Q]{ - typ: typ, - UserOauthTokens: modAs[Q, arcgisOauthTokenColumns]{ - c: ArcgisOauthTokens.Columns, - f: func(to arcgisOauthTokenColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisOauthTokens.Name().As(to.Alias())).On( - to.UserID.EQ(cols.ID), - )) - } - - return mods - }, - }, - PublicUserUser: modAs[Q, arcgisuserColumns]{ - c: ArcgisUsers.Columns, - f: func(to arcgisuserColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ArcgisUsers.Name().As(to.Alias())).On( - to.PublicUserID.EQ(cols.ID), - )) - } - - return mods - }, - }, - CreatorComplianceReportRequests: modAs[Q, complianceReportRequestColumns]{ - c: ComplianceReportRequests.Columns, - f: func(to complianceReportRequestColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, ComplianceReportRequests.Name().As(to.Alias())).On( - to.Creator.EQ(cols.ID), - )) - } - - return mods - }, - }, - CommitterFiles: modAs[Q, fileuploadFileColumns]{ - c: FileuploadFiles.Columns, - f: func(to fileuploadFileColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FileuploadFiles.Name().As(to.Alias())).On( - to.Committer.EQ(cols.ID), - )) - } - - return mods - }, - }, - CreatorFiles: modAs[Q, fileuploadFileColumns]{ - c: FileuploadFiles.Columns, - f: func(to fileuploadFileColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FileuploadFiles.Name().As(to.Alias())).On( - to.CreatorID.EQ(cols.ID), - )) - } - - return mods - }, - }, - FileuploadPool: modAs[Q, fileuploadPoolColumns]{ - c: FileuploadPools.Columns, - f: func(to fileuploadPoolColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, FileuploadPools.Name().As(to.Alias())).On( - to.CreatorID.EQ(cols.ID), - )) - } - - return mods - }, - }, - CreatorLeads: modAs[Q, leadColumns]{ - c: Leads.Columns, - f: func(to leadColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Leads.Name().As(to.Alias())).On( - to.Creator.EQ(cols.ID), - )) - } - - return mods - }, - }, - 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] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Notifications.Name().As(to.Alias())).On( - to.UserID.EQ(cols.ID), - )) - } - - return mods - }, - }, - CreatorPools: modAs[Q, poolColumns]{ - c: Pools.Columns, - f: func(to poolColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Pools.Name().As(to.Alias())).On( - to.CreatorID.EQ(cols.ID), - )) - } - - return mods - }, - }, - CreatorResidents: modAs[Q, residentColumns]{ - c: Residents.Columns, - f: func(to residentColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Residents.Name().As(to.Alias())).On( - to.Creator.EQ(cols.ID), - )) - } - - return mods - }, - }, - AddressorSignals: modAs[Q, signalColumns]{ - c: Signals.Columns, - f: func(to signalColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Signals.Name().As(to.Alias())).On( - to.Addressor.EQ(cols.ID), - )) - } - - return mods - }, - }, - CreatorSignals: modAs[Q, signalColumns]{ - c: Signals.Columns, - f: func(to signalColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Signals.Name().As(to.Alias())).On( - to.Creator.EQ(cols.ID), - )) - } - - return mods - }, - }, - CreatorSites: modAs[Q, siteColumns]{ - c: Sites.Columns, - f: func(to siteColumns) bob.Mod[Q] { - mods := make(mods.QueryMods[Q], 0, 1) - - { - mods = append(mods, dialect.Join[Q](typ, Sites.Name().As(to.Alias())).On( - to.CreatorID.EQ(cols.ID), - )) - } - - 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 - }, - }, - } -} diff --git a/html/template/sync/review-root.html b/html/template/sync/review/root.html similarity index 100% rename from html/template/sync/review-root.html rename to html/template/sync/review/root.html diff --git a/platform/csv/csv.go b/platform/csv/csv.go index a1f4acaa..5beb6535 100644 --- a/platform/csv/csv.go +++ b/platform/csv/csv.go @@ -12,7 +12,6 @@ import ( "github.com/Gleipnir-Technology/bob" "github.com/Gleipnir-Technology/bob/dialect/psql" - "github.com/Gleipnir-Technology/bob/dialect/psql/im" "github.com/Gleipnir-Technology/bob/dialect/psql/um" //"github.com/Gleipnir-Technology/nidus-sync/config" "github.com/Gleipnir-Technology/nidus-sync/db" @@ -109,47 +108,53 @@ func JobCommit(ctx context.Context, file_id int32) error { return fmt.Errorf("insert site: %w", err) } } - var pool *models.Pool - pool, err = models.Pools.Query( - models.SelectWhere.Pools.SiteID.EQ(site.ID), - models.SelectWhere.Pools.SiteVersion.EQ(site.Version), + var feature *models.Feature + feature, err = models.Features.Query( + models.SelectWhere.Features.SiteID.EQ(site.ID), + models.SelectWhere.Features.SiteVersion.EQ(site.Version), ).One(ctx, txn) if err != nil { if err.Error() != "sql: no rows in result set" { return fmt.Errorf("query site: %w", err) } - pool, err = models.Pools.Insert(&models.PoolSetter{ - Condition: omit.From(row.Condition), + feature, err = models.Features.Insert(&models.FeatureSetter{ Created: omit.From(time.Now()), CreatorID: omit.From(file.Committer.MustGet()), //ID: row.Address, SiteID: omit.From(site.ID), SiteVersion: omit.From(site.Version), }).One(ctx, txn) + if err != nil { + return fmt.Errorf("insert feature: %w", err) + } + _, err := models.FeaturePools.Insert(&models.FeaturePoolSetter{ + Condition: omit.From(row.Condition), + FeatureID: omit.From(feature.ID), + }).One(ctx, txn) + if err != nil { + return fmt.Errorf("insert feature_pool: %w", err) + } } - signal, err := models.Signals.Insert(&models.SignalSetter{ - Addressed: omitnull.FromPtr[time.Time](nil), - Addressor: omitnull.FromPtr[int32](nil), + review_task, err := models.ReviewTasks.Insert(&models.ReviewTaskSetter{ Created: omit.From(time.Now()), - Creator: omit.From(file.Committer.MustGet()), + CreatorID: omitnull.From(file.Committer.MustGet()), //ID: row.Address, OrganizationID: omit.From(org.ID), - Species: omitnull.From(enums.MosquitospeciesNone), - Title: omit.From("Green pool import"), - Type: omit.From(enums.SignaltypeFlyoverPool), + Reviewed: omitnull.FromPtr[time.Time](nil), + ReviewerID: omitnull.FromPtr[int32](nil), }).One(ctx, txn) if err != nil { - return fmt.Errorf("insert signal: %w", err) + return fmt.Errorf("insert review task: %w", err) } - _, err = bob.Exec(ctx, txn, psql.Insert( - im.Into("signal_pool", "pool_id", "signal_id"), - im.Values( - psql.Arg(pool.ID), - psql.Arg(signal.ID), - ), - )) + _, err = models.ReviewTaskPools.Insert(&models.ReviewTaskPoolSetter{ + FeaturePool: omit.From(feature.ID), + Location: omitnull.FromPtr[string](nil), + Geometry: omitnull.FromPtr[string](nil), + ReviewTaskID: omit.From(review_task.ID), + }).One(ctx, txn) + if err != nil { - return fmt.Errorf("insert signal pool: %w", err) + return fmt.Errorf("insert review task pool: %w", err) } /* Not sure why SignalPools doesn't have an Insert method