2.0.2 • Published 5 years ago

graphqltoolstypeint64 v2.0.2

Weekly downloads
8
License
MIT
Repository
github
Last release
5 years ago

graphql-tools-type-int64

Build Status Coverage Status

Int64 scalar type for graphql-tools

This is not actually 64-bit! Because javascript safe integers are between -(2^53 - 1) and 2^53 - 1, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger.

Usage

import { makeExecutableSchema } from 'graphql-tools'
// import Int64 from 'graphql-tools-type-int64'
import Int64 from 'graphqltoolstypeint64' // naming: because of npm spam detection

let typeDefs = [`
scalar Int64
type Query {
  value(v: Int64): Int64
}`
]
let resolvers = {
  Int64,
  Query: {
    value: (root, { v }) => v
  }
}
let schema = makeExecutableSchema({ typeDefs, resolvers })

export default schema