nidus-sync/db/models/bob_loaders.bob.go
Eli Ribble e932c2c473
Rework publicreport addressing
This adds the ability to link a proper address in the database to the
report and harmonizes the field names with the address table. It also
migrates away from mapbox entirely.

And I fixed the "pool" naming for the publicreports, which are supposed
to be the more generic 'water'.
2026-03-09 18:02:22 +00:00

407 lines
25 KiB
Go

// 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"
"database/sql"
"errors"
"fmt"
"github.com/Gleipnir-Technology/bob"
"github.com/Gleipnir-Technology/bob/dialect/psql/dialect"
"github.com/Gleipnir-Technology/bob/orm"
)
var Preload = getPreloaders()
type preloaders struct {
Address addressPreloader
ArcgisAccount arcgisAccountPreloader
ArcgisAddressMapping arcgisAddressMappingPreloader
ArcgisLayer arcgisLayerPreloader
ArcgisLayerField arcgisLayerFieldPreloader
ArcgisOauthToken arcgisOauthTokenPreloader
ArcgisParcelMapping arcgisParcelMappingPreloader
ArcgisServiceFeature arcgisServiceFeaturePreloader
ArcgisServiceMap arcgisServiceMapPreloader
ArcgisUser arcgisuserPreloader
ArcgisUserPrivilege arcgisUserPrivilegePreloader
CommsEmailContact commsEmailContactPreloader
CommsEmailLog commsEmailLogPreloader
CommsEmailTemplate commsEmailTemplatePreloader
CommsMailer commsMailerPreloader
CommsPhone commsPhonePreloader
CommsTextJob commsTextJobPreloader
CommsTextLog commsTextLogPreloader
ComplianceReportRequest complianceReportRequestPreloader
ComplianceReportRequestMailer complianceReportRequestMailerPreloader
DistrictSubscriptionEmail districtSubscriptionEmailPreloader
DistrictSubscriptionPhone districtSubscriptionPhonePreloader
Feature featurePreloader
FeaturePool featurePoolPreloader
FieldseekerContainerrelate fieldseekerContainerrelatePreloader
FieldseekerFieldscoutinglog fieldseekerFieldscoutinglogPreloader
FieldseekerHabitatrelate fieldseekerHabitatrelatePreloader
FieldseekerInspectionsample fieldseekerInspectionsamplePreloader
FieldseekerInspectionsampledetail fieldseekerInspectionsampledetailPreloader
FieldseekerLinelocation fieldseekerLinelocationPreloader
FieldseekerLocationtracking fieldseekerLocationtrackingPreloader
FieldseekerMosquitoinspection fieldseekerMosquitoinspectionPreloader
FieldseekerPointlocation fieldseekerPointlocationPreloader
FieldseekerPolygonlocation fieldseekerPolygonlocationPreloader
FieldseekerPool fieldseekerPoolPreloader
FieldseekerPooldetail fieldseekerPooldetailPreloader
FieldseekerProposedtreatmentarea fieldseekerProposedtreatmentareaPreloader
FieldseekerQamosquitoinspection fieldseekerQamosquitoinspectionPreloader
FieldseekerRodentlocation fieldseekerRodentlocationPreloader
FieldseekerSamplecollection fieldseekerSamplecollectionPreloader
FieldseekerSamplelocation fieldseekerSamplelocationPreloader
FieldseekerServicerequest fieldseekerServicerequestPreloader
FieldseekerSpeciesabundance fieldseekerSpeciesabundancePreloader
FieldseekerStormdrain fieldseekerStormdrainPreloader
FieldseekerTimecard fieldseekerTimecardPreloader
FieldseekerTrapdatum fieldseekerTrapdatumPreloader
FieldseekerTraplocation fieldseekerTraplocationPreloader
FieldseekerTreatment fieldseekerTreatmentPreloader
FieldseekerTreatmentarea fieldseekerTreatmentareaPreloader
FieldseekerZone fieldseekerZonePreloader
FieldseekerZones2 fieldseekerZones2Preloader
FieldseekerSync fieldseekerSyncPreloader
FileuploadCSV fileuploadCSVPreloader
FileuploadErrorCSV fileuploadErrorCSVPreloader
FileuploadErrorFile fileuploadErrorFilePreloader
FileuploadFile fileuploadFilePreloader
FileuploadPool fileuploadPoolPreloader
H3Aggregation h3AggregationPreloader
Lead leadPreloader
NoteAudio noteAudioPreloader
NoteAudioBreadcrumb noteAudioBreadcrumbPreloader
NoteAudioDatum noteAudioDatumPreloader
NoteImage noteImagePreloader
NoteImageBreadcrumb noteImageBreadcrumbPreloader
NoteImageDatum noteImageDatumPreloader
Notification notificationPreloader
Organization organizationPreloader
Parcel parcelPreloader
PublicreportImage publicreportImagePreloader
PublicreportImageExif publicreportImageExifPreloader
PublicreportNotifyEmailNuisance publicreportNotifyEmailNuisancePreloader
PublicreportNotifyEmailWater publicreportNotifyEmailWaterPreloader
PublicreportNotifyPhoneNuisance publicreportNotifyPhoneNuisancePreloader
PublicreportNotifyPhoneWater publicreportNotifyPhoneWaterPreloader
PublicreportNuisance publicreportNuisancePreloader
PublicreportNuisanceImage publicreportNuisanceImagePreloader
PublicreportSubscribeEmail publicreportSubscribeEmailPreloader
PublicreportSubscribePhone publicreportSubscribePhonePreloader
PublicreportWater publicreportWaterPreloader
PublicreportWaterImage publicreportWaterImagePreloader
Resident residentPreloader
ReviewTask reviewTaskPreloader
ReviewTaskPool reviewTaskPoolPreloader
Signal signalPreloader
Site sitePreloader
TileCachedImage tileCachedImagePreloader
User userPreloader
}
func getPreloaders() preloaders {
return preloaders{
Address: buildAddressPreloader(),
ArcgisAccount: buildArcgisAccountPreloader(),
ArcgisAddressMapping: buildArcgisAddressMappingPreloader(),
ArcgisLayer: buildArcgisLayerPreloader(),
ArcgisLayerField: buildArcgisLayerFieldPreloader(),
ArcgisOauthToken: buildArcgisOauthTokenPreloader(),
ArcgisParcelMapping: buildArcgisParcelMappingPreloader(),
ArcgisServiceFeature: buildArcgisServiceFeaturePreloader(),
ArcgisServiceMap: buildArcgisServiceMapPreloader(),
ArcgisUser: buildArcgisUserPreloader(),
ArcgisUserPrivilege: buildArcgisUserPrivilegePreloader(),
CommsEmailContact: buildCommsEmailContactPreloader(),
CommsEmailLog: buildCommsEmailLogPreloader(),
CommsEmailTemplate: buildCommsEmailTemplatePreloader(),
CommsMailer: buildCommsMailerPreloader(),
CommsPhone: buildCommsPhonePreloader(),
CommsTextJob: buildCommsTextJobPreloader(),
CommsTextLog: buildCommsTextLogPreloader(),
ComplianceReportRequest: buildComplianceReportRequestPreloader(),
ComplianceReportRequestMailer: buildComplianceReportRequestMailerPreloader(),
DistrictSubscriptionEmail: buildDistrictSubscriptionEmailPreloader(),
DistrictSubscriptionPhone: buildDistrictSubscriptionPhonePreloader(),
Feature: buildFeaturePreloader(),
FeaturePool: buildFeaturePoolPreloader(),
FieldseekerContainerrelate: buildFieldseekerContainerrelatePreloader(),
FieldseekerFieldscoutinglog: buildFieldseekerFieldscoutinglogPreloader(),
FieldseekerHabitatrelate: buildFieldseekerHabitatrelatePreloader(),
FieldseekerInspectionsample: buildFieldseekerInspectionsamplePreloader(),
FieldseekerInspectionsampledetail: buildFieldseekerInspectionsampledetailPreloader(),
FieldseekerLinelocation: buildFieldseekerLinelocationPreloader(),
FieldseekerLocationtracking: buildFieldseekerLocationtrackingPreloader(),
FieldseekerMosquitoinspection: buildFieldseekerMosquitoinspectionPreloader(),
FieldseekerPointlocation: buildFieldseekerPointlocationPreloader(),
FieldseekerPolygonlocation: buildFieldseekerPolygonlocationPreloader(),
FieldseekerPool: buildFieldseekerPoolPreloader(),
FieldseekerPooldetail: buildFieldseekerPooldetailPreloader(),
FieldseekerProposedtreatmentarea: buildFieldseekerProposedtreatmentareaPreloader(),
FieldseekerQamosquitoinspection: buildFieldseekerQamosquitoinspectionPreloader(),
FieldseekerRodentlocation: buildFieldseekerRodentlocationPreloader(),
FieldseekerSamplecollection: buildFieldseekerSamplecollectionPreloader(),
FieldseekerSamplelocation: buildFieldseekerSamplelocationPreloader(),
FieldseekerServicerequest: buildFieldseekerServicerequestPreloader(),
FieldseekerSpeciesabundance: buildFieldseekerSpeciesabundancePreloader(),
FieldseekerStormdrain: buildFieldseekerStormdrainPreloader(),
FieldseekerTimecard: buildFieldseekerTimecardPreloader(),
FieldseekerTrapdatum: buildFieldseekerTrapdatumPreloader(),
FieldseekerTraplocation: buildFieldseekerTraplocationPreloader(),
FieldseekerTreatment: buildFieldseekerTreatmentPreloader(),
FieldseekerTreatmentarea: buildFieldseekerTreatmentareaPreloader(),
FieldseekerZone: buildFieldseekerZonePreloader(),
FieldseekerZones2: buildFieldseekerZones2Preloader(),
FieldseekerSync: buildFieldseekerSyncPreloader(),
FileuploadCSV: buildFileuploadCSVPreloader(),
FileuploadErrorCSV: buildFileuploadErrorCSVPreloader(),
FileuploadErrorFile: buildFileuploadErrorFilePreloader(),
FileuploadFile: buildFileuploadFilePreloader(),
FileuploadPool: buildFileuploadPoolPreloader(),
H3Aggregation: buildH3AggregationPreloader(),
Lead: buildLeadPreloader(),
NoteAudio: buildNoteAudioPreloader(),
NoteAudioBreadcrumb: buildNoteAudioBreadcrumbPreloader(),
NoteAudioDatum: buildNoteAudioDatumPreloader(),
NoteImage: buildNoteImagePreloader(),
NoteImageBreadcrumb: buildNoteImageBreadcrumbPreloader(),
NoteImageDatum: buildNoteImageDatumPreloader(),
Notification: buildNotificationPreloader(),
Organization: buildOrganizationPreloader(),
Parcel: buildParcelPreloader(),
PublicreportImage: buildPublicreportImagePreloader(),
PublicreportImageExif: buildPublicreportImageExifPreloader(),
PublicreportNotifyEmailNuisance: buildPublicreportNotifyEmailNuisancePreloader(),
PublicreportNotifyEmailWater: buildPublicreportNotifyEmailWaterPreloader(),
PublicreportNotifyPhoneNuisance: buildPublicreportNotifyPhoneNuisancePreloader(),
PublicreportNotifyPhoneWater: buildPublicreportNotifyPhoneWaterPreloader(),
PublicreportNuisance: buildPublicreportNuisancePreloader(),
PublicreportNuisanceImage: buildPublicreportNuisanceImagePreloader(),
PublicreportSubscribeEmail: buildPublicreportSubscribeEmailPreloader(),
PublicreportSubscribePhone: buildPublicreportSubscribePhonePreloader(),
PublicreportWater: buildPublicreportWaterPreloader(),
PublicreportWaterImage: buildPublicreportWaterImagePreloader(),
Resident: buildResidentPreloader(),
ReviewTask: buildReviewTaskPreloader(),
ReviewTaskPool: buildReviewTaskPoolPreloader(),
Signal: buildSignalPreloader(),
Site: buildSitePreloader(),
TileCachedImage: buildTileCachedImagePreloader(),
User: buildUserPreloader(),
}
}
var (
SelectThenLoad = getThenLoaders[*dialect.SelectQuery]()
InsertThenLoad = getThenLoaders[*dialect.InsertQuery]()
UpdateThenLoad = getThenLoaders[*dialect.UpdateQuery]()
)
type thenLoaders[Q orm.Loadable] struct {
Address addressThenLoader[Q]
ArcgisAccount arcgisAccountThenLoader[Q]
ArcgisAddressMapping arcgisAddressMappingThenLoader[Q]
ArcgisLayer arcgisLayerThenLoader[Q]
ArcgisLayerField arcgisLayerFieldThenLoader[Q]
ArcgisOauthToken arcgisOauthTokenThenLoader[Q]
ArcgisParcelMapping arcgisParcelMappingThenLoader[Q]
ArcgisServiceFeature arcgisServiceFeatureThenLoader[Q]
ArcgisServiceMap arcgisServiceMapThenLoader[Q]
ArcgisUser arcgisuserThenLoader[Q]
ArcgisUserPrivilege arcgisUserPrivilegeThenLoader[Q]
CommsEmailContact commsEmailContactThenLoader[Q]
CommsEmailLog commsEmailLogThenLoader[Q]
CommsEmailTemplate commsEmailTemplateThenLoader[Q]
CommsMailer commsMailerThenLoader[Q]
CommsPhone commsPhoneThenLoader[Q]
CommsTextJob commsTextJobThenLoader[Q]
CommsTextLog commsTextLogThenLoader[Q]
ComplianceReportRequest complianceReportRequestThenLoader[Q]
ComplianceReportRequestMailer complianceReportRequestMailerThenLoader[Q]
DistrictSubscriptionEmail districtSubscriptionEmailThenLoader[Q]
DistrictSubscriptionPhone districtSubscriptionPhoneThenLoader[Q]
Feature featureThenLoader[Q]
FeaturePool featurePoolThenLoader[Q]
FieldseekerContainerrelate fieldseekerContainerrelateThenLoader[Q]
FieldseekerFieldscoutinglog fieldseekerFieldscoutinglogThenLoader[Q]
FieldseekerHabitatrelate fieldseekerHabitatrelateThenLoader[Q]
FieldseekerInspectionsample fieldseekerInspectionsampleThenLoader[Q]
FieldseekerInspectionsampledetail fieldseekerInspectionsampledetailThenLoader[Q]
FieldseekerLinelocation fieldseekerLinelocationThenLoader[Q]
FieldseekerLocationtracking fieldseekerLocationtrackingThenLoader[Q]
FieldseekerMosquitoinspection fieldseekerMosquitoinspectionThenLoader[Q]
FieldseekerPointlocation fieldseekerPointlocationThenLoader[Q]
FieldseekerPolygonlocation fieldseekerPolygonlocationThenLoader[Q]
FieldseekerPool fieldseekerPoolThenLoader[Q]
FieldseekerPooldetail fieldseekerPooldetailThenLoader[Q]
FieldseekerProposedtreatmentarea fieldseekerProposedtreatmentareaThenLoader[Q]
FieldseekerQamosquitoinspection fieldseekerQamosquitoinspectionThenLoader[Q]
FieldseekerRodentlocation fieldseekerRodentlocationThenLoader[Q]
FieldseekerSamplecollection fieldseekerSamplecollectionThenLoader[Q]
FieldseekerSamplelocation fieldseekerSamplelocationThenLoader[Q]
FieldseekerServicerequest fieldseekerServicerequestThenLoader[Q]
FieldseekerSpeciesabundance fieldseekerSpeciesabundanceThenLoader[Q]
FieldseekerStormdrain fieldseekerStormdrainThenLoader[Q]
FieldseekerTimecard fieldseekerTimecardThenLoader[Q]
FieldseekerTrapdatum fieldseekerTrapdatumThenLoader[Q]
FieldseekerTraplocation fieldseekerTraplocationThenLoader[Q]
FieldseekerTreatment fieldseekerTreatmentThenLoader[Q]
FieldseekerTreatmentarea fieldseekerTreatmentareaThenLoader[Q]
FieldseekerZone fieldseekerZoneThenLoader[Q]
FieldseekerZones2 fieldseekerZones2ThenLoader[Q]
FieldseekerSync fieldseekerSyncThenLoader[Q]
FileuploadCSV fileuploadCSVThenLoader[Q]
FileuploadErrorCSV fileuploadErrorCSVThenLoader[Q]
FileuploadErrorFile fileuploadErrorFileThenLoader[Q]
FileuploadFile fileuploadFileThenLoader[Q]
FileuploadPool fileuploadPoolThenLoader[Q]
H3Aggregation h3AggregationThenLoader[Q]
Lead leadThenLoader[Q]
NoteAudio noteAudioThenLoader[Q]
NoteAudioBreadcrumb noteAudioBreadcrumbThenLoader[Q]
NoteAudioDatum noteAudioDatumThenLoader[Q]
NoteImage noteImageThenLoader[Q]
NoteImageBreadcrumb noteImageBreadcrumbThenLoader[Q]
NoteImageDatum noteImageDatumThenLoader[Q]
Notification notificationThenLoader[Q]
Organization organizationThenLoader[Q]
Parcel parcelThenLoader[Q]
PublicreportImage publicreportImageThenLoader[Q]
PublicreportImageExif publicreportImageExifThenLoader[Q]
PublicreportNotifyEmailNuisance publicreportNotifyEmailNuisanceThenLoader[Q]
PublicreportNotifyEmailWater publicreportNotifyEmailWaterThenLoader[Q]
PublicreportNotifyPhoneNuisance publicreportNotifyPhoneNuisanceThenLoader[Q]
PublicreportNotifyPhoneWater publicreportNotifyPhoneWaterThenLoader[Q]
PublicreportNuisance publicreportNuisanceThenLoader[Q]
PublicreportNuisanceImage publicreportNuisanceImageThenLoader[Q]
PublicreportSubscribeEmail publicreportSubscribeEmailThenLoader[Q]
PublicreportSubscribePhone publicreportSubscribePhoneThenLoader[Q]
PublicreportWater publicreportWaterThenLoader[Q]
PublicreportWaterImage publicreportWaterImageThenLoader[Q]
Resident residentThenLoader[Q]
ReviewTask reviewTaskThenLoader[Q]
ReviewTaskPool reviewTaskPoolThenLoader[Q]
Signal signalThenLoader[Q]
Site siteThenLoader[Q]
TileCachedImage tileCachedImageThenLoader[Q]
User userThenLoader[Q]
}
func getThenLoaders[Q orm.Loadable]() thenLoaders[Q] {
return thenLoaders[Q]{
Address: buildAddressThenLoader[Q](),
ArcgisAccount: buildArcgisAccountThenLoader[Q](),
ArcgisAddressMapping: buildArcgisAddressMappingThenLoader[Q](),
ArcgisLayer: buildArcgisLayerThenLoader[Q](),
ArcgisLayerField: buildArcgisLayerFieldThenLoader[Q](),
ArcgisOauthToken: buildArcgisOauthTokenThenLoader[Q](),
ArcgisParcelMapping: buildArcgisParcelMappingThenLoader[Q](),
ArcgisServiceFeature: buildArcgisServiceFeatureThenLoader[Q](),
ArcgisServiceMap: buildArcgisServiceMapThenLoader[Q](),
ArcgisUser: buildArcgisUserThenLoader[Q](),
ArcgisUserPrivilege: buildArcgisUserPrivilegeThenLoader[Q](),
CommsEmailContact: buildCommsEmailContactThenLoader[Q](),
CommsEmailLog: buildCommsEmailLogThenLoader[Q](),
CommsEmailTemplate: buildCommsEmailTemplateThenLoader[Q](),
CommsMailer: buildCommsMailerThenLoader[Q](),
CommsPhone: buildCommsPhoneThenLoader[Q](),
CommsTextJob: buildCommsTextJobThenLoader[Q](),
CommsTextLog: buildCommsTextLogThenLoader[Q](),
ComplianceReportRequest: buildComplianceReportRequestThenLoader[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](),
FieldseekerInspectionsample: buildFieldseekerInspectionsampleThenLoader[Q](),
FieldseekerInspectionsampledetail: buildFieldseekerInspectionsampledetailThenLoader[Q](),
FieldseekerLinelocation: buildFieldseekerLinelocationThenLoader[Q](),
FieldseekerLocationtracking: buildFieldseekerLocationtrackingThenLoader[Q](),
FieldseekerMosquitoinspection: buildFieldseekerMosquitoinspectionThenLoader[Q](),
FieldseekerPointlocation: buildFieldseekerPointlocationThenLoader[Q](),
FieldseekerPolygonlocation: buildFieldseekerPolygonlocationThenLoader[Q](),
FieldseekerPool: buildFieldseekerPoolThenLoader[Q](),
FieldseekerPooldetail: buildFieldseekerPooldetailThenLoader[Q](),
FieldseekerProposedtreatmentarea: buildFieldseekerProposedtreatmentareaThenLoader[Q](),
FieldseekerQamosquitoinspection: buildFieldseekerQamosquitoinspectionThenLoader[Q](),
FieldseekerRodentlocation: buildFieldseekerRodentlocationThenLoader[Q](),
FieldseekerSamplecollection: buildFieldseekerSamplecollectionThenLoader[Q](),
FieldseekerSamplelocation: buildFieldseekerSamplelocationThenLoader[Q](),
FieldseekerServicerequest: buildFieldseekerServicerequestThenLoader[Q](),
FieldseekerSpeciesabundance: buildFieldseekerSpeciesabundanceThenLoader[Q](),
FieldseekerStormdrain: buildFieldseekerStormdrainThenLoader[Q](),
FieldseekerTimecard: buildFieldseekerTimecardThenLoader[Q](),
FieldseekerTrapdatum: buildFieldseekerTrapdatumThenLoader[Q](),
FieldseekerTraplocation: buildFieldseekerTraplocationThenLoader[Q](),
FieldseekerTreatment: buildFieldseekerTreatmentThenLoader[Q](),
FieldseekerTreatmentarea: buildFieldseekerTreatmentareaThenLoader[Q](),
FieldseekerZone: buildFieldseekerZoneThenLoader[Q](),
FieldseekerZones2: buildFieldseekerZones2ThenLoader[Q](),
FieldseekerSync: buildFieldseekerSyncThenLoader[Q](),
FileuploadCSV: buildFileuploadCSVThenLoader[Q](),
FileuploadErrorCSV: buildFileuploadErrorCSVThenLoader[Q](),
FileuploadErrorFile: buildFileuploadErrorFileThenLoader[Q](),
FileuploadFile: buildFileuploadFileThenLoader[Q](),
FileuploadPool: buildFileuploadPoolThenLoader[Q](),
H3Aggregation: buildH3AggregationThenLoader[Q](),
Lead: buildLeadThenLoader[Q](),
NoteAudio: buildNoteAudioThenLoader[Q](),
NoteAudioBreadcrumb: buildNoteAudioBreadcrumbThenLoader[Q](),
NoteAudioDatum: buildNoteAudioDatumThenLoader[Q](),
NoteImage: buildNoteImageThenLoader[Q](),
NoteImageBreadcrumb: buildNoteImageBreadcrumbThenLoader[Q](),
NoteImageDatum: buildNoteImageDatumThenLoader[Q](),
Notification: buildNotificationThenLoader[Q](),
Organization: buildOrganizationThenLoader[Q](),
Parcel: buildParcelThenLoader[Q](),
PublicreportImage: buildPublicreportImageThenLoader[Q](),
PublicreportImageExif: buildPublicreportImageExifThenLoader[Q](),
PublicreportNotifyEmailNuisance: buildPublicreportNotifyEmailNuisanceThenLoader[Q](),
PublicreportNotifyEmailWater: buildPublicreportNotifyEmailWaterThenLoader[Q](),
PublicreportNotifyPhoneNuisance: buildPublicreportNotifyPhoneNuisanceThenLoader[Q](),
PublicreportNotifyPhoneWater: buildPublicreportNotifyPhoneWaterThenLoader[Q](),
PublicreportNuisance: buildPublicreportNuisanceThenLoader[Q](),
PublicreportNuisanceImage: buildPublicreportNuisanceImageThenLoader[Q](),
PublicreportSubscribeEmail: buildPublicreportSubscribeEmailThenLoader[Q](),
PublicreportSubscribePhone: buildPublicreportSubscribePhoneThenLoader[Q](),
PublicreportWater: buildPublicreportWaterThenLoader[Q](),
PublicreportWaterImage: buildPublicreportWaterImageThenLoader[Q](),
Resident: buildResidentThenLoader[Q](),
ReviewTask: buildReviewTaskThenLoader[Q](),
ReviewTaskPool: buildReviewTaskPoolThenLoader[Q](),
Signal: buildSignalThenLoader[Q](),
Site: buildSiteThenLoader[Q](),
TileCachedImage: buildTileCachedImageThenLoader[Q](),
User: buildUserThenLoader[Q](),
}
}
func thenLoadBuilder[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 fmt.Errorf("object %T cannot load %q", retrieved, name)
}
err := f(ctx, exec, loader, queryMods...)
// Don't cause an issue due to missing relationships
if errors.Is(err, sql.ErrNoRows) {
return nil
}
return err
}
}
}