Closed dogukanoksuz closed 1 year ago
I guess the type reflection can't infer private types from other packages. You can try to define the inline type in the same package, for instance:
type smallint int
err := gql.Connection().Mutate(context.Background(), &q, map[string]interface{}{
"user_defined": smallint(1)
})
Another approach is the GraphQLType interface if you like to reuse that type for multiple packages.
type SmallInt int
func (i SmallInt) GetGraphQLType() string {
return "smallint"
}
Looks like second approach works.
As i tested we can reflect private types from other packages if it's based on string.
I think this lines causes the bug;
Hello,
Thanks for great work, i appreciate it. Library works great with Hasura but i am encountered a bug.
When mutating, i must send smallint as type but when i create smallint as type on Golang it still returns Int!
This typecasting works with strings without problems but on int values i encounter this error;
Thanks.