github.com/operandinc/gqlgen@v0.16.1/plugin/modelgen/out/generated.go (about)

     1  // Code generated by github.com/operandinc/gqlgen, DO NOT EDIT.
     2  
     3  package out
     4  
     5  import (
     6  	"fmt"
     7  	"io"
     8  	"strconv"
     9  )
    10  
    11  type FooBarer interface {
    12  	IsFooBarer()
    13  }
    14  
    15  // InterfaceWithDescription is an interface with a description
    16  type InterfaceWithDescription interface {
    17  	IsInterfaceWithDescription()
    18  }
    19  
    20  type MissingInterface interface {
    21  	IsMissingInterface()
    22  }
    23  
    24  type MissingUnion interface {
    25  	IsMissingUnion()
    26  }
    27  
    28  // UnionWithDescription is an union with a description
    29  type UnionWithDescription interface {
    30  	IsUnionWithDescription()
    31  }
    32  
    33  type FieldMutationHook struct {
    34  	Name     *string       `json:"name" anotherTag:"tag" database:"FieldMutationHookname"`
    35  	Enum     *ExistingEnum `json:"enum" yetAnotherTag:"12" database:"FieldMutationHookenum"`
    36  	NoVal    *string       `json:"noVal" yaml:"noVal" repeated:"true" database:"FieldMutationHooknoVal"`
    37  	Repeated *string       `json:"repeated" someTag:"value" repeated:"true" database:"FieldMutationHookrepeated"`
    38  }
    39  
    40  type MissingInput struct {
    41  	Name *string      `json:"name" database:"MissingInputname"`
    42  	Enum *MissingEnum `json:"enum" database:"MissingInputenum"`
    43  }
    44  
    45  type MissingTypeNotNull struct {
    46  	Name     string               `json:"name" database:"MissingTypeNotNullname"`
    47  	Enum     MissingEnum          `json:"enum" database:"MissingTypeNotNullenum"`
    48  	Int      MissingInterface     `json:"int" database:"MissingTypeNotNullint"`
    49  	Existing *ExistingType        `json:"existing" database:"MissingTypeNotNullexisting"`
    50  	Missing2 *MissingTypeNullable `json:"missing2" database:"MissingTypeNotNullmissing2"`
    51  }
    52  
    53  func (MissingTypeNotNull) IsMissingInterface()  {}
    54  func (MissingTypeNotNull) IsExistingInterface() {}
    55  func (MissingTypeNotNull) IsMissingUnion()      {}
    56  func (MissingTypeNotNull) IsExistingUnion()     {}
    57  
    58  type MissingTypeNullable struct {
    59  	Name     *string             `json:"name" database:"MissingTypeNullablename"`
    60  	Enum     *MissingEnum        `json:"enum" database:"MissingTypeNullableenum"`
    61  	Int      MissingInterface    `json:"int" database:"MissingTypeNullableint"`
    62  	Existing *ExistingType       `json:"existing" database:"MissingTypeNullableexisting"`
    63  	Missing2 *MissingTypeNotNull `json:"missing2" database:"MissingTypeNullablemissing2"`
    64  }
    65  
    66  func (MissingTypeNullable) IsMissingInterface()  {}
    67  func (MissingTypeNullable) IsExistingInterface() {}
    68  func (MissingTypeNullable) IsMissingUnion()      {}
    69  func (MissingTypeNullable) IsExistingUnion()     {}
    70  
    71  // TypeWithDescription is a type with a description
    72  type TypeWithDescription struct {
    73  	Name *string `json:"name" database:"TypeWithDescriptionname"`
    74  }
    75  
    76  func (TypeWithDescription) IsUnionWithDescription() {}
    77  
    78  type FooBarr struct {
    79  	Name string `json:"name" database:"_Foo_Barrname"`
    80  }
    81  
    82  func (FooBarr) IsFooBarer() {}
    83  
    84  // EnumWithDescription is an enum with a description
    85  type EnumWithDescription string
    86  
    87  const (
    88  	EnumWithDescriptionCat EnumWithDescription = "CAT"
    89  	EnumWithDescriptionDog EnumWithDescription = "DOG"
    90  )
    91  
    92  var AllEnumWithDescription = []EnumWithDescription{
    93  	EnumWithDescriptionCat,
    94  	EnumWithDescriptionDog,
    95  }
    96  
    97  func (e EnumWithDescription) IsValid() bool {
    98  	switch e {
    99  	case EnumWithDescriptionCat, EnumWithDescriptionDog:
   100  		return true
   101  	}
   102  	return false
   103  }
   104  
   105  func (e EnumWithDescription) String() string {
   106  	return string(e)
   107  }
   108  
   109  func (e *EnumWithDescription) UnmarshalGQL(v interface{}) error {
   110  	str, ok := v.(string)
   111  	if !ok {
   112  		return fmt.Errorf("enums must be strings")
   113  	}
   114  
   115  	*e = EnumWithDescription(str)
   116  	if !e.IsValid() {
   117  		return fmt.Errorf("%s is not a valid EnumWithDescription", str)
   118  	}
   119  	return nil
   120  }
   121  
   122  func (e EnumWithDescription) MarshalGQL(w io.Writer) {
   123  	fmt.Fprint(w, strconv.Quote(e.String()))
   124  }
   125  
   126  type MissingEnum string
   127  
   128  const (
   129  	MissingEnumHello   MissingEnum = "Hello"
   130  	MissingEnumGoodbye MissingEnum = "Goodbye"
   131  )
   132  
   133  var AllMissingEnum = []MissingEnum{
   134  	MissingEnumHello,
   135  	MissingEnumGoodbye,
   136  }
   137  
   138  func (e MissingEnum) IsValid() bool {
   139  	switch e {
   140  	case MissingEnumHello, MissingEnumGoodbye:
   141  		return true
   142  	}
   143  	return false
   144  }
   145  
   146  func (e MissingEnum) String() string {
   147  	return string(e)
   148  }
   149  
   150  func (e *MissingEnum) UnmarshalGQL(v interface{}) error {
   151  	str, ok := v.(string)
   152  	if !ok {
   153  		return fmt.Errorf("enums must be strings")
   154  	}
   155  
   156  	*e = MissingEnum(str)
   157  	if !e.IsValid() {
   158  		return fmt.Errorf("%s is not a valid MissingEnum", str)
   159  	}
   160  	return nil
   161  }
   162  
   163  func (e MissingEnum) MarshalGQL(w io.Writer) {
   164  	fmt.Fprint(w, strconv.Quote(e.String()))
   165  }