import "github.com/99designs/gqlgen/example/scalars/model"
Lets redefine the base ID type to use an id from an external library
if the type referenced in .gqlgen.yml is a function that returns a marshaller we can use it to encode and decode onto any existing go type.
And the same for the unmarshaler
Unmarshal{Typename} is only required if the scalar appears as an input. The raw values have already been decoded from json into int/float64/bool/nil/map[string]interface/[]interface
Point is serialized as a simple array, eg [1, 2]
MarshalGQL implements the graphql.Marshaler interface
A custom enum that uses integers to represent the values in memory but serialize as string for graphql
type User struct { ID external.ObjectID Name string Created time.Time // direct binding to builtin types with external Marshal/Unmarshal methods Modified *time.Time // direct binding to builtin types with external Marshal/Unmarshal methods ValPrefs Prefs // external un/marshal that act on pointers PtrPrefs *Prefs IsBanned Banned Address Address Tier Tier }
Package model imports 8 packages (graph) and is imported by 2 packages. Updated 2020-09-03. Refresh now. Tools for package owners.