gql-bigint contains two scalar types (BigInt and BigUInt) for use with gqlgen GraphQL servers.
BigInt allows GraphQL servers to bypass the 53-bit limit imposed on GraphQL's inbuilt Int type, and corresponds to the
Go type int64.
BigUInt is very similar to BigInt, except it corresponds to the Go type uint64, allowing for slightly more headroom
if needed.
Install gql-bigint using go get -u github.com/xplorfin/gql-bigint.
Make sure the autobind entry in your .gqlgen.yml file has "github.com/xplorfin/gql-bigint" somewhere in it,
like so:
autobind:
- "github.com/xplorfin/gql-bigint"
[... all your other autobinds ...]Next, make sure the models entry in your .gqlgen.yml is set up to map the scalar types properly when generating:
models:
[... whatever else you have here ...]
BigInt:
model:
- github.com/xplorfin/gql-bigint.BigInt
BigUInt:
model:
- github.com/xplorfin/gql-bigint.BigUIntFinally, put the following two lines into a .graphql file where gqlgen will be able to pick it up (I recommand scalars.graphql):
scalar BigInt
scalar BigUIntRun go generate ./... to regenerate your schema/resolvers, and you're done.
Open up an issue or PR, and we'll take a look at it!