graphql/dataloader

[QUESTION] Is possible chain two dataloaders?

开放

#229 创建于 2019年11月20日

 (1 条评论) (3 个反应) (0 位负责人)JavaScript (556 个派生)batch import
help wanted

仓库指标

星标
 (12,520 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Hi, is it possible chain two dataloaders? I have one resolver where I need using two dataloaders, is it possible? I can't use SQL join because it's slow.

async (row, _, { dataSources }) => {
    const partialData = await dataloader1(dataSources).load(row.id);
    if (partialData === null) {
        return null;
    }
    return await dataloader2(dataSources).load(partialData.id);
}

贡献者指南