forked from graphql-nexus/nexus-prisma
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for BigInt scalar (graphql-nexus#56)
Co-authored-by: Jason Kuhrt <jasonkuhrt@me.com>
- Loading branch information
1 parent
d30ac3c
commit 67ce824
Showing
13 changed files
with
413 additions
and
32 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { GraphQLScalarType } from 'graphql' | ||
import { BigIntResolver } from 'graphql-scalars' | ||
import { asNexusMethod } from 'nexus' | ||
|
||
/** | ||
* A Nexus scalar type definition for the `BigInt` scalar type | ||
* | ||
* Contributes a scalar to your GraphQL schema called `BigInt`. | ||
* | ||
* Contributes a `t` `[1]` helper method called `bigInt` | ||
* | ||
* `[1]` A `t` helper method refers to a method on the argument given to a `definition` method. Helper methods | ||
* here typically help you quickly create new fields. | ||
* | ||
* @example | ||
* | ||
* import { makeSchema, objectType } from 'nexus' | ||
* import { BigInt } from 'nexus-prisma/scalars' | ||
* | ||
* SomeObject = objectType({ | ||
* name: 'SomeObject', | ||
* definition(t) { | ||
* t.bigInt('someBigIntField') | ||
* }, | ||
* }) | ||
* | ||
* makeSchema({ | ||
* types: [BigInt, SomeObject], | ||
* }) | ||
* | ||
*/ | ||
export const BigInt = asNexusMethod( | ||
new GraphQLScalarType({ | ||
...BigIntResolver, | ||
description: `The \`BigInt\` scalar type represents non-fractional signed whole numeric values. | ||
@see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt`, | ||
}), | ||
'bigInt' | ||
) |
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
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
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
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
Oops, something went wrong.