Add SS and MCP databases
This commit is contained in:
203
database/mcp/models/bob_loaders.bob.go
Normal file
203
database/mcp/models/bob_loaders.bob.go
Normal file
@@ -0,0 +1,203 @@
|
||||
// Code generated by BobGen mysql v0.42.0. 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/mysql/dialect"
|
||||
"github.com/stephenafamo/bob/orm"
|
||||
)
|
||||
|
||||
var Preload = getPreloaders()
|
||||
|
||||
type preloaders struct {
|
||||
AuthGroup authGroupPreloader
|
||||
AuthGroupPermission authGroupPermissionPreloader
|
||||
AuthPermission authPermissionPreloader
|
||||
AuthUser authUserPreloader
|
||||
AuthUserGroup authUserGroupPreloader
|
||||
AuthUserUserPermission authUserUserPermissionPreloader
|
||||
DjangoAdminLog djangoAdminLogPreloader
|
||||
DjangoContentType djangoContentTypePreloader
|
||||
LocationsArchipelago locationsArchipelagoPreloader
|
||||
LocationsArkivum locationsArkivumPreloader
|
||||
LocationsDataverse locationsDataversePreloader
|
||||
LocationsDspace locationsDspacePreloader
|
||||
LocationsDspacerest locationsDspacerestPreloader
|
||||
LocationsDuracloud locationsDuracloudPreloader
|
||||
LocationsEvent locationsEventPreloader
|
||||
LocationsFedora locationsFedoraPreloader
|
||||
LocationsFile locationsFilePreloader
|
||||
LocationsFixitylog locationsFixitylogPreloader
|
||||
LocationsGPG locationsGPGPreloader
|
||||
LocationsLocalfilesystem locationsLocalfilesystemPreloader
|
||||
LocationsLocation locationsLocationPreloader
|
||||
LocationsLocationReplicator locationsLocationReplicatorPreloader
|
||||
LocationsLocationpipeline locationsLocationpipelinePreloader
|
||||
LocationsLockssomatic locationsLockssomaticPreloader
|
||||
LocationsNF locationsNFPreloader
|
||||
LocationsOfflinereplicastaging locationsOfflinereplicastagingPreloader
|
||||
LocationsPackage locationsPackagePreloader
|
||||
LocationsPackageRelatedPackage locationsPackageRelatedPackagePreloader
|
||||
LocationsPackagedownloadtask locationsPackagedownloadtaskPreloader
|
||||
LocationsPackagedownloadtaskfile locationsPackagedownloadtaskfilePreloader
|
||||
LocationsPipeline locationsPipelinePreloader
|
||||
LocationsPipelinelocalf locationsPipelinelocalfPreloader
|
||||
LocationsRclone locationsRclonePreloader
|
||||
LocationsS3 locationsS3Preloader
|
||||
LocationsSpace locationsSpacePreloader
|
||||
LocationsSwift locationsSwiftPreloader
|
||||
TastypieApikey tastypieApikeyPreloader
|
||||
}
|
||||
|
||||
func getPreloaders() preloaders {
|
||||
return preloaders{
|
||||
AuthGroup: buildAuthGroupPreloader(),
|
||||
AuthGroupPermission: buildAuthGroupPermissionPreloader(),
|
||||
AuthPermission: buildAuthPermissionPreloader(),
|
||||
AuthUser: buildAuthUserPreloader(),
|
||||
AuthUserGroup: buildAuthUserGroupPreloader(),
|
||||
AuthUserUserPermission: buildAuthUserUserPermissionPreloader(),
|
||||
DjangoAdminLog: buildDjangoAdminLogPreloader(),
|
||||
DjangoContentType: buildDjangoContentTypePreloader(),
|
||||
LocationsArchipelago: buildLocationsArchipelagoPreloader(),
|
||||
LocationsArkivum: buildLocationsArkivumPreloader(),
|
||||
LocationsDataverse: buildLocationsDataversePreloader(),
|
||||
LocationsDspace: buildLocationsDspacePreloader(),
|
||||
LocationsDspacerest: buildLocationsDspacerestPreloader(),
|
||||
LocationsDuracloud: buildLocationsDuracloudPreloader(),
|
||||
LocationsEvent: buildLocationsEventPreloader(),
|
||||
LocationsFedora: buildLocationsFedoraPreloader(),
|
||||
LocationsFile: buildLocationsFilePreloader(),
|
||||
LocationsFixitylog: buildLocationsFixitylogPreloader(),
|
||||
LocationsGPG: buildLocationsGPGPreloader(),
|
||||
LocationsLocalfilesystem: buildLocationsLocalfilesystemPreloader(),
|
||||
LocationsLocation: buildLocationsLocationPreloader(),
|
||||
LocationsLocationReplicator: buildLocationsLocationReplicatorPreloader(),
|
||||
LocationsLocationpipeline: buildLocationsLocationpipelinePreloader(),
|
||||
LocationsLockssomatic: buildLocationsLockssomaticPreloader(),
|
||||
LocationsNF: buildLocationsNFPreloader(),
|
||||
LocationsOfflinereplicastaging: buildLocationsOfflinereplicastagingPreloader(),
|
||||
LocationsPackage: buildLocationsPackagePreloader(),
|
||||
LocationsPackageRelatedPackage: buildLocationsPackageRelatedPackagePreloader(),
|
||||
LocationsPackagedownloadtask: buildLocationsPackagedownloadtaskPreloader(),
|
||||
LocationsPackagedownloadtaskfile: buildLocationsPackagedownloadtaskfilePreloader(),
|
||||
LocationsPipeline: buildLocationsPipelinePreloader(),
|
||||
LocationsPipelinelocalf: buildLocationsPipelinelocalfPreloader(),
|
||||
LocationsRclone: buildLocationsRclonePreloader(),
|
||||
LocationsS3: buildLocationsS3Preloader(),
|
||||
LocationsSpace: buildLocationsSpacePreloader(),
|
||||
LocationsSwift: buildLocationsSwiftPreloader(),
|
||||
TastypieApikey: buildTastypieApikeyPreloader(),
|
||||
}
|
||||
}
|
||||
|
||||
var SelectThenLoad = getThenLoaders[*dialect.SelectQuery]()
|
||||
|
||||
type thenLoaders[Q orm.Loadable] struct {
|
||||
AuthGroup authGroupThenLoader[Q]
|
||||
AuthGroupPermission authGroupPermissionThenLoader[Q]
|
||||
AuthPermission authPermissionThenLoader[Q]
|
||||
AuthUser authUserThenLoader[Q]
|
||||
AuthUserGroup authUserGroupThenLoader[Q]
|
||||
AuthUserUserPermission authUserUserPermissionThenLoader[Q]
|
||||
DjangoAdminLog djangoAdminLogThenLoader[Q]
|
||||
DjangoContentType djangoContentTypeThenLoader[Q]
|
||||
LocationsArchipelago locationsArchipelagoThenLoader[Q]
|
||||
LocationsArkivum locationsArkivumThenLoader[Q]
|
||||
LocationsDataverse locationsDataverseThenLoader[Q]
|
||||
LocationsDspace locationsDspaceThenLoader[Q]
|
||||
LocationsDspacerest locationsDspacerestThenLoader[Q]
|
||||
LocationsDuracloud locationsDuracloudThenLoader[Q]
|
||||
LocationsEvent locationsEventThenLoader[Q]
|
||||
LocationsFedora locationsFedoraThenLoader[Q]
|
||||
LocationsFile locationsFileThenLoader[Q]
|
||||
LocationsFixitylog locationsFixitylogThenLoader[Q]
|
||||
LocationsGPG locationsGPGThenLoader[Q]
|
||||
LocationsLocalfilesystem locationsLocalfilesystemThenLoader[Q]
|
||||
LocationsLocation locationsLocationThenLoader[Q]
|
||||
LocationsLocationReplicator locationsLocationReplicatorThenLoader[Q]
|
||||
LocationsLocationpipeline locationsLocationpipelineThenLoader[Q]
|
||||
LocationsLockssomatic locationsLockssomaticThenLoader[Q]
|
||||
LocationsNF locationsNFThenLoader[Q]
|
||||
LocationsOfflinereplicastaging locationsOfflinereplicastagingThenLoader[Q]
|
||||
LocationsPackage locationsPackageThenLoader[Q]
|
||||
LocationsPackageRelatedPackage locationsPackageRelatedPackageThenLoader[Q]
|
||||
LocationsPackagedownloadtask locationsPackagedownloadtaskThenLoader[Q]
|
||||
LocationsPackagedownloadtaskfile locationsPackagedownloadtaskfileThenLoader[Q]
|
||||
LocationsPipeline locationsPipelineThenLoader[Q]
|
||||
LocationsPipelinelocalf locationsPipelinelocalfThenLoader[Q]
|
||||
LocationsRclone locationsRcloneThenLoader[Q]
|
||||
LocationsS3 locationsS3ThenLoader[Q]
|
||||
LocationsSpace locationsSpaceThenLoader[Q]
|
||||
LocationsSwift locationsSwiftThenLoader[Q]
|
||||
TastypieApikey tastypieApikeyThenLoader[Q]
|
||||
}
|
||||
|
||||
func getThenLoaders[Q orm.Loadable]() thenLoaders[Q] {
|
||||
return thenLoaders[Q]{
|
||||
AuthGroup: buildAuthGroupThenLoader[Q](),
|
||||
AuthGroupPermission: buildAuthGroupPermissionThenLoader[Q](),
|
||||
AuthPermission: buildAuthPermissionThenLoader[Q](),
|
||||
AuthUser: buildAuthUserThenLoader[Q](),
|
||||
AuthUserGroup: buildAuthUserGroupThenLoader[Q](),
|
||||
AuthUserUserPermission: buildAuthUserUserPermissionThenLoader[Q](),
|
||||
DjangoAdminLog: buildDjangoAdminLogThenLoader[Q](),
|
||||
DjangoContentType: buildDjangoContentTypeThenLoader[Q](),
|
||||
LocationsArchipelago: buildLocationsArchipelagoThenLoader[Q](),
|
||||
LocationsArkivum: buildLocationsArkivumThenLoader[Q](),
|
||||
LocationsDataverse: buildLocationsDataverseThenLoader[Q](),
|
||||
LocationsDspace: buildLocationsDspaceThenLoader[Q](),
|
||||
LocationsDspacerest: buildLocationsDspacerestThenLoader[Q](),
|
||||
LocationsDuracloud: buildLocationsDuracloudThenLoader[Q](),
|
||||
LocationsEvent: buildLocationsEventThenLoader[Q](),
|
||||
LocationsFedora: buildLocationsFedoraThenLoader[Q](),
|
||||
LocationsFile: buildLocationsFileThenLoader[Q](),
|
||||
LocationsFixitylog: buildLocationsFixitylogThenLoader[Q](),
|
||||
LocationsGPG: buildLocationsGPGThenLoader[Q](),
|
||||
LocationsLocalfilesystem: buildLocationsLocalfilesystemThenLoader[Q](),
|
||||
LocationsLocation: buildLocationsLocationThenLoader[Q](),
|
||||
LocationsLocationReplicator: buildLocationsLocationReplicatorThenLoader[Q](),
|
||||
LocationsLocationpipeline: buildLocationsLocationpipelineThenLoader[Q](),
|
||||
LocationsLockssomatic: buildLocationsLockssomaticThenLoader[Q](),
|
||||
LocationsNF: buildLocationsNFThenLoader[Q](),
|
||||
LocationsOfflinereplicastaging: buildLocationsOfflinereplicastagingThenLoader[Q](),
|
||||
LocationsPackage: buildLocationsPackageThenLoader[Q](),
|
||||
LocationsPackageRelatedPackage: buildLocationsPackageRelatedPackageThenLoader[Q](),
|
||||
LocationsPackagedownloadtask: buildLocationsPackagedownloadtaskThenLoader[Q](),
|
||||
LocationsPackagedownloadtaskfile: buildLocationsPackagedownloadtaskfileThenLoader[Q](),
|
||||
LocationsPipeline: buildLocationsPipelineThenLoader[Q](),
|
||||
LocationsPipelinelocalf: buildLocationsPipelinelocalfThenLoader[Q](),
|
||||
LocationsRclone: buildLocationsRcloneThenLoader[Q](),
|
||||
LocationsS3: buildLocationsS3ThenLoader[Q](),
|
||||
LocationsSpace: buildLocationsSpaceThenLoader[Q](),
|
||||
LocationsSwift: buildLocationsSwiftThenLoader[Q](),
|
||||
TastypieApikey: buildTastypieApikeyThenLoader[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
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user