nidus-sync/db/models/bob_loaders.bob.go
Eli Ribble 06140a9062
Remove bob submodule, add arcgis.user
I had to remove the submodule because of the go bug at
https://github.com/golang/go/issues/77196
I found the bug because of a bug in bob itself
https://github.com/stephenafamo/bob/issues/610
This was because I'm trying to save data about the Arcgis user for use
in determining if I can set up hooks to avoid the polling for data
changes.
2026-01-15 19:20:39 +00:00

239 lines
14 KiB
Go

// Code generated by BobGen psql v0.42.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 {
ArcgisUser arcgisuserPreloader
ArcgisUserPrivilege arcgisUserPrivilegePreloader
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
PublicreportPool publicreportPoolPreloader
PublicreportPoolPhoto publicreportPoolPhotoPreloader
PublicreportQuick publicreportQuickPreloader
PublicreportQuickPhoto publicreportQuickPhotoPreloader
User userPreloader
}
func getPreloaders() preloaders {
return preloaders{
ArcgisUser: buildArcgisUserPreloader(),
ArcgisUserPrivilege: buildArcgisUserPrivilegePreloader(),
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(),
PublicreportPool: buildPublicreportPoolPreloader(),
PublicreportPoolPhoto: buildPublicreportPoolPhotoPreloader(),
PublicreportQuick: buildPublicreportQuickPreloader(),
PublicreportQuickPhoto: buildPublicreportQuickPhotoPreloader(),
User: buildUserPreloader(),
}
}
var (
SelectThenLoad = getThenLoaders[*dialect.SelectQuery]()
InsertThenLoad = getThenLoaders[*dialect.InsertQuery]()
UpdateThenLoad = getThenLoaders[*dialect.UpdateQuery]()
)
type thenLoaders[Q orm.Loadable] struct {
ArcgisUser arcgisuserThenLoader[Q]
ArcgisUserPrivilege arcgisUserPrivilegeThenLoader[Q]
FieldseekerContainerrelate fieldseekerContainerrelateThenLoader[Q]
FieldseekerFieldscoutinglog fieldseekerFieldscoutinglogThenLoader[Q]
FieldseekerHabitatrelate fieldseekerHabitatrelateThenLoader[Q]
FieldseekerInspectionsample fieldseekerInspectionsampleThenLoader[Q]
FieldseekerInspectionsampledetail fieldseekerInspectionsampledetailThenLoader[Q]
FieldseekerLinelocation fieldseekerLinelocationThenLoader[Q]
FieldseekerLocationtracking fieldseekerLocationtrackingThenLoader[Q]
FieldseekerMosquitoinspection fieldseekerMosquitoinspectionThenLoader[Q]
FieldseekerPointlocation fieldseekerPointlocationThenLoader[Q]
FieldseekerPolygonlocation fieldseekerPolygonlocationThenLoader[Q]
FieldseekerPool fieldseekerPoolThenLoader[Q]
FieldseekerPooldetail fieldseekerPooldetailThenLoader[Q]
FieldseekerProposedtreatmentarea fieldseekerProposedtreatmentareaThenLoader[Q]
FieldseekerQamosquitoinspection fieldseekerQamosquitoinspectionThenLoader[Q]
FieldseekerRodentlocation fieldseekerRodentlocationThenLoader[Q]
FieldseekerSamplecollection fieldseekerSamplecollectionThenLoader[Q]
FieldseekerSamplelocation fieldseekerSamplelocationThenLoader[Q]
FieldseekerServicerequest fieldseekerServicerequestThenLoader[Q]
FieldseekerSpeciesabundance fieldseekerSpeciesabundanceThenLoader[Q]
FieldseekerStormdrain fieldseekerStormdrainThenLoader[Q]
FieldseekerTimecard fieldseekerTimecardThenLoader[Q]
FieldseekerTrapdatum fieldseekerTrapdatumThenLoader[Q]
FieldseekerTraplocation fieldseekerTraplocationThenLoader[Q]
FieldseekerTreatment fieldseekerTreatmentThenLoader[Q]
FieldseekerTreatmentarea fieldseekerTreatmentareaThenLoader[Q]
FieldseekerZone fieldseekerZoneThenLoader[Q]
FieldseekerZones2 fieldseekerZones2ThenLoader[Q]
FieldseekerSync fieldseekerSyncThenLoader[Q]
H3Aggregation h3AggregationThenLoader[Q]
NoteAudio noteAudioThenLoader[Q]
NoteAudioBreadcrumb noteAudioBreadcrumbThenLoader[Q]
NoteAudioDatum noteAudioDatumThenLoader[Q]
NoteImage noteImageThenLoader[Q]
NoteImageBreadcrumb noteImageBreadcrumbThenLoader[Q]
NoteImageDatum noteImageDatumThenLoader[Q]
Notification notificationThenLoader[Q]
OauthToken oauthTokenThenLoader[Q]
Organization organizationThenLoader[Q]
PublicreportPool publicreportPoolThenLoader[Q]
PublicreportPoolPhoto publicreportPoolPhotoThenLoader[Q]
PublicreportQuick publicreportQuickThenLoader[Q]
PublicreportQuickPhoto publicreportQuickPhotoThenLoader[Q]
User userThenLoader[Q]
}
func getThenLoaders[Q orm.Loadable]() thenLoaders[Q] {
return thenLoaders[Q]{
ArcgisUser: buildArcgisUserThenLoader[Q](),
ArcgisUserPrivilege: buildArcgisUserPrivilegeThenLoader[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](),
PublicreportPool: buildPublicreportPoolThenLoader[Q](),
PublicreportPoolPhoto: buildPublicreportPoolPhotoThenLoader[Q](),
PublicreportQuick: buildPublicreportQuickThenLoader[Q](),
PublicreportQuickPhoto: buildPublicreportQuickPhotoThenLoader[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
}
}
}