createDataloaders
Function: createDataloaders()
createDataloaders(
db,cache):Dataloaders
Defined in: src/utilities/dataloaders/index.ts:50
Creates all DataLoaders for a request context. Each loader is request-scoped to ensure proper caching and isolation. When a cache service is provided, DataLoaders use cache-first lookup strategy.
Parameters
db
The Drizzle client instance for database operations.
cache
Optional cache service for cache-first lookups. Pass null to disable caching.
CacheService | null
Returns
An object containing all DataLoaders.
Example
const dataloaders = createDataloaders(drizzleClient, cacheService);
const user = await dataloaders.user.load(userId);
const organization = await dataloaders.organization.load(orgId);