Skip to content

GraphQL : Support for BigInt / 64 bits integer #5459

@Miaourt

Description

@Miaourt

Hi Dgraph team, pretty new to Dgraph so excuse my potential incomprehensions.

Experience Report

I had a discussion with @pawanrawal on Slack over a efficient way to support 64 bits integer via the GraphQL endpoint, which isn't standard since the only "Int" type supported is 32 bits.

Storing it as a string would have been an option but I need to be able to index with this integer, and do simple operations like ascending / descending sorting or value comparisons, which is something impossible with a string.

What you wanted to do

As you did with DateTime or even ID, storing a "custom type" could be done too, by returning an hex-coded string representing the 64 bits value as suggested Pawan, and still allow us to store the value efficiently and do database operations on it.

Using Javascript's standard way of returning BigInt could be done too, by suffixing the value with n

Any external references to support your case

https://caniuse.com/#feat=bigint
https://v8.dev/features/bigint

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/graphqlIssues related to GraphQL support on Dgraph.kind/featureSomething completely new we should consider.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions