...

Source file src/github.com/99designs/gqlgen/codegen/testserver/followschema/validtypes.generated.go

Documentation: github.com/99designs/gqlgen/codegen/testserver/followschema

     1  // Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
     2  
     3  package followschema
     4  
     5  import (
     6  	"context"
     7  	"errors"
     8  	"fmt"
     9  	"strconv"
    10  	"sync/atomic"
    11  
    12  	"github.com/99designs/gqlgen/graphql"
    13  	"github.com/vektah/gqlparser/v2/ast"
    14  )
    15  
    16  // region    ************************** generated!.gotpl **************************
    17  
    18  // endregion ************************** generated!.gotpl **************************
    19  
    20  // region    ***************************** args.gotpl *****************************
    21  
    22  func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
    23  	var err error
    24  	args := map[string]interface{}{}
    25  	var arg0 string
    26  	if tmp, ok := rawArgs["break"]; ok {
    27  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("break"))
    28  		arg0, err = ec.unmarshalNString2string(ctx, tmp)
    29  		if err != nil {
    30  			return nil, err
    31  		}
    32  	}
    33  	args["break"] = arg0
    34  	var arg1 string
    35  	if tmp, ok := rawArgs["default"]; ok {
    36  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("default"))
    37  		arg1, err = ec.unmarshalNString2string(ctx, tmp)
    38  		if err != nil {
    39  			return nil, err
    40  		}
    41  	}
    42  	args["default"] = arg1
    43  	var arg2 string
    44  	if tmp, ok := rawArgs["func"]; ok {
    45  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("func"))
    46  		arg2, err = ec.unmarshalNString2string(ctx, tmp)
    47  		if err != nil {
    48  			return nil, err
    49  		}
    50  	}
    51  	args["func"] = arg2
    52  	var arg3 string
    53  	if tmp, ok := rawArgs["interface"]; ok {
    54  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("interface"))
    55  		arg3, err = ec.unmarshalNString2string(ctx, tmp)
    56  		if err != nil {
    57  			return nil, err
    58  		}
    59  	}
    60  	args["interface"] = arg3
    61  	var arg4 string
    62  	if tmp, ok := rawArgs["select"]; ok {
    63  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("select"))
    64  		arg4, err = ec.unmarshalNString2string(ctx, tmp)
    65  		if err != nil {
    66  			return nil, err
    67  		}
    68  	}
    69  	args["select"] = arg4
    70  	var arg5 string
    71  	if tmp, ok := rawArgs["case"]; ok {
    72  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("case"))
    73  		arg5, err = ec.unmarshalNString2string(ctx, tmp)
    74  		if err != nil {
    75  			return nil, err
    76  		}
    77  	}
    78  	args["case"] = arg5
    79  	var arg6 string
    80  	if tmp, ok := rawArgs["defer"]; ok {
    81  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("defer"))
    82  		arg6, err = ec.unmarshalNString2string(ctx, tmp)
    83  		if err != nil {
    84  			return nil, err
    85  		}
    86  	}
    87  	args["defer"] = arg6
    88  	var arg7 string
    89  	if tmp, ok := rawArgs["go"]; ok {
    90  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("go"))
    91  		arg7, err = ec.unmarshalNString2string(ctx, tmp)
    92  		if err != nil {
    93  			return nil, err
    94  		}
    95  	}
    96  	args["go"] = arg7
    97  	var arg8 string
    98  	if tmp, ok := rawArgs["map"]; ok {
    99  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("map"))
   100  		arg8, err = ec.unmarshalNString2string(ctx, tmp)
   101  		if err != nil {
   102  			return nil, err
   103  		}
   104  	}
   105  	args["map"] = arg8
   106  	var arg9 string
   107  	if tmp, ok := rawArgs["struct"]; ok {
   108  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("struct"))
   109  		arg9, err = ec.unmarshalNString2string(ctx, tmp)
   110  		if err != nil {
   111  			return nil, err
   112  		}
   113  	}
   114  	args["struct"] = arg9
   115  	var arg10 string
   116  	if tmp, ok := rawArgs["chan"]; ok {
   117  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("chan"))
   118  		arg10, err = ec.unmarshalNString2string(ctx, tmp)
   119  		if err != nil {
   120  			return nil, err
   121  		}
   122  	}
   123  	args["chan"] = arg10
   124  	var arg11 string
   125  	if tmp, ok := rawArgs["else"]; ok {
   126  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("else"))
   127  		arg11, err = ec.unmarshalNString2string(ctx, tmp)
   128  		if err != nil {
   129  			return nil, err
   130  		}
   131  	}
   132  	args["else"] = arg11
   133  	var arg12 string
   134  	if tmp, ok := rawArgs["goto"]; ok {
   135  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("goto"))
   136  		arg12, err = ec.unmarshalNString2string(ctx, tmp)
   137  		if err != nil {
   138  			return nil, err
   139  		}
   140  	}
   141  	args["goto"] = arg12
   142  	var arg13 string
   143  	if tmp, ok := rawArgs["package"]; ok {
   144  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("package"))
   145  		arg13, err = ec.unmarshalNString2string(ctx, tmp)
   146  		if err != nil {
   147  			return nil, err
   148  		}
   149  	}
   150  	args["package"] = arg13
   151  	var arg14 string
   152  	if tmp, ok := rawArgs["switch"]; ok {
   153  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("switch"))
   154  		arg14, err = ec.unmarshalNString2string(ctx, tmp)
   155  		if err != nil {
   156  			return nil, err
   157  		}
   158  	}
   159  	args["switch"] = arg14
   160  	var arg15 string
   161  	if tmp, ok := rawArgs["const"]; ok {
   162  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("const"))
   163  		arg15, err = ec.unmarshalNString2string(ctx, tmp)
   164  		if err != nil {
   165  			return nil, err
   166  		}
   167  	}
   168  	args["const"] = arg15
   169  	var arg16 string
   170  	if tmp, ok := rawArgs["fallthrough"]; ok {
   171  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("fallthrough"))
   172  		arg16, err = ec.unmarshalNString2string(ctx, tmp)
   173  		if err != nil {
   174  			return nil, err
   175  		}
   176  	}
   177  	args["fallthrough"] = arg16
   178  	var arg17 string
   179  	if tmp, ok := rawArgs["if"]; ok {
   180  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("if"))
   181  		arg17, err = ec.unmarshalNString2string(ctx, tmp)
   182  		if err != nil {
   183  			return nil, err
   184  		}
   185  	}
   186  	args["if"] = arg17
   187  	var arg18 string
   188  	if tmp, ok := rawArgs["range"]; ok {
   189  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("range"))
   190  		arg18, err = ec.unmarshalNString2string(ctx, tmp)
   191  		if err != nil {
   192  			return nil, err
   193  		}
   194  	}
   195  	args["range"] = arg18
   196  	var arg19 string
   197  	if tmp, ok := rawArgs["type"]; ok {
   198  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("type"))
   199  		arg19, err = ec.unmarshalNString2string(ctx, tmp)
   200  		if err != nil {
   201  			return nil, err
   202  		}
   203  	}
   204  	args["type"] = arg19
   205  	var arg20 string
   206  	if tmp, ok := rawArgs["continue"]; ok {
   207  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("continue"))
   208  		arg20, err = ec.unmarshalNString2string(ctx, tmp)
   209  		if err != nil {
   210  			return nil, err
   211  		}
   212  	}
   213  	args["continue"] = arg20
   214  	var arg21 string
   215  	if tmp, ok := rawArgs["for"]; ok {
   216  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("for"))
   217  		arg21, err = ec.unmarshalNString2string(ctx, tmp)
   218  		if err != nil {
   219  			return nil, err
   220  		}
   221  	}
   222  	args["for"] = arg21
   223  	var arg22 string
   224  	if tmp, ok := rawArgs["import"]; ok {
   225  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("import"))
   226  		arg22, err = ec.unmarshalNString2string(ctx, tmp)
   227  		if err != nil {
   228  			return nil, err
   229  		}
   230  	}
   231  	args["import"] = arg22
   232  	var arg23 string
   233  	if tmp, ok := rawArgs["return"]; ok {
   234  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("return"))
   235  		arg23, err = ec.unmarshalNString2string(ctx, tmp)
   236  		if err != nil {
   237  			return nil, err
   238  		}
   239  	}
   240  	args["return"] = arg23
   241  	var arg24 string
   242  	if tmp, ok := rawArgs["var"]; ok {
   243  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("var"))
   244  		arg24, err = ec.unmarshalNString2string(ctx, tmp)
   245  		if err != nil {
   246  			return nil, err
   247  		}
   248  	}
   249  	args["var"] = arg24
   250  	var arg25 string
   251  	if tmp, ok := rawArgs["_"]; ok {
   252  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("_"))
   253  		arg25, err = ec.unmarshalNString2string(ctx, tmp)
   254  		if err != nil {
   255  			return nil, err
   256  		}
   257  	}
   258  	args["_"] = arg25
   259  	return args, nil
   260  }
   261  
   262  func (ec *executionContext) field_ValidType_validInputKeywords_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
   263  	var err error
   264  	args := map[string]interface{}{}
   265  	var arg0 *ValidInput
   266  	if tmp, ok := rawArgs["input"]; ok {
   267  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input"))
   268  		arg0, err = ec.unmarshalOValidInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐValidInput(ctx, tmp)
   269  		if err != nil {
   270  			return nil, err
   271  		}
   272  	}
   273  	args["input"] = arg0
   274  	return args, nil
   275  }
   276  
   277  // endregion ***************************** args.gotpl *****************************
   278  
   279  // region    ************************** directives.gotpl **************************
   280  
   281  // endregion ************************** directives.gotpl **************************
   282  
   283  // region    **************************** field.gotpl *****************************
   284  
   285  func (ec *executionContext) _Content_Post_foo(ctx context.Context, field graphql.CollectedField, obj *ContentPost) (ret graphql.Marshaler) {
   286  	fc, err := ec.fieldContext_Content_Post_foo(ctx, field)
   287  	if err != nil {
   288  		return graphql.Null
   289  	}
   290  	ctx = graphql.WithFieldContext(ctx, fc)
   291  	defer func() {
   292  		if r := recover(); r != nil {
   293  			ec.Error(ctx, ec.Recover(ctx, r))
   294  			ret = graphql.Null
   295  		}
   296  	}()
   297  	resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
   298  		ctx = rctx // use context from middleware stack in children
   299  		return obj.Foo, nil
   300  	})
   301  
   302  	if resTmp == nil {
   303  		return graphql.Null
   304  	}
   305  	res := resTmp.(*string)
   306  	fc.Result = res
   307  	return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
   308  }
   309  
   310  func (ec *executionContext) fieldContext_Content_Post_foo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
   311  	fc = &graphql.FieldContext{
   312  		Object:     "Content_Post",
   313  		Field:      field,
   314  		IsMethod:   false,
   315  		IsResolver: false,
   316  		Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
   317  			return nil, errors.New("field of type String does not have child fields")
   318  		},
   319  	}
   320  	return fc, nil
   321  }
   322  
   323  func (ec *executionContext) _Content_User_foo(ctx context.Context, field graphql.CollectedField, obj *ContentUser) (ret graphql.Marshaler) {
   324  	fc, err := ec.fieldContext_Content_User_foo(ctx, field)
   325  	if err != nil {
   326  		return graphql.Null
   327  	}
   328  	ctx = graphql.WithFieldContext(ctx, fc)
   329  	defer func() {
   330  		if r := recover(); r != nil {
   331  			ec.Error(ctx, ec.Recover(ctx, r))
   332  			ret = graphql.Null
   333  		}
   334  	}()
   335  	resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
   336  		ctx = rctx // use context from middleware stack in children
   337  		return obj.Foo, nil
   338  	})
   339  
   340  	if resTmp == nil {
   341  		return graphql.Null
   342  	}
   343  	res := resTmp.(*string)
   344  	fc.Result = res
   345  	return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
   346  }
   347  
   348  func (ec *executionContext) fieldContext_Content_User_foo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
   349  	fc = &graphql.FieldContext{
   350  		Object:     "Content_User",
   351  		Field:      field,
   352  		IsMethod:   false,
   353  		IsResolver: false,
   354  		Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
   355  			return nil, errors.New("field of type String does not have child fields")
   356  		},
   357  	}
   358  	return fc, nil
   359  }
   360  
   361  func (ec *executionContext) _ValidType_differentCase(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) {
   362  	fc, err := ec.fieldContext_ValidType_differentCase(ctx, field)
   363  	if err != nil {
   364  		return graphql.Null
   365  	}
   366  	ctx = graphql.WithFieldContext(ctx, fc)
   367  	defer func() {
   368  		if r := recover(); r != nil {
   369  			ec.Error(ctx, ec.Recover(ctx, r))
   370  			ret = graphql.Null
   371  		}
   372  	}()
   373  	resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
   374  		ctx = rctx // use context from middleware stack in children
   375  		return obj.DifferentCase, nil
   376  	})
   377  
   378  	if resTmp == nil {
   379  		if !graphql.HasFieldError(ctx, fc) {
   380  			ec.Errorf(ctx, "must not be null")
   381  		}
   382  		return graphql.Null
   383  	}
   384  	res := resTmp.(string)
   385  	fc.Result = res
   386  	return ec.marshalNString2string(ctx, field.Selections, res)
   387  }
   388  
   389  func (ec *executionContext) fieldContext_ValidType_differentCase(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
   390  	fc = &graphql.FieldContext{
   391  		Object:     "ValidType",
   392  		Field:      field,
   393  		IsMethod:   false,
   394  		IsResolver: false,
   395  		Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
   396  			return nil, errors.New("field of type String does not have child fields")
   397  		},
   398  	}
   399  	return fc, nil
   400  }
   401  
   402  func (ec *executionContext) _ValidType_different_case(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) {
   403  	fc, err := ec.fieldContext_ValidType_different_case(ctx, field)
   404  	if err != nil {
   405  		return graphql.Null
   406  	}
   407  	ctx = graphql.WithFieldContext(ctx, fc)
   408  	defer func() {
   409  		if r := recover(); r != nil {
   410  			ec.Error(ctx, ec.Recover(ctx, r))
   411  			ret = graphql.Null
   412  		}
   413  	}()
   414  	resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
   415  		ctx = rctx // use context from middleware stack in children
   416  		return obj.DifferentCaseOld, nil
   417  	})
   418  
   419  	if resTmp == nil {
   420  		if !graphql.HasFieldError(ctx, fc) {
   421  			ec.Errorf(ctx, "must not be null")
   422  		}
   423  		return graphql.Null
   424  	}
   425  	res := resTmp.(string)
   426  	fc.Result = res
   427  	return ec.marshalNString2string(ctx, field.Selections, res)
   428  }
   429  
   430  func (ec *executionContext) fieldContext_ValidType_different_case(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
   431  	fc = &graphql.FieldContext{
   432  		Object:     "ValidType",
   433  		Field:      field,
   434  		IsMethod:   false,
   435  		IsResolver: false,
   436  		Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
   437  			return nil, errors.New("field of type String does not have child fields")
   438  		},
   439  	}
   440  	return fc, nil
   441  }
   442  
   443  func (ec *executionContext) _ValidType_validInputKeywords(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) {
   444  	fc, err := ec.fieldContext_ValidType_validInputKeywords(ctx, field)
   445  	if err != nil {
   446  		return graphql.Null
   447  	}
   448  	ctx = graphql.WithFieldContext(ctx, fc)
   449  	defer func() {
   450  		if r := recover(); r != nil {
   451  			ec.Error(ctx, ec.Recover(ctx, r))
   452  			ret = graphql.Null
   453  		}
   454  	}()
   455  	resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
   456  		ctx = rctx // use context from middleware stack in children
   457  		return obj.ValidInputKeywords, nil
   458  	})
   459  
   460  	if resTmp == nil {
   461  		if !graphql.HasFieldError(ctx, fc) {
   462  			ec.Errorf(ctx, "must not be null")
   463  		}
   464  		return graphql.Null
   465  	}
   466  	res := resTmp.(bool)
   467  	fc.Result = res
   468  	return ec.marshalNBoolean2bool(ctx, field.Selections, res)
   469  }
   470  
   471  func (ec *executionContext) fieldContext_ValidType_validInputKeywords(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
   472  	fc = &graphql.FieldContext{
   473  		Object:     "ValidType",
   474  		Field:      field,
   475  		IsMethod:   false,
   476  		IsResolver: false,
   477  		Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
   478  			return nil, errors.New("field of type Boolean does not have child fields")
   479  		},
   480  	}
   481  	defer func() {
   482  		if r := recover(); r != nil {
   483  			err = ec.Recover(ctx, r)
   484  			ec.Error(ctx, err)
   485  		}
   486  	}()
   487  	ctx = graphql.WithFieldContext(ctx, fc)
   488  	if fc.Args, err = ec.field_ValidType_validInputKeywords_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
   489  		ec.Error(ctx, err)
   490  		return fc, err
   491  	}
   492  	return fc, nil
   493  }
   494  
   495  func (ec *executionContext) _ValidType_validArgs(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) {
   496  	fc, err := ec.fieldContext_ValidType_validArgs(ctx, field)
   497  	if err != nil {
   498  		return graphql.Null
   499  	}
   500  	ctx = graphql.WithFieldContext(ctx, fc)
   501  	defer func() {
   502  		if r := recover(); r != nil {
   503  			ec.Error(ctx, ec.Recover(ctx, r))
   504  			ret = graphql.Null
   505  		}
   506  	}()
   507  	resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
   508  		ctx = rctx // use context from middleware stack in children
   509  		return obj.ValidArgs, nil
   510  	})
   511  
   512  	if resTmp == nil {
   513  		if !graphql.HasFieldError(ctx, fc) {
   514  			ec.Errorf(ctx, "must not be null")
   515  		}
   516  		return graphql.Null
   517  	}
   518  	res := resTmp.(bool)
   519  	fc.Result = res
   520  	return ec.marshalNBoolean2bool(ctx, field.Selections, res)
   521  }
   522  
   523  func (ec *executionContext) fieldContext_ValidType_validArgs(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
   524  	fc = &graphql.FieldContext{
   525  		Object:     "ValidType",
   526  		Field:      field,
   527  		IsMethod:   false,
   528  		IsResolver: false,
   529  		Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
   530  			return nil, errors.New("field of type Boolean does not have child fields")
   531  		},
   532  	}
   533  	defer func() {
   534  		if r := recover(); r != nil {
   535  			err = ec.Recover(ctx, r)
   536  			ec.Error(ctx, err)
   537  		}
   538  	}()
   539  	ctx = graphql.WithFieldContext(ctx, fc)
   540  	if fc.Args, err = ec.field_ValidType_validArgs_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
   541  		ec.Error(ctx, err)
   542  		return fc, err
   543  	}
   544  	return fc, nil
   545  }
   546  
   547  // endregion **************************** field.gotpl *****************************
   548  
   549  // region    **************************** input.gotpl *****************************
   550  
   551  func (ec *executionContext) unmarshalInputValidInput(ctx context.Context, obj interface{}) (ValidInput, error) {
   552  	var it ValidInput
   553  	asMap := map[string]interface{}{}
   554  	for k, v := range obj.(map[string]interface{}) {
   555  		asMap[k] = v
   556  	}
   557  
   558  	fieldsInOrder := [...]string{"break", "default", "func", "interface", "select", "case", "defer", "go", "map", "struct", "chan", "else", "goto", "package", "switch", "const", "fallthrough", "if", "range", "type", "continue", "for", "import", "return", "var", "_"}
   559  	for _, k := range fieldsInOrder {
   560  		v, ok := asMap[k]
   561  		if !ok {
   562  			continue
   563  		}
   564  		switch k {
   565  		case "break":
   566  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("break"))
   567  			data, err := ec.unmarshalNString2string(ctx, v)
   568  			if err != nil {
   569  				return it, err
   570  			}
   571  			it.Break = data
   572  		case "default":
   573  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("default"))
   574  			data, err := ec.unmarshalNString2string(ctx, v)
   575  			if err != nil {
   576  				return it, err
   577  			}
   578  			it.Default = data
   579  		case "func":
   580  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("func"))
   581  			data, err := ec.unmarshalNString2string(ctx, v)
   582  			if err != nil {
   583  				return it, err
   584  			}
   585  			it.Func = data
   586  		case "interface":
   587  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("interface"))
   588  			data, err := ec.unmarshalNString2string(ctx, v)
   589  			if err != nil {
   590  				return it, err
   591  			}
   592  			it.Interface = data
   593  		case "select":
   594  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("select"))
   595  			data, err := ec.unmarshalNString2string(ctx, v)
   596  			if err != nil {
   597  				return it, err
   598  			}
   599  			it.Select = data
   600  		case "case":
   601  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("case"))
   602  			data, err := ec.unmarshalNString2string(ctx, v)
   603  			if err != nil {
   604  				return it, err
   605  			}
   606  			it.Case = data
   607  		case "defer":
   608  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("defer"))
   609  			data, err := ec.unmarshalNString2string(ctx, v)
   610  			if err != nil {
   611  				return it, err
   612  			}
   613  			it.Defer = data
   614  		case "go":
   615  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("go"))
   616  			data, err := ec.unmarshalNString2string(ctx, v)
   617  			if err != nil {
   618  				return it, err
   619  			}
   620  			it.Go = data
   621  		case "map":
   622  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("map"))
   623  			data, err := ec.unmarshalNString2string(ctx, v)
   624  			if err != nil {
   625  				return it, err
   626  			}
   627  			it.Map = data
   628  		case "struct":
   629  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("struct"))
   630  			data, err := ec.unmarshalNString2string(ctx, v)
   631  			if err != nil {
   632  				return it, err
   633  			}
   634  			it.Struct = data
   635  		case "chan":
   636  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("chan"))
   637  			data, err := ec.unmarshalNString2string(ctx, v)
   638  			if err != nil {
   639  				return it, err
   640  			}
   641  			it.Chan = data
   642  		case "else":
   643  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("else"))
   644  			data, err := ec.unmarshalNString2string(ctx, v)
   645  			if err != nil {
   646  				return it, err
   647  			}
   648  			it.Else = data
   649  		case "goto":
   650  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("goto"))
   651  			data, err := ec.unmarshalNString2string(ctx, v)
   652  			if err != nil {
   653  				return it, err
   654  			}
   655  			it.Goto = data
   656  		case "package":
   657  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("package"))
   658  			data, err := ec.unmarshalNString2string(ctx, v)
   659  			if err != nil {
   660  				return it, err
   661  			}
   662  			it.Package = data
   663  		case "switch":
   664  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("switch"))
   665  			data, err := ec.unmarshalNString2string(ctx, v)
   666  			if err != nil {
   667  				return it, err
   668  			}
   669  			it.Switch = data
   670  		case "const":
   671  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("const"))
   672  			data, err := ec.unmarshalNString2string(ctx, v)
   673  			if err != nil {
   674  				return it, err
   675  			}
   676  			it.Const = data
   677  		case "fallthrough":
   678  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("fallthrough"))
   679  			data, err := ec.unmarshalNString2string(ctx, v)
   680  			if err != nil {
   681  				return it, err
   682  			}
   683  			it.Fallthrough = data
   684  		case "if":
   685  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("if"))
   686  			data, err := ec.unmarshalNString2string(ctx, v)
   687  			if err != nil {
   688  				return it, err
   689  			}
   690  			it.If = data
   691  		case "range":
   692  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("range"))
   693  			data, err := ec.unmarshalNString2string(ctx, v)
   694  			if err != nil {
   695  				return it, err
   696  			}
   697  			it.Range = data
   698  		case "type":
   699  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("type"))
   700  			data, err := ec.unmarshalNString2string(ctx, v)
   701  			if err != nil {
   702  				return it, err
   703  			}
   704  			it.Type = data
   705  		case "continue":
   706  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("continue"))
   707  			data, err := ec.unmarshalNString2string(ctx, v)
   708  			if err != nil {
   709  				return it, err
   710  			}
   711  			it.Continue = data
   712  		case "for":
   713  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("for"))
   714  			data, err := ec.unmarshalNString2string(ctx, v)
   715  			if err != nil {
   716  				return it, err
   717  			}
   718  			it.For = data
   719  		case "import":
   720  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("import"))
   721  			data, err := ec.unmarshalNString2string(ctx, v)
   722  			if err != nil {
   723  				return it, err
   724  			}
   725  			it.Import = data
   726  		case "return":
   727  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("return"))
   728  			data, err := ec.unmarshalNString2string(ctx, v)
   729  			if err != nil {
   730  				return it, err
   731  			}
   732  			it.Return = data
   733  		case "var":
   734  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("var"))
   735  			data, err := ec.unmarshalNString2string(ctx, v)
   736  			if err != nil {
   737  				return it, err
   738  			}
   739  			it.Var = data
   740  		case "_":
   741  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("_"))
   742  			data, err := ec.unmarshalNString2string(ctx, v)
   743  			if err != nil {
   744  				return it, err
   745  			}
   746  			it.Underscore = data
   747  		}
   748  	}
   749  
   750  	return it, nil
   751  }
   752  
   753  // endregion **************************** input.gotpl *****************************
   754  
   755  // region    ************************** interface.gotpl ***************************
   756  
   757  func (ec *executionContext) _Content_Child(ctx context.Context, sel ast.SelectionSet, obj ContentChild) graphql.Marshaler {
   758  	switch obj := (obj).(type) {
   759  	case nil:
   760  		return graphql.Null
   761  	case ContentUser:
   762  		return ec._Content_User(ctx, sel, &obj)
   763  	case *ContentUser:
   764  		if obj == nil {
   765  			return graphql.Null
   766  		}
   767  		return ec._Content_User(ctx, sel, obj)
   768  	case ContentPost:
   769  		return ec._Content_Post(ctx, sel, &obj)
   770  	case *ContentPost:
   771  		if obj == nil {
   772  			return graphql.Null
   773  		}
   774  		return ec._Content_Post(ctx, sel, obj)
   775  	default:
   776  		panic(fmt.Errorf("unexpected type %T", obj))
   777  	}
   778  }
   779  
   780  // endregion ************************** interface.gotpl ***************************
   781  
   782  // region    **************************** object.gotpl ****************************
   783  
   784  var content_PostImplementors = []string{"Content_Post", "Content_Child"}
   785  
   786  func (ec *executionContext) _Content_Post(ctx context.Context, sel ast.SelectionSet, obj *ContentPost) graphql.Marshaler {
   787  	fields := graphql.CollectFields(ec.OperationContext, sel, content_PostImplementors)
   788  
   789  	out := graphql.NewFieldSet(fields)
   790  	deferred := make(map[string]*graphql.FieldSet)
   791  	for i, field := range fields {
   792  		switch field.Name {
   793  		case "__typename":
   794  			out.Values[i] = graphql.MarshalString("Content_Post")
   795  		case "foo":
   796  			out.Values[i] = ec._Content_Post_foo(ctx, field, obj)
   797  		default:
   798  			panic("unknown field " + strconv.Quote(field.Name))
   799  		}
   800  	}
   801  	out.Dispatch(ctx)
   802  	if out.Invalids > 0 {
   803  		return graphql.Null
   804  	}
   805  
   806  	atomic.AddInt32(&ec.deferred, int32(len(deferred)))
   807  
   808  	for label, dfs := range deferred {
   809  		ec.processDeferredGroup(graphql.DeferredGroup{
   810  			Label:    label,
   811  			Path:     graphql.GetPath(ctx),
   812  			FieldSet: dfs,
   813  			Context:  ctx,
   814  		})
   815  	}
   816  
   817  	return out
   818  }
   819  
   820  var content_UserImplementors = []string{"Content_User", "Content_Child"}
   821  
   822  func (ec *executionContext) _Content_User(ctx context.Context, sel ast.SelectionSet, obj *ContentUser) graphql.Marshaler {
   823  	fields := graphql.CollectFields(ec.OperationContext, sel, content_UserImplementors)
   824  
   825  	out := graphql.NewFieldSet(fields)
   826  	deferred := make(map[string]*graphql.FieldSet)
   827  	for i, field := range fields {
   828  		switch field.Name {
   829  		case "__typename":
   830  			out.Values[i] = graphql.MarshalString("Content_User")
   831  		case "foo":
   832  			out.Values[i] = ec._Content_User_foo(ctx, field, obj)
   833  		default:
   834  			panic("unknown field " + strconv.Quote(field.Name))
   835  		}
   836  	}
   837  	out.Dispatch(ctx)
   838  	if out.Invalids > 0 {
   839  		return graphql.Null
   840  	}
   841  
   842  	atomic.AddInt32(&ec.deferred, int32(len(deferred)))
   843  
   844  	for label, dfs := range deferred {
   845  		ec.processDeferredGroup(graphql.DeferredGroup{
   846  			Label:    label,
   847  			Path:     graphql.GetPath(ctx),
   848  			FieldSet: dfs,
   849  			Context:  ctx,
   850  		})
   851  	}
   852  
   853  	return out
   854  }
   855  
   856  var validTypeImplementors = []string{"ValidType"}
   857  
   858  func (ec *executionContext) _ValidType(ctx context.Context, sel ast.SelectionSet, obj *ValidType) graphql.Marshaler {
   859  	fields := graphql.CollectFields(ec.OperationContext, sel, validTypeImplementors)
   860  
   861  	out := graphql.NewFieldSet(fields)
   862  	deferred := make(map[string]*graphql.FieldSet)
   863  	for i, field := range fields {
   864  		switch field.Name {
   865  		case "__typename":
   866  			out.Values[i] = graphql.MarshalString("ValidType")
   867  		case "differentCase":
   868  			out.Values[i] = ec._ValidType_differentCase(ctx, field, obj)
   869  			if out.Values[i] == graphql.Null {
   870  				out.Invalids++
   871  			}
   872  		case "different_case":
   873  			out.Values[i] = ec._ValidType_different_case(ctx, field, obj)
   874  			if out.Values[i] == graphql.Null {
   875  				out.Invalids++
   876  			}
   877  		case "validInputKeywords":
   878  			out.Values[i] = ec._ValidType_validInputKeywords(ctx, field, obj)
   879  			if out.Values[i] == graphql.Null {
   880  				out.Invalids++
   881  			}
   882  		case "validArgs":
   883  			out.Values[i] = ec._ValidType_validArgs(ctx, field, obj)
   884  			if out.Values[i] == graphql.Null {
   885  				out.Invalids++
   886  			}
   887  		default:
   888  			panic("unknown field " + strconv.Quote(field.Name))
   889  		}
   890  	}
   891  	out.Dispatch(ctx)
   892  	if out.Invalids > 0 {
   893  		return graphql.Null
   894  	}
   895  
   896  	atomic.AddInt32(&ec.deferred, int32(len(deferred)))
   897  
   898  	for label, dfs := range deferred {
   899  		ec.processDeferredGroup(graphql.DeferredGroup{
   900  			Label:    label,
   901  			Path:     graphql.GetPath(ctx),
   902  			FieldSet: dfs,
   903  			Context:  ctx,
   904  		})
   905  	}
   906  
   907  	return out
   908  }
   909  
   910  // endregion **************************** object.gotpl ****************************
   911  
   912  // region    ***************************** type.gotpl *****************************
   913  
   914  func (ec *executionContext) unmarshalOValidInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐValidInput(ctx context.Context, v interface{}) (*ValidInput, error) {
   915  	if v == nil {
   916  		return nil, nil
   917  	}
   918  	res, err := ec.unmarshalInputValidInput(ctx, v)
   919  	return &res, graphql.ErrorOnPath(ctx, err)
   920  }
   921  
   922  func (ec *executionContext) marshalOValidType2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐValidType(ctx context.Context, sel ast.SelectionSet, v *ValidType) graphql.Marshaler {
   923  	if v == nil {
   924  		return graphql.Null
   925  	}
   926  	return ec._ValidType(ctx, sel, v)
   927  }
   928  
   929  // endregion ***************************** type.gotpl *****************************
   930  

View as plain text