mirror of https://github.com/dmarkham/enumer.git
Revert gqlgen file
This commit is contained in:
parent
53fc04b5b2
commit
b449598bff
17
gqlgen.go
17
gqlgen.go
|
@ -1,24 +1,23 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
// Arguments to format are:
|
// Arguments to format are:
|
||||||
//
|
|
||||||
// [1]: type name
|
// [1]: type name
|
||||||
const gqlgenMethods = `
|
const gqlgenMethods = `
|
||||||
// MarshalGQL implements the graphql.Marshaler interface for %[1]s
|
// MarshalGQL implements the graphql.Marshaler interface for %[1]s
|
||||||
func (i %[1]s) MarshalGQL(w io.Writer) {
|
func (i %[1]s) MarshalGQL(w io.Writer) {
|
||||||
fmt.Fprint(w, strconv.Quote(i.String()))
|
fmt.Fprint(w, strconv.Quote(i.String()))
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalGQL implements the graphql.Unmarshaler interface for %[1]s
|
// UnmarshalGQL implements the graphql.Unmarshaler interface for %[1]s
|
||||||
func (i *%[1]s) UnmarshalGQL(value interface{}) error {
|
func (i *%[1]s) UnmarshalGQL(value interface{}) error {
|
||||||
str, ok := value.(string)
|
str, ok := value.(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("%[1]s should be a string, got %%T", value)
|
return fmt.Errorf("%[1]s should be a string, got %%T", value)
|
||||||
}
|
}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
*i, err = %[1]sString(str)
|
*i, err = %[1]sString(str)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue