...
1 package followschema
2
3 import (
4 "io"
5 "strconv"
6 )
7
8 type MapNested struct {
9 Value CustomScalar
10 }
11
12 type CustomScalar struct {
13 value int64
14 }
15
16 func (s *CustomScalar) UnmarshalGQL(v interface{}) (err error) {
17 switch v := v.(type) {
18 case string:
19 s.value, err = strconv.ParseInt(v, 10, 64)
20 case int64:
21 s.value = v
22 }
23 return
24 }
25
26 func (s CustomScalar) MarshalGQL(w io.Writer) {
27 _, _ = w.Write([]byte(strconv.Quote(strconv.FormatInt(s.value, 10))))
28 }
29
View as plain text