Files
core/http/graph/scalars/uint64.go
Jan Stabenow 9c0b535199 Add v16.7.2
2022-05-13 19:26:45 +02:00

26 lines
432 B
Go

package scalars
import (
"fmt"
"io"
)
type Uint64 uint64
// UnmarshalGQL implements the graphql.Unmarshaler interface
func (u *Uint64) UnmarshalGQL(v interface{}) error {
value, ok := v.(uint64)
if !ok {
return fmt.Errorf("Uint64 must be a uint64")
}
*u = Uint64(value)
return nil
}
// MarshalGQL implements the graphql.Marshaler interface
func (u Uint64) MarshalGQL(w io.Writer) {
fmt.Fprintf(w, "%d", uint64(u))
}