acc-server/generated/graphql/model.go

74 lines
1.3 KiB
Go
Raw Normal View History

2022-06-10 12:52:39 +02:00
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
package graphql
import (
"fmt"
"io"
"strconv"
)
type Character interface {
IsCharacter()
}
type FriendsConnection struct {
TotalCount int `json:"totalCount"`
Friends []Character `json:"friends"`
}
type Human struct {
ID string `json:"id"`
Name string `json:"name"`
Friends []*Human `json:"friends"`
Height *Unit `json:"height"`
FriendsConnection *FriendsConnection `json:"friendsConnection"`
}
func (Human) IsCharacter() {}
type Unit struct {
Value float64 `json:"value"`
}
type LengthUnit string
const (
LengthUnitMeter LengthUnit = "Meter"
LengthUnitFeet LengthUnit = "Feet"
)
var AllLengthUnit = []LengthUnit{
LengthUnitMeter,
LengthUnitFeet,
}
func (e LengthUnit) IsValid() bool {
switch e {
case LengthUnitMeter, LengthUnitFeet:
return true
}
return false
}
func (e LengthUnit) String() string {
return string(e)
}
func (e *LengthUnit) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = LengthUnit(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid LengthUnit", str)
}
return nil
}
func (e LengthUnit) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}