Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/graphql-compose/graphql-compose-dataloader
Add DataLoader to graphql-composer resolvers.
https://github.com/graphql-compose/graphql-compose-dataloader
dataloader graphql graphql-compose-plugin graphql-composer schema
Last synced: about 1 month ago
JSON representation
Add DataLoader to graphql-composer resolvers.
- Host: GitHub
- URL: https://github.com/graphql-compose/graphql-compose-dataloader
- Owner: graphql-compose
- License: mit
- Created: 2017-02-08T10:33:53.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-06-06T11:18:53.000Z (over 3 years ago)
- Last Synced: 2024-05-22T14:27:40.464Z (6 months ago)
- Topics: dataloader, graphql, graphql-compose-plugin, graphql-composer, schema
- Language: JavaScript
- Homepage:
- Size: 17.6 KB
- Stars: 18
- Watchers: 5
- Forks: 6
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# graphql-compose-dataloader – DEPRECATED
[![Greenkeeper badge](https://badges.greenkeeper.io/stoffern/graphql-compose-dataloader.svg)](https://greenkeeper.io/)
[![Travis](https://img.shields.io/travis/stoffern/graphql-compose-dataloader.svg)]()
[![npm version](https://img.shields.io/npm/v/graphql-compose-dataloader.svg?style=flat-square)](https://www.npmjs.com/package/graphql-compose-dataloader) [![npm](https://img.shields.io/npm/l/graphql-compose-dataloader.svg?style=flat-square)](https://github.com/stoffern/graphql-compose-dataloader/blob/master/LICENSE)
Add DataLoader to graphql-composer resolvers.### Deprecation reason
DataLoader cannot be expressed like a simple plugin. Mostly this plugin was used with [graphql-compose-mongoose](https://github.com/graphql-compose/graphql-compose-mongoose) models. From [email protected] ([read more](https://github.com/graphql-compose/graphql-compose-mongoose/blob/master/docs/releases/9.0.0.md#added-new-dataloader--dataloadermany-resolvers)) it starts provide new built-in resolvers `dataLoader` & `dataLoaderMany resolvers` which implement DataLoader logic in different manner.
### Installation
```
npm install graphql-compose-dataloader --save
```
Modules `graphql`, `graphql-compose` are in `peerDependencies`, so should be installed explicitly in your app. They have global objects and should not have ability to be installed as submodule.### Example
```js
import mongoose from 'mongoose';
import composeWithMongoose from 'graphql-compose-mongoose';
import composeWithDataLoader from 'graphql-compose-dataloader';const LanguagesSchema = new mongoose.Schema({
language: String,
skill: {
type: String,
enum: [ 'basic', 'fluent', 'native' ],
},
});const Languages = mongoose.model('Languages', LanguagesSchema)
const LanguagesTC = composeWithDataLoader(composeWithMongoose(Languages),{cacheExpiration: 700})
```#### Props
| Prop | Type | Description |
|---|---|---|
|**`cacheExpiration`**|`number`|Expiration in number of milliseconds. This will clear the one request sendt via the resolver (_Default: 500_)|
|**`removeProjection`**|`boolean`|Remove projection, this will request fields on the requested document and put it to cache (_Default: true_)|
|**`debug`**|`boolean`|Enable debug? (_Default: false_)|### License
=======
[MIT](https://github.com/nodkz/graphql-compose-mongoose/blob/master/LICENSE.md)