Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/linbudu599/dataloader-source-explore
DataLoader源码讲解, 附带TypeGraphQL-DataLoader与Prisma DataLoader解析
https://github.com/linbudu599/dataloader-source-explore
Last synced: 10 days ago
JSON representation
DataLoader源码讲解, 附带TypeGraphQL-DataLoader与Prisma DataLoader解析
- Host: GitHub
- URL: https://github.com/linbudu599/dataloader-source-explore
- Owner: linbudu599
- License: mit
- Created: 2021-01-29T06:57:14.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-03-31T08:42:05.000Z (over 1 year ago)
- Last Synced: 2024-10-12T14:10:50.058Z (26 days ago)
- Language: TypeScript
- Size: 140 KB
- Stars: 2
- Watchers: 2
- Forks: 3
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DataLoader-Source-Explore
## Quick Start
```bash
yarn
yarn dev
```打开链接:[http://localhost:7878/](http://localhost:7878/)
使用 [common.graphql](graphql/common.graphql) 的语句发起查询,此操作预期将重复调用 `getUserById` `getPetsByIds` 方法,见终端输出。
使用 [dataloader.graphql](graphql/dataloader.graphql) 的语句发起查询,此操作预期将仅调用批查询方法`getUsersByIds` `getPetsByIds`,见终端输出。
通过最上方的导入来切换示例使用的 DataLoader 实现:
```typescript
// TS 版本
import DataLoader from "./dataloader";
// NPM 版本
import DataLoader from "dataloader";
// 迷你实现版本
import DataLoader from "./tiny";
```## Includes
- [Original Implementation](source/index.js)
- [x] [DataLoader TS 版本](./dataloader.ts)
- [x] [DataLoader 在 GraphQL 中的实际效果](./sample.ts)
- [x] [DataLoader 源码](./dataloader.ts)
- [x] [DataLoader 迷你实现](tiny.ts)
- [x] [Prisma DataLoader 源码解析](./prisma-dataloader.ts)
- [x] [NestJS-DataLoader 源码解析](./nestjs-dataloader.ts)## Related
- [GraphQL-Explorer-Server](https://github.com/linbudu599/GraphQL-Explorer-Server)
- [Prisma-Article-Examples](https://github.com/linbudu599/Prisma-Article-Example)
- [NestJS](https://nestjs.com/)
- [NestJS-DataLoader](https://github.com/krislefeber/nestjs-dataloader)
- [GraphQL](https://graphql.org/)
- [TypeGraphQL](https://typegraphql.com/)
- [TypeGraphQL-DataLoader](https://github.com/slaypni/type-graphql-dataloader)