// Code generated by BobGen psql v0.41.1. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" "database/sql" "errors" "fmt" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/psql/dialect" "github.com/stephenafamo/bob/orm" ) var Preload = getPreloaders() type preloaders struct { FieldseekerSync fieldseekerSyncPreloader FSContainerrelate fsContainerrelatePreloader FSFieldscoutinglog fsFieldscoutinglogPreloader FSHabitatrelate fsHabitatrelatePreloader FSInspectionsample fsInspectionsamplePreloader FSInspectionsampledetail fsInspectionsampledetailPreloader FSLinelocation fsLinelocationPreloader FSLocationtracking fsLocationtrackingPreloader FSMosquitoinspection fsMosquitoinspectionPreloader FSPointlocation fsPointlocationPreloader FSPolygonlocation fsPolygonlocationPreloader FSPool fsPoolPreloader FSPooldetail fsPooldetailPreloader FSProposedtreatmentarea fsProposedtreatmentareaPreloader FSQamosquitoinspection fsQamosquitoinspectionPreloader FSRodentlocation fsRodentlocationPreloader FSSamplecollection fsSamplecollectionPreloader FSSamplelocation fsSamplelocationPreloader FSServicerequest fsServicerequestPreloader FSSpeciesabundance fsSpeciesabundancePreloader FSStormdrain fsStormdrainPreloader FSTimecard fsTimecardPreloader FSTrapdatum fsTrapdatumPreloader FSTraplocation fsTraplocationPreloader FSTreatment fsTreatmentPreloader FSTreatmentarea fsTreatmentareaPreloader FSZone fsZonePreloader FSZones2 fsZones2Preloader H3Aggregation h3AggregationPreloader HistoryContainerrelate historyContainerrelatePreloader HistoryFieldscoutinglog historyFieldscoutinglogPreloader HistoryHabitatrelate historyHabitatrelatePreloader HistoryInspectionsample historyInspectionsamplePreloader HistoryInspectionsampledetail historyInspectionsampledetailPreloader HistoryLinelocation historyLinelocationPreloader HistoryLocationtracking historyLocationtrackingPreloader HistoryMosquitoinspection historyMosquitoinspectionPreloader HistoryPointlocation historyPointlocationPreloader HistoryPolygonlocation historyPolygonlocationPreloader HistoryPool historyPoolPreloader HistoryPooldetail historyPooldetailPreloader HistoryProposedtreatmentarea historyProposedtreatmentareaPreloader HistoryQamosquitoinspection historyQamosquitoinspectionPreloader HistoryRodentlocation historyRodentlocationPreloader HistorySamplecollection historySamplecollectionPreloader HistorySamplelocation historySamplelocationPreloader HistoryServicerequest historyServicerequestPreloader HistorySpeciesabundance historySpeciesabundancePreloader HistoryStormdrain historyStormdrainPreloader HistoryTimecard historyTimecardPreloader HistoryTrapdatum historyTrapdatumPreloader HistoryTraplocation historyTraplocationPreloader HistoryTreatment historyTreatmentPreloader HistoryTreatmentarea historyTreatmentareaPreloader HistoryZone historyZonePreloader HistoryZones2 historyZones2Preloader Notification notificationPreloader OauthToken oauthTokenPreloader Organization organizationPreloader User userPreloader } func getPreloaders() preloaders { return preloaders{ FieldseekerSync: buildFieldseekerSyncPreloader(), FSContainerrelate: buildFSContainerrelatePreloader(), FSFieldscoutinglog: buildFSFieldscoutinglogPreloader(), FSHabitatrelate: buildFSHabitatrelatePreloader(), FSInspectionsample: buildFSInspectionsamplePreloader(), FSInspectionsampledetail: buildFSInspectionsampledetailPreloader(), FSLinelocation: buildFSLinelocationPreloader(), FSLocationtracking: buildFSLocationtrackingPreloader(), FSMosquitoinspection: buildFSMosquitoinspectionPreloader(), FSPointlocation: buildFSPointlocationPreloader(), FSPolygonlocation: buildFSPolygonlocationPreloader(), FSPool: buildFSPoolPreloader(), FSPooldetail: buildFSPooldetailPreloader(), FSProposedtreatmentarea: buildFSProposedtreatmentareaPreloader(), FSQamosquitoinspection: buildFSQamosquitoinspectionPreloader(), FSRodentlocation: buildFSRodentlocationPreloader(), FSSamplecollection: buildFSSamplecollectionPreloader(), FSSamplelocation: buildFSSamplelocationPreloader(), FSServicerequest: buildFSServicerequestPreloader(), FSSpeciesabundance: buildFSSpeciesabundancePreloader(), FSStormdrain: buildFSStormdrainPreloader(), FSTimecard: buildFSTimecardPreloader(), FSTrapdatum: buildFSTrapdatumPreloader(), FSTraplocation: buildFSTraplocationPreloader(), FSTreatment: buildFSTreatmentPreloader(), FSTreatmentarea: buildFSTreatmentareaPreloader(), FSZone: buildFSZonePreloader(), FSZones2: buildFSZones2Preloader(), H3Aggregation: buildH3AggregationPreloader(), HistoryContainerrelate: buildHistoryContainerrelatePreloader(), HistoryFieldscoutinglog: buildHistoryFieldscoutinglogPreloader(), HistoryHabitatrelate: buildHistoryHabitatrelatePreloader(), HistoryInspectionsample: buildHistoryInspectionsamplePreloader(), HistoryInspectionsampledetail: buildHistoryInspectionsampledetailPreloader(), HistoryLinelocation: buildHistoryLinelocationPreloader(), HistoryLocationtracking: buildHistoryLocationtrackingPreloader(), HistoryMosquitoinspection: buildHistoryMosquitoinspectionPreloader(), HistoryPointlocation: buildHistoryPointlocationPreloader(), HistoryPolygonlocation: buildHistoryPolygonlocationPreloader(), HistoryPool: buildHistoryPoolPreloader(), HistoryPooldetail: buildHistoryPooldetailPreloader(), HistoryProposedtreatmentarea: buildHistoryProposedtreatmentareaPreloader(), HistoryQamosquitoinspection: buildHistoryQamosquitoinspectionPreloader(), HistoryRodentlocation: buildHistoryRodentlocationPreloader(), HistorySamplecollection: buildHistorySamplecollectionPreloader(), HistorySamplelocation: buildHistorySamplelocationPreloader(), HistoryServicerequest: buildHistoryServicerequestPreloader(), HistorySpeciesabundance: buildHistorySpeciesabundancePreloader(), HistoryStormdrain: buildHistoryStormdrainPreloader(), HistoryTimecard: buildHistoryTimecardPreloader(), HistoryTrapdatum: buildHistoryTrapdatumPreloader(), HistoryTraplocation: buildHistoryTraplocationPreloader(), HistoryTreatment: buildHistoryTreatmentPreloader(), HistoryTreatmentarea: buildHistoryTreatmentareaPreloader(), HistoryZone: buildHistoryZonePreloader(), HistoryZones2: buildHistoryZones2Preloader(), Notification: buildNotificationPreloader(), OauthToken: buildOauthTokenPreloader(), Organization: buildOrganizationPreloader(), User: buildUserPreloader(), } } var ( SelectThenLoad = getThenLoaders[*dialect.SelectQuery]() InsertThenLoad = getThenLoaders[*dialect.InsertQuery]() UpdateThenLoad = getThenLoaders[*dialect.UpdateQuery]() ) type thenLoaders[Q orm.Loadable] struct { FieldseekerSync fieldseekerSyncThenLoader[Q] FSContainerrelate fsContainerrelateThenLoader[Q] FSFieldscoutinglog fsFieldscoutinglogThenLoader[Q] FSHabitatrelate fsHabitatrelateThenLoader[Q] FSInspectionsample fsInspectionsampleThenLoader[Q] FSInspectionsampledetail fsInspectionsampledetailThenLoader[Q] FSLinelocation fsLinelocationThenLoader[Q] FSLocationtracking fsLocationtrackingThenLoader[Q] FSMosquitoinspection fsMosquitoinspectionThenLoader[Q] FSPointlocation fsPointlocationThenLoader[Q] FSPolygonlocation fsPolygonlocationThenLoader[Q] FSPool fsPoolThenLoader[Q] FSPooldetail fsPooldetailThenLoader[Q] FSProposedtreatmentarea fsProposedtreatmentareaThenLoader[Q] FSQamosquitoinspection fsQamosquitoinspectionThenLoader[Q] FSRodentlocation fsRodentlocationThenLoader[Q] FSSamplecollection fsSamplecollectionThenLoader[Q] FSSamplelocation fsSamplelocationThenLoader[Q] FSServicerequest fsServicerequestThenLoader[Q] FSSpeciesabundance fsSpeciesabundanceThenLoader[Q] FSStormdrain fsStormdrainThenLoader[Q] FSTimecard fsTimecardThenLoader[Q] FSTrapdatum fsTrapdatumThenLoader[Q] FSTraplocation fsTraplocationThenLoader[Q] FSTreatment fsTreatmentThenLoader[Q] FSTreatmentarea fsTreatmentareaThenLoader[Q] FSZone fsZoneThenLoader[Q] FSZones2 fsZones2ThenLoader[Q] H3Aggregation h3AggregationThenLoader[Q] HistoryContainerrelate historyContainerrelateThenLoader[Q] HistoryFieldscoutinglog historyFieldscoutinglogThenLoader[Q] HistoryHabitatrelate historyHabitatrelateThenLoader[Q] HistoryInspectionsample historyInspectionsampleThenLoader[Q] HistoryInspectionsampledetail historyInspectionsampledetailThenLoader[Q] HistoryLinelocation historyLinelocationThenLoader[Q] HistoryLocationtracking historyLocationtrackingThenLoader[Q] HistoryMosquitoinspection historyMosquitoinspectionThenLoader[Q] HistoryPointlocation historyPointlocationThenLoader[Q] HistoryPolygonlocation historyPolygonlocationThenLoader[Q] HistoryPool historyPoolThenLoader[Q] HistoryPooldetail historyPooldetailThenLoader[Q] HistoryProposedtreatmentarea historyProposedtreatmentareaThenLoader[Q] HistoryQamosquitoinspection historyQamosquitoinspectionThenLoader[Q] HistoryRodentlocation historyRodentlocationThenLoader[Q] HistorySamplecollection historySamplecollectionThenLoader[Q] HistorySamplelocation historySamplelocationThenLoader[Q] HistoryServicerequest historyServicerequestThenLoader[Q] HistorySpeciesabundance historySpeciesabundanceThenLoader[Q] HistoryStormdrain historyStormdrainThenLoader[Q] HistoryTimecard historyTimecardThenLoader[Q] HistoryTrapdatum historyTrapdatumThenLoader[Q] HistoryTraplocation historyTraplocationThenLoader[Q] HistoryTreatment historyTreatmentThenLoader[Q] HistoryTreatmentarea historyTreatmentareaThenLoader[Q] HistoryZone historyZoneThenLoader[Q] HistoryZones2 historyZones2ThenLoader[Q] Notification notificationThenLoader[Q] OauthToken oauthTokenThenLoader[Q] Organization organizationThenLoader[Q] User userThenLoader[Q] } func getThenLoaders[Q orm.Loadable]() thenLoaders[Q] { return thenLoaders[Q]{ FieldseekerSync: buildFieldseekerSyncThenLoader[Q](), FSContainerrelate: buildFSContainerrelateThenLoader[Q](), FSFieldscoutinglog: buildFSFieldscoutinglogThenLoader[Q](), FSHabitatrelate: buildFSHabitatrelateThenLoader[Q](), FSInspectionsample: buildFSInspectionsampleThenLoader[Q](), FSInspectionsampledetail: buildFSInspectionsampledetailThenLoader[Q](), FSLinelocation: buildFSLinelocationThenLoader[Q](), FSLocationtracking: buildFSLocationtrackingThenLoader[Q](), FSMosquitoinspection: buildFSMosquitoinspectionThenLoader[Q](), FSPointlocation: buildFSPointlocationThenLoader[Q](), FSPolygonlocation: buildFSPolygonlocationThenLoader[Q](), FSPool: buildFSPoolThenLoader[Q](), FSPooldetail: buildFSPooldetailThenLoader[Q](), FSProposedtreatmentarea: buildFSProposedtreatmentareaThenLoader[Q](), FSQamosquitoinspection: buildFSQamosquitoinspectionThenLoader[Q](), FSRodentlocation: buildFSRodentlocationThenLoader[Q](), FSSamplecollection: buildFSSamplecollectionThenLoader[Q](), FSSamplelocation: buildFSSamplelocationThenLoader[Q](), FSServicerequest: buildFSServicerequestThenLoader[Q](), FSSpeciesabundance: buildFSSpeciesabundanceThenLoader[Q](), FSStormdrain: buildFSStormdrainThenLoader[Q](), FSTimecard: buildFSTimecardThenLoader[Q](), FSTrapdatum: buildFSTrapdatumThenLoader[Q](), FSTraplocation: buildFSTraplocationThenLoader[Q](), FSTreatment: buildFSTreatmentThenLoader[Q](), FSTreatmentarea: buildFSTreatmentareaThenLoader[Q](), FSZone: buildFSZoneThenLoader[Q](), FSZones2: buildFSZones2ThenLoader[Q](), H3Aggregation: buildH3AggregationThenLoader[Q](), HistoryContainerrelate: buildHistoryContainerrelateThenLoader[Q](), HistoryFieldscoutinglog: buildHistoryFieldscoutinglogThenLoader[Q](), HistoryHabitatrelate: buildHistoryHabitatrelateThenLoader[Q](), HistoryInspectionsample: buildHistoryInspectionsampleThenLoader[Q](), HistoryInspectionsampledetail: buildHistoryInspectionsampledetailThenLoader[Q](), HistoryLinelocation: buildHistoryLinelocationThenLoader[Q](), HistoryLocationtracking: buildHistoryLocationtrackingThenLoader[Q](), HistoryMosquitoinspection: buildHistoryMosquitoinspectionThenLoader[Q](), HistoryPointlocation: buildHistoryPointlocationThenLoader[Q](), HistoryPolygonlocation: buildHistoryPolygonlocationThenLoader[Q](), HistoryPool: buildHistoryPoolThenLoader[Q](), HistoryPooldetail: buildHistoryPooldetailThenLoader[Q](), HistoryProposedtreatmentarea: buildHistoryProposedtreatmentareaThenLoader[Q](), HistoryQamosquitoinspection: buildHistoryQamosquitoinspectionThenLoader[Q](), HistoryRodentlocation: buildHistoryRodentlocationThenLoader[Q](), HistorySamplecollection: buildHistorySamplecollectionThenLoader[Q](), HistorySamplelocation: buildHistorySamplelocationThenLoader[Q](), HistoryServicerequest: buildHistoryServicerequestThenLoader[Q](), HistorySpeciesabundance: buildHistorySpeciesabundanceThenLoader[Q](), HistoryStormdrain: buildHistoryStormdrainThenLoader[Q](), HistoryTimecard: buildHistoryTimecardThenLoader[Q](), HistoryTrapdatum: buildHistoryTrapdatumThenLoader[Q](), HistoryTraplocation: buildHistoryTraplocationThenLoader[Q](), HistoryTreatment: buildHistoryTreatmentThenLoader[Q](), HistoryTreatmentarea: buildHistoryTreatmentareaThenLoader[Q](), HistoryZone: buildHistoryZoneThenLoader[Q](), HistoryZones2: buildHistoryZones2ThenLoader[Q](), Notification: buildNotificationThenLoader[Q](), OauthToken: buildOauthTokenThenLoader[Q](), Organization: buildOrganizationThenLoader[Q](), User: buildUserThenLoader[Q](), } } 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 } } }