Previously, I didn't know of a good way to determine scalar types automatically, so the interim solution was to require the user to specify the scalar types explicitly.
This has the downside that it makes it not possible to substitute GraphQL-specific types with equivalent other types when unmarshaling results of a query. E.g., one would have to always use githubql.DateTime and couldn't use the standard time.Time.
I've now discovered a way to determine scalar types automatically: they are structs that implement json.Unmarshaler interface.
This commit implements the change to automatic scalar type detection, and removes the no longer necessary explicit passing of scalars.
Previously, I didn't know of a good way to determine scalar types automatically, so the interim solution was to require the user to specify the scalar types explicitly.
This has the downside that it makes it not possible to substitute GraphQL-specific types with equivalent other types when unmarshaling results of a query. E.g., one would have to always use
githubql.DateTime
and couldn't use the standardtime.Time
.I've now discovered a way to determine scalar types automatically: they are structs that implement
json.Unmarshaler
interface.This commit implements the change to automatic scalar type detection, and removes the no longer necessary explicit passing of scalars.