This requires a bunch of changes since the types on these tables are much closer to the underlying types of the Fieldseeker data we are getting back from the API. I now need to use proper UUID types everywhere, which means I had to modify the bob gen config to consistently use google UUID, my UUID library of choice. I also had to add the organization_id to all the fieldseeker tables since we rely on them existing for some of our compound queries. There were some changes to the API type signatures to get things to build. I may yet regret those.
250 lines
21 KiB
Go
250 lines
21 KiB
Go
// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. 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 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 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 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 oauth_token
|
|
oauthTokenWithParentsCascadingCtx = newContextual[bool]("oauthTokenWithParentsCascading")
|
|
oauthTokenRelUserUserCtx = newContextual[bool]("oauth_token.user_.oauth_token.oauth_token_user_id_fkey")
|
|
|
|
// Relationship Contexts for organization
|
|
organizationWithParentsCascadingCtx = newContextual[bool]("organizationWithParentsCascading")
|
|
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")
|
|
organizationRelPoolsCtx = 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")
|
|
organizationRelH3AggregationsCtx = newContextual[bool]("h3_aggregation.organization.h3_aggregation.h3_aggregation_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")
|
|
organizationRelUserCtx = newContextual[bool]("organization.user_.user_.user__organization_id_fkey")
|
|
|
|
// Relationship Contexts for raster_columns
|
|
rasterColumnWithParentsCascadingCtx = newContextual[bool]("rasterColumnWithParentsCascading")
|
|
|
|
// Relationship Contexts for raster_overviews
|
|
rasterOverviewWithParentsCascadingCtx = newContextual[bool]("rasterOverviewWithParentsCascading")
|
|
|
|
// Relationship Contexts for sessions
|
|
sessionWithParentsCascadingCtx = newContextual[bool]("sessionWithParentsCascading")
|
|
|
|
// Relationship Contexts for spatial_ref_sys
|
|
spatialRefSyWithParentsCascadingCtx = newContextual[bool]("spatialRefSyWithParentsCascading")
|
|
|
|
// Relationship Contexts for user_
|
|
userWithParentsCascadingCtx = newContextual[bool]("userWithParentsCascading")
|
|
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")
|
|
userRelUserOauthTokensCtx = newContextual[bool]("oauth_token.user_.oauth_token.oauth_token_user_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
|
|
}
|