Created
November 28, 2017 12:45
-
-
Save maciejjankowski/7ab0e0c68b7b7cfc69075ec2ec8ba23c to your computer and use it in GitHub Desktop.
GraphQL-izing sequelization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sequelize={literal:()=>'',INTEGER:'INTEGER', STRING:'STRING', 'DATE':'DATE', 'DATEONLY': 'DATEONLY'}; | |
var t={'STRING':'graphql.GraphQLString', 'INTEGER':'graphql.GraphQLInt', 'DATE':'graphqlDate.GraphQLDateTime', 'DATEONLY':'graphqlDate.GraphQLDateTime'}; | |
var ql=(x)=>'{'+Object.keys(x).map(k=>(`${k} : { type : ${t[x[k].type]}, resolve(o){return o.${k}}}`)).join(',')+'}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment