sequelize-relay
This is a library to allow the easy creation of Relay-compliant servers using sequelize, graphql-js and graphql-relay-js.
Dependencies:
- sequelize - an easy-to-use multi sql dialect ORM for Node.js & io.js. It currently supports MySQL, MariaDB, SQLite, PostgreSQL and MSSQL.
- graphql-relay-js - A library to help construct a graphql-js server supporting react-relay.
- graphql-js - A reference implementation of GraphQL for JavaScript.
Getting Started
This library is designed to work with the graphql-relay-js implementation of a GraphQL server using Sequelize.
- Setup a new npm project
- Run
npm install graphql graphql-relay-js sequelize sequelize-relay --save-dev - Setup a Sequelize Server
- Setup your GraphQL Schema
- Use graphql-relay-js, sequelize, and sequelize-relay helper functions and win.
- Common Patterns, helper methods, etc in the References page.
Methods
getArrayData - Converts an
Arrayof<SequelizeModel>instances to anArrayofobjects. getModelsByClass - Returns an
Arrayof<SequelizeModel>instances that are of the passed-inSequelizeClass.resolveArrayByClass - First, it internally resolves an an
Arrayof<SequelizeModel>instances that are of the passed-inSequelizeClass. Then it converts the array into a promisedArrayof<Attributes>objects.resolveArrayData - Converts a promised
Arrayof<SequelizeModel>instances into a promisedArrayof<Attributes>objects.resolveModelsByClass - Returns a promised
Arrayof<SequelizeModel>objects bySequelizeClass.

