1package bug
2
3import (
4 "fmt"
5 "io"
6)
7
8type Label string
9
10func (l Label) String() string {
11 return string(l)
12}
13
14// UnmarshalGQL implements the graphql.Unmarshaler interface
15func (l *Label) UnmarshalGQL(v interface{}) error {
16 _, ok := v.(string)
17 if !ok {
18 return fmt.Errorf("labels must be strings")
19 }
20
21 *l = v.(Label)
22
23 return nil
24}
25
26// MarshalGQL implements the graphql.Marshaler interface
27func (l Label) MarshalGQL(w io.Writer) {
28 w.Write([]byte(`"` + l.String() + `"`))
29}