UNPKG

@pothos/plugin-dataloader

Version:

A Pothos plugin for attaching dataloader to object types

22 lines (18 loc) 452 B
import { type SchemaTypes, UnionRef } from '@pothos/core'; import type DataLoader from 'dataloader'; export class LoadableUnionRef< Types extends SchemaTypes, RefShape, Shape, Key, CacheKey, > extends UnionRef<Types, RefShape, Shape> { getDataloader; constructor( name: string, getDataloader: (context: Types['Context']) => DataLoader<Key, Shape, CacheKey>, ) { super(name); this.getDataloader = getDataloader; } }