UNPKG

sql-to-graphql

Version:

Generate a GraphQL API based on your SQL database structure

13 lines (10 loc) 381 B
import {nodeDefinitions, fromGlobalId} from 'graphql-relay'; import getEntityResolver from '../util/entity-resolver'; const {nodeInterface, nodeField} = nodeDefinitions( function(globalId, ast) { let {type, id} = fromGlobalId(globalId); return getEntityResolver(type)(null, { id }, ast); }, data => data.__type ); export { nodeInterface, nodeField };