1.0.1 • Published 3 years ago

sam-gql-orm v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

sam-gql-orm

sam-gql-orm是一个把JS对象转换为GraphQL语法的方法库。

使用参考

const gql = require('sam-graphql-orm');

const data1 = {
  schema: 'status',
  input: {
    key: 'goodkey',
  },
  output: {
    code: '',
    message: '',
    data: {
      config: '',
    },
  },
};

console.log(gql(data1));
// {status(key: "goodkey"){code message data{config }}}

const data2 = {
  schema: 'status',
  input: {
    securityCaseId: '56',
    operation: 'add',
    businessParam: JSON.stringify({
      appName: 'book',
    })
  },
  output: {
    data: {
      status: '',
      time: '',
      comment: ''
    },
    message: '',
    success: ''
  }
};

console.log(gql(data2));
// {status(securityCaseId: "56",operation: "add",businessParam: "%7B%22appName%22%3A%22book%22%7D"){data{status time comment }message success }}