nidus-sync/db/models/bob_loaders.bob.go
Eli Ribble 1aefca2f5d Make GlobalID required for all Fieldseeker tables
I'm pretty sure it has to be there, and it allows me to clean up my
code.
2026-01-05 02:28:28 +00:00

215 lines
12 KiB
Go

// Code generated by BobGen psql v0.0.4-0.20260105020634-53e08d840e47+dirty. 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 {
FieldseekerContainerrelate fieldseekerContainerrelatePreloader
FieldseekerFieldscoutinglog fieldseekerFieldscoutinglogPreloader
FieldseekerHabitatrelate fieldseekerHabitatrelatePreloader
FieldseekerInspectionsample fieldseekerInspectionsamplePreloader
FieldseekerInspectionsampledetail fieldseekerInspectionsampledetailPreloader
FieldseekerLinelocation fieldseekerLinelocationPreloader
FieldseekerLocationtracking fieldseekerLocationtrackingPreloader
FieldseekerMosquitoinspection fieldseekerMosquitoinspectionPreloader
FieldseekerPointlocation fieldseekerPointlocationPreloader
FieldseekerPolygonlocation fieldseekerPolygonlocationPreloader
FieldseekerPool fieldseekerPoolPreloader
FieldseekerPooldetail fieldseekerPooldetailPreloader
FieldseekerProposedtreatmentarea fieldseekerProposedtreatmentareaPreloader
FieldseekerQamosquitoinspection fieldseekerQamosquitoinspectionPreloader
FieldseekerRodentlocation fieldseekerRodentlocationPreloader
FieldseekerSamplecollection fieldseekerSamplecollectionPreloader
FieldseekerSamplelocation fieldseekerSamplelocationPreloader
FieldseekerServicerequest fieldseekerServicerequestPreloader
FieldseekerSpeciesabundance fieldseekerSpeciesabundancePreloader
FieldseekerStormdrain fieldseekerStormdrainPreloader
FieldseekerTimecard fieldseekerTimecardPreloader
FieldseekerTrapdatum fieldseekerTrapdatumPreloader
FieldseekerTraplocation fieldseekerTraplocationPreloader
FieldseekerTreatment fieldseekerTreatmentPreloader
FieldseekerTreatmentarea fieldseekerTreatmentareaPreloader
FieldseekerZone fieldseekerZonePreloader
FieldseekerZones2 fieldseekerZones2Preloader
FieldseekerSync fieldseekerSyncPreloader
H3Aggregation h3AggregationPreloader
NoteAudio noteAudioPreloader
NoteAudioBreadcrumb noteAudioBreadcrumbPreloader
NoteAudioDatum noteAudioDatumPreloader
NoteImage noteImagePreloader
NoteImageBreadcrumb noteImageBreadcrumbPreloader
NoteImageDatum noteImageDatumPreloader
Notification notificationPreloader
OauthToken oauthTokenPreloader
Organization organizationPreloader
User userPreloader
}
func getPreloaders() preloaders {
return preloaders{
FieldseekerContainerrelate: buildFieldseekerContainerrelatePreloader(),
FieldseekerFieldscoutinglog: buildFieldseekerFieldscoutinglogPreloader(),
FieldseekerHabitatrelate: buildFieldseekerHabitatrelatePreloader(),
FieldseekerInspectionsample: buildFieldseekerInspectionsamplePreloader(),
FieldseekerInspectionsampledetail: buildFieldseekerInspectionsampledetailPreloader(),
FieldseekerLinelocation: buildFieldseekerLinelocationPreloader(),
FieldseekerLocationtracking: buildFieldseekerLocationtrackingPreloader(),
FieldseekerMosquitoinspection: buildFieldseekerMosquitoinspectionPreloader(),
FieldseekerPointlocation: buildFieldseekerPointlocationPreloader(),
FieldseekerPolygonlocation: buildFieldseekerPolygonlocationPreloader(),
FieldseekerPool: buildFieldseekerPoolPreloader(),
FieldseekerPooldetail: buildFieldseekerPooldetailPreloader(),
FieldseekerProposedtreatmentarea: buildFieldseekerProposedtreatmentareaPreloader(),
FieldseekerQamosquitoinspection: buildFieldseekerQamosquitoinspectionPreloader(),
FieldseekerRodentlocation: buildFieldseekerRodentlocationPreloader(),
FieldseekerSamplecollection: buildFieldseekerSamplecollectionPreloader(),
FieldseekerSamplelocation: buildFieldseekerSamplelocationPreloader(),
FieldseekerServicerequest: buildFieldseekerServicerequestPreloader(),
FieldseekerSpeciesabundance: buildFieldseekerSpeciesabundancePreloader(),
FieldseekerStormdrain: buildFieldseekerStormdrainPreloader(),
FieldseekerTimecard: buildFieldseekerTimecardPreloader(),
FieldseekerTrapdatum: buildFieldseekerTrapdatumPreloader(),
FieldseekerTraplocation: buildFieldseekerTraplocationPreloader(),
FieldseekerTreatment: buildFieldseekerTreatmentPreloader(),
FieldseekerTreatmentarea: buildFieldseekerTreatmentareaPreloader(),
FieldseekerZone: buildFieldseekerZonePreloader(),
FieldseekerZones2: buildFieldseekerZones2Preloader(),
FieldseekerSync: buildFieldseekerSyncPreloader(),
H3Aggregation: buildH3AggregationPreloader(),
NoteAudio: buildNoteAudioPreloader(),
NoteAudioBreadcrumb: buildNoteAudioBreadcrumbPreloader(),
NoteAudioDatum: buildNoteAudioDatumPreloader(),
NoteImage: buildNoteImagePreloader(),
NoteImageBreadcrumb: buildNoteImageBreadcrumbPreloader(),
NoteImageDatum: buildNoteImageDatumPreloader(),
Notification: buildNotificationPreloader(),
OauthToken: buildOauthTokenPreloader(),
Organization: buildOrganizationPreloader(),
User: buildUserPreloader(),
}
}
var (
SelectThenLoad = getThenLoaders[*dialect.SelectQuery]()
InsertThenLoad = getThenLoaders[*dialect.InsertQuery]()
UpdateThenLoad = getThenLoaders[*dialect.UpdateQuery]()
)
type thenLoaders[Q orm.Loadable] struct {
FieldseekerContainerrelate fieldseekerContainerrelateThenLoader[Q]
FieldseekerFieldscoutinglog fieldseekerFieldscoutinglogThenLoader[Q]
FieldseekerHabitatrelate fieldseekerHabitatrelateThenLoader[Q]
FieldseekerInspectionsample fieldseekerInspectionsampleThenLoader[Q]
FieldseekerInspectionsampledetail fieldseekerInspectionsampledetailThenLoader[Q]
FieldseekerLinelocation fieldseekerLinelocationThenLoader[Q]
FieldseekerLocationtracking fieldseekerLocationtrackingThenLoader[Q]
FieldseekerMosquitoinspection fieldseekerMosquitoinspectionThenLoader[Q]
FieldseekerPointlocation fieldseekerPointlocationThenLoader[Q]
FieldseekerPolygonlocation fieldseekerPolygonlocationThenLoader[Q]
FieldseekerPool fieldseekerPoolThenLoader[Q]
FieldseekerPooldetail fieldseekerPooldetailThenLoader[Q]
FieldseekerProposedtreatmentarea fieldseekerProposedtreatmentareaThenLoader[Q]
FieldseekerQamosquitoinspection fieldseekerQamosquitoinspectionThenLoader[Q]
FieldseekerRodentlocation fieldseekerRodentlocationThenLoader[Q]
FieldseekerSamplecollection fieldseekerSamplecollectionThenLoader[Q]
FieldseekerSamplelocation fieldseekerSamplelocationThenLoader[Q]
FieldseekerServicerequest fieldseekerServicerequestThenLoader[Q]
FieldseekerSpeciesabundance fieldseekerSpeciesabundanceThenLoader[Q]
FieldseekerStormdrain fieldseekerStormdrainThenLoader[Q]
FieldseekerTimecard fieldseekerTimecardThenLoader[Q]
FieldseekerTrapdatum fieldseekerTrapdatumThenLoader[Q]
FieldseekerTraplocation fieldseekerTraplocationThenLoader[Q]
FieldseekerTreatment fieldseekerTreatmentThenLoader[Q]
FieldseekerTreatmentarea fieldseekerTreatmentareaThenLoader[Q]
FieldseekerZone fieldseekerZoneThenLoader[Q]
FieldseekerZones2 fieldseekerZones2ThenLoader[Q]
FieldseekerSync fieldseekerSyncThenLoader[Q]
H3Aggregation h3AggregationThenLoader[Q]
NoteAudio noteAudioThenLoader[Q]
NoteAudioBreadcrumb noteAudioBreadcrumbThenLoader[Q]
NoteAudioDatum noteAudioDatumThenLoader[Q]
NoteImage noteImageThenLoader[Q]
NoteImageBreadcrumb noteImageBreadcrumbThenLoader[Q]
NoteImageDatum noteImageDatumThenLoader[Q]
Notification notificationThenLoader[Q]
OauthToken oauthTokenThenLoader[Q]
Organization organizationThenLoader[Q]
User userThenLoader[Q]
}
func getThenLoaders[Q orm.Loadable]() thenLoaders[Q] {
return thenLoaders[Q]{
FieldseekerContainerrelate: buildFieldseekerContainerrelateThenLoader[Q](),
FieldseekerFieldscoutinglog: buildFieldseekerFieldscoutinglogThenLoader[Q](),
FieldseekerHabitatrelate: buildFieldseekerHabitatrelateThenLoader[Q](),
FieldseekerInspectionsample: buildFieldseekerInspectionsampleThenLoader[Q](),
FieldseekerInspectionsampledetail: buildFieldseekerInspectionsampledetailThenLoader[Q](),
FieldseekerLinelocation: buildFieldseekerLinelocationThenLoader[Q](),
FieldseekerLocationtracking: buildFieldseekerLocationtrackingThenLoader[Q](),
FieldseekerMosquitoinspection: buildFieldseekerMosquitoinspectionThenLoader[Q](),
FieldseekerPointlocation: buildFieldseekerPointlocationThenLoader[Q](),
FieldseekerPolygonlocation: buildFieldseekerPolygonlocationThenLoader[Q](),
FieldseekerPool: buildFieldseekerPoolThenLoader[Q](),
FieldseekerPooldetail: buildFieldseekerPooldetailThenLoader[Q](),
FieldseekerProposedtreatmentarea: buildFieldseekerProposedtreatmentareaThenLoader[Q](),
FieldseekerQamosquitoinspection: buildFieldseekerQamosquitoinspectionThenLoader[Q](),
FieldseekerRodentlocation: buildFieldseekerRodentlocationThenLoader[Q](),
FieldseekerSamplecollection: buildFieldseekerSamplecollectionThenLoader[Q](),
FieldseekerSamplelocation: buildFieldseekerSamplelocationThenLoader[Q](),
FieldseekerServicerequest: buildFieldseekerServicerequestThenLoader[Q](),
FieldseekerSpeciesabundance: buildFieldseekerSpeciesabundanceThenLoader[Q](),
FieldseekerStormdrain: buildFieldseekerStormdrainThenLoader[Q](),
FieldseekerTimecard: buildFieldseekerTimecardThenLoader[Q](),
FieldseekerTrapdatum: buildFieldseekerTrapdatumThenLoader[Q](),
FieldseekerTraplocation: buildFieldseekerTraplocationThenLoader[Q](),
FieldseekerTreatment: buildFieldseekerTreatmentThenLoader[Q](),
FieldseekerTreatmentarea: buildFieldseekerTreatmentareaThenLoader[Q](),
FieldseekerZone: buildFieldseekerZoneThenLoader[Q](),
FieldseekerZones2: buildFieldseekerZones2ThenLoader[Q](),
FieldseekerSync: buildFieldseekerSyncThenLoader[Q](),
H3Aggregation: buildH3AggregationThenLoader[Q](),
NoteAudio: buildNoteAudioThenLoader[Q](),
NoteAudioBreadcrumb: buildNoteAudioBreadcrumbThenLoader[Q](),
NoteAudioDatum: buildNoteAudioDatumThenLoader[Q](),
NoteImage: buildNoteImageThenLoader[Q](),
NoteImageBreadcrumb: buildNoteImageBreadcrumbThenLoader[Q](),
NoteImageDatum: buildNoteImageDatumThenLoader[Q](),
Notification: buildNotificationThenLoader[Q](),
OauthToken: buildOauthTokenThenLoader[Q](),
Organization: buildOrganizationThenLoader[Q](),
User: buildUserThenLoader[Q](),
}
}
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
}
}
}