hasura / go-graphql-client

Package graphql provides a GraphQL client implementation.
MIT License
395 stars 91 forks source link

like uuid used using type uuid string to send to hasura what to do for bigint #110

Closed bete7512 closed 10 months ago

bete7512 commented 11 months ago

variable 'userId' is declared as 'Int', but used where 'bigint' is expected, Locations: [], Extensions: map[code:validation-failed path:$.selectionSet.insertUsersUserRolesOne.args.object.userId] I tried this
1,

type bitgint int
variables := map[string]interface{}{
        "userId": bigint(newUser.InsertUsersUsersOne.Id),
        "role":   "USER",
    }

2,also I tried HASURA_GRAPHQL_STRINGIFY_NUMERIC_TYPES=true then I sent userId as a string but still doesnot work

thanks

hgiasac commented 11 months ago

Hmm, your code should work. Anyway, you can define a reusable type instead.

type BigInt int 

func (bi BigInt) GetGraphQLType() string { 
  return "bigint" 
}

or use the ConstructQuery function to print the GraphQL string output for debugging