playlyfe / go-graphql

A powerful GraphQL server implementation for Golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

64-bit integers

samzhang111 opened this issue · comments

Looks like ints are being casted as int32:

Value: int32(val),

A few lines above, ints are parsed as 64-bit though:

val, err := strconv.ParseInt(token.Val, 10, 64)

Why not leave everything as 64-bit? I am using this library and got an overflow of an int field that holds milliseconds since the epoch (Unix time * 1000), since that is bigger than 2^32

Just saw that Facebook spec'd 32-bit integers: http://facebook.github.io/graphql/#sec-Int

Carry on...

Reopening to ask whether there is consideration for adding a custom Long datatype:

We do make extensive use of custom scalars and they are implemented though documentation is a little lacking. Here's an example in a test case:

https://github.com/playlyfe/go-graphql/blob/master/executor_test.go#L1746-L1777

You need to declare the scalar in the schema scalar <Your Scalar Name> and then the entry to the executor.Scalars map as shown in the test case.