github.com/operandinc/gqlgen@v0.16.1/codegen/testserver/followschema/models-gen.go (about)

     1  // Code generated by github.com/operandinc/gqlgen, DO NOT EDIT.
     2  
     3  package followschema
     4  
     5  import (
     6  	"fmt"
     7  	"io"
     8  	"strconv"
     9  	"time"
    10  )
    11  
    12  type Animal interface {
    13  	IsAnimal()
    14  }
    15  
    16  type ContentChild interface {
    17  	IsContentChild()
    18  }
    19  
    20  type TestUnion interface {
    21  	IsTestUnion()
    22  }
    23  
    24  type A struct {
    25  	ID string `json:"id"`
    26  }
    27  
    28  func (A) IsTestUnion() {}
    29  
    30  type AIt struct {
    31  	ID string `json:"id"`
    32  }
    33  
    34  type AbIt struct {
    35  	ID string `json:"id"`
    36  }
    37  
    38  type B struct {
    39  	ID string `json:"id"`
    40  }
    41  
    42  func (B) IsTestUnion() {}
    43  
    44  type Cat struct {
    45  	Species  string `json:"species"`
    46  	CatBreed string `json:"catBreed"`
    47  }
    48  
    49  func (Cat) IsAnimal() {}
    50  
    51  type CheckIssue896 struct {
    52  	ID *int `json:"id"`
    53  }
    54  
    55  type ContentPost struct {
    56  	Foo *string `json:"foo"`
    57  }
    58  
    59  func (ContentPost) IsContentChild() {}
    60  
    61  type ContentUser struct {
    62  	Foo *string `json:"foo"`
    63  }
    64  
    65  func (ContentUser) IsContentChild() {}
    66  
    67  type Coordinates struct {
    68  	X float64 `json:"x"`
    69  	Y float64 `json:"y"`
    70  }
    71  
    72  type DefaultInput struct {
    73  	FalsyBoolean  *bool `json:"falsyBoolean"`
    74  	TruthyBoolean *bool `json:"truthyBoolean"`
    75  }
    76  
    77  type DefaultParametersMirror struct {
    78  	FalsyBoolean  *bool `json:"falsyBoolean"`
    79  	TruthyBoolean *bool `json:"truthyBoolean"`
    80  }
    81  
    82  type Dog struct {
    83  	Species  string `json:"species"`
    84  	DogBreed string `json:"dogBreed"`
    85  }
    86  
    87  func (Dog) IsAnimal() {}
    88  
    89  type EmbeddedDefaultScalar struct {
    90  	Value *string `json:"value"`
    91  }
    92  
    93  type InnerDirectives struct {
    94  	Message string `json:"message"`
    95  }
    96  
    97  type InnerInput struct {
    98  	ID int `json:"id"`
    99  }
   100  
   101  type InnerObject struct {
   102  	ID int `json:"id"`
   103  }
   104  
   105  type InputDirectives struct {
   106  	Text          string           `json:"text"`
   107  	NullableText  *string          `json:"nullableText"`
   108  	Inner         *InnerDirectives `json:"inner"`
   109  	InnerNullable *InnerDirectives `json:"innerNullable"`
   110  	ThirdParty    *ThirdParty      `json:"thirdParty"`
   111  }
   112  
   113  type InputWithEnumValue struct {
   114  	Enum EnumTest `json:"enum"`
   115  }
   116  
   117  type LoopA struct {
   118  	B *LoopB `json:"b"`
   119  }
   120  
   121  type LoopB struct {
   122  	A *LoopA `json:"a"`
   123  }
   124  
   125  // Since gqlgen defines default implementation for a Map scalar, this tests that the builtin is _not_
   126  // added to the TypeMap
   127  type Map struct {
   128  	ID string `json:"id"`
   129  }
   130  
   131  type NestedInput struct {
   132  	Field Email `json:"field"`
   133  }
   134  
   135  type NestedMapInput struct {
   136  	Map map[string]interface{} `json:"map"`
   137  }
   138  
   139  type ObjectDirectives struct {
   140  	Text         string   `json:"text"`
   141  	NullableText *string  `json:"nullableText"`
   142  	Order        []string `json:"order"`
   143  }
   144  
   145  type OuterInput struct {
   146  	Inner *InnerInput `json:"inner"`
   147  }
   148  
   149  type OuterObject struct {
   150  	Inner *InnerObject `json:"inner"`
   151  }
   152  
   153  type Slices struct {
   154  	Test1 []*string `json:"test1"`
   155  	Test2 []string  `json:"test2"`
   156  	Test3 []*string `json:"test3"`
   157  	Test4 []string  `json:"test4"`
   158  }
   159  
   160  type SpecialInput struct {
   161  	Nesting *NestedInput `json:"nesting"`
   162  }
   163  
   164  type User struct {
   165  	ID      int        `json:"id"`
   166  	Friends []*User    `json:"friends"`
   167  	Created time.Time  `json:"created"`
   168  	Updated *time.Time `json:"updated"`
   169  }
   170  
   171  type ValidInput struct {
   172  	Break       string `json:"break"`
   173  	Default     string `json:"default"`
   174  	Func        string `json:"func"`
   175  	Interface   string `json:"interface"`
   176  	Select      string `json:"select"`
   177  	Case        string `json:"case"`
   178  	Defer       string `json:"defer"`
   179  	Go          string `json:"go"`
   180  	Map         string `json:"map"`
   181  	Struct      string `json:"struct"`
   182  	Chan        string `json:"chan"`
   183  	Else        string `json:"else"`
   184  	Goto        string `json:"goto"`
   185  	Package     string `json:"package"`
   186  	Switch      string `json:"switch"`
   187  	Const       string `json:"const"`
   188  	Fallthrough string `json:"fallthrough"`
   189  	If          string `json:"if"`
   190  	Range       string `json:"range"`
   191  	Type        string `json:"type"`
   192  	Continue    string `json:"continue"`
   193  	For         string `json:"for"`
   194  	Import      string `json:"import"`
   195  	Return      string `json:"return"`
   196  	Var         string `json:"var"`
   197  	Underscore  string `json:"_"`
   198  }
   199  
   200  //  These things are all valid, but without care generate invalid go code
   201  type ValidType struct {
   202  	DifferentCase      string `json:"differentCase"`
   203  	DifferentCaseOld   string `json:"different_case"`
   204  	ValidInputKeywords bool   `json:"validInputKeywords"`
   205  	ValidArgs          bool   `json:"validArgs"`
   206  }
   207  
   208  type XXIt struct {
   209  	ID string `json:"id"`
   210  }
   211  
   212  type XxIt struct {
   213  	ID string `json:"id"`
   214  }
   215  
   216  type AsdfIt struct {
   217  	ID string `json:"id"`
   218  }
   219  
   220  type IIt struct {
   221  	ID string `json:"id"`
   222  }
   223  
   224  type EnumTest string
   225  
   226  const (
   227  	EnumTestOk EnumTest = "OK"
   228  	EnumTestNg EnumTest = "NG"
   229  )
   230  
   231  var AllEnumTest = []EnumTest{
   232  	EnumTestOk,
   233  	EnumTestNg,
   234  }
   235  
   236  func (e EnumTest) IsValid() bool {
   237  	switch e {
   238  	case EnumTestOk, EnumTestNg:
   239  		return true
   240  	}
   241  	return false
   242  }
   243  
   244  func (e EnumTest) String() string {
   245  	return string(e)
   246  }
   247  
   248  func (e *EnumTest) UnmarshalGQL(v interface{}) error {
   249  	str, ok := v.(string)
   250  	if !ok {
   251  		return fmt.Errorf("enums must be strings")
   252  	}
   253  
   254  	*e = EnumTest(str)
   255  	if !e.IsValid() {
   256  		return fmt.Errorf("%s is not a valid EnumTest", str)
   257  	}
   258  	return nil
   259  }
   260  
   261  func (e EnumTest) MarshalGQL(w io.Writer) {
   262  	fmt.Fprint(w, strconv.Quote(e.String()))
   263  }
   264  
   265  type Status string
   266  
   267  const (
   268  	StatusOk    Status = "OK"
   269  	StatusError Status = "ERROR"
   270  )
   271  
   272  var AllStatus = []Status{
   273  	StatusOk,
   274  	StatusError,
   275  }
   276  
   277  func (e Status) IsValid() bool {
   278  	switch e {
   279  	case StatusOk, StatusError:
   280  		return true
   281  	}
   282  	return false
   283  }
   284  
   285  func (e Status) String() string {
   286  	return string(e)
   287  }
   288  
   289  func (e *Status) UnmarshalGQL(v interface{}) error {
   290  	str, ok := v.(string)
   291  	if !ok {
   292  		return fmt.Errorf("enums must be strings")
   293  	}
   294  
   295  	*e = Status(str)
   296  	if !e.IsValid() {
   297  		return fmt.Errorf("%s is not a valid Status", str)
   298  	}
   299  	return nil
   300  }
   301  
   302  func (e Status) MarshalGQL(w io.Writer) {
   303  	fmt.Fprint(w, strconv.Quote(e.String()))
   304  }