Add option to add custom parsing logic similar to json.Unmarshaler and json.Marshaler.
In my code I'd like to execute custom logic when decoding a struct but still have the struct beeing part of a query, which is currently not possible as far as i understand the code. When adding a UnmarshalJSON method to the struct it is excluded from the query.
A lot of libraries, such as json or bson allow doing so with the interfaces above.
I think an interface such as graphql.Unmarshaler would be really helpful.
My use case is the following:
func (ent *Entity) UnmarshalGraphql(data []byte) error {
type Alias Entity
dta := &Alias{}
err := graphql.UnmarshalGraphQL(data, dta)
if err != nil {
return err
}
*ent = Entity(*dta)
// Do some custom logic here
return nil
}
Add option to add custom parsing logic similar to
json.Unmarshaler
andjson.Marshaler
.In my code I'd like to execute custom logic when decoding a struct but still have the struct beeing part of a query, which is currently not possible as far as i understand the code. When adding a
UnmarshalJSON
method to the struct it is excluded from the query.A lot of libraries, such as
json
orbson
allow doing so with the interfaces above.I think an interface such as graphql.Unmarshaler would be really helpful.
My use case is the following: