INNER CODE UNIT · TypeScript

handleToMany

slaypni/type-graphql-dataloader · src/decorators/typeorm/ExplicitLoaderImpl.ts:87

async function handleToMany<V>(
  foreignKeyFunc: (root: any) => any | undefined,
  root: any,
  tgdContext: TgdContext,
  relation: RelationMetadata
) {
  return handler(
    tgdContext,
    relation,
    relation.inverseEntityMetadata.primaryColumns,
    (connection) => new ToManyDataloader<V>(relation, connection),
    async (dataloader) => {
      const fks = foreignKeyFunc(root);
      return await dataloader.loadMany(fks);
    }
  );
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…