=> ({ ...omit(f, 'name'), postCount: b.int(), }), relations: () => getRelations('User'), }) user.implement((f) => ({ postCount: f.postCount.resolve((params) => { return pg.dataloader(params, async (userList) => { const userIds = userList.map((x) => x.id) const resp = await prisma.post.groupBy({ _count: { _all: true }, by: ['userId'], where: { userId: { in: userIds } }, }) return userIds.map((id) => resp.find((x) => x.userId === id)?._count._all ?? 0) }) }) })) Field Resolverの実装例 型安全なDataLoaderも組み込み