Skip to content

dowjones/graphql-dynamodb-connections

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraphQL DynamoDB Connections

Build Status NPM version

This is an adapter library that converts DynamoDB-style pagination to GraphQL Connection-style pagination.

Usage

import {
  paginationToParams,
  dataToConnection
} from 'graphql-dynamodb-connections';

const userConnections = {
  type: userConnection,
  args: connectionArgs,
  resolve: ((_, args) => {
    return promisifiedDocumentClient.scan({
      TableName: 'users',
      ...paginationToParams(args)
    })
    .then(dataToConnection);
  })
};

You can find more examples in the examples folder.

API

  • paginationToParams(connectionArgs) -- adapts connection-args to DynamoDB params
  • dataToConnection(data) -- converts the data returned by DynamoDB into a Connection type

Related

GraphQL REST Connections

License

MIT

About

DynamoDB pagination to GraphQL Connection adapter.

Resources

License

Stars

Watchers

Forks

Packages

No packages published