1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
package graphql import ( "encoding/json" "io" ) func MarshalAny(v interface{}) Marshaler { return WriterFunc(func(w io.Writer) { err := json.NewEncoder(w).Encode(v) if err != nil { panic(err) } }) } func UnmarshalAny(v interface{}) (interface{}, error) { return v, nil }