...

Source file src/github.com/99designs/gqlgen/codegen/testserver/followschema/directive.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) dir_length_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
    23  	var err error
    24  	args := map[string]interface{}{}
    25  	var arg0 int
    26  	if tmp, ok := rawArgs["min"]; ok {
    27  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("min"))
    28  		arg0, err = ec.unmarshalNInt2int(ctx, tmp)
    29  		if err != nil {
    30  			return nil, err
    31  		}
    32  	}
    33  	args["min"] = arg0
    34  	var arg1 *int
    35  	if tmp, ok := rawArgs["max"]; ok {
    36  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("max"))
    37  		arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
    38  		if err != nil {
    39  			return nil, err
    40  		}
    41  	}
    42  	args["max"] = arg1
    43  	var arg2 *string
    44  	if tmp, ok := rawArgs["message"]; ok {
    45  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("message"))
    46  		arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp)
    47  		if err != nil {
    48  			return nil, err
    49  		}
    50  	}
    51  	args["message"] = arg2
    52  	return args, nil
    53  }
    54  
    55  func (ec *executionContext) dir_logged_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
    56  	var err error
    57  	args := map[string]interface{}{}
    58  	var arg0 string
    59  	if tmp, ok := rawArgs["id"]; ok {
    60  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id"))
    61  		arg0, err = ec.unmarshalNUUID2string(ctx, tmp)
    62  		if err != nil {
    63  			return nil, err
    64  		}
    65  	}
    66  	args["id"] = arg0
    67  	return args, nil
    68  }
    69  
    70  func (ec *executionContext) dir_order1_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
    71  	var err error
    72  	args := map[string]interface{}{}
    73  	var arg0 string
    74  	if tmp, ok := rawArgs["location"]; ok {
    75  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("location"))
    76  		arg0, err = ec.unmarshalNString2string(ctx, tmp)
    77  		if err != nil {
    78  			return nil, err
    79  		}
    80  	}
    81  	args["location"] = arg0
    82  	return args, nil
    83  }
    84  
    85  func (ec *executionContext) dir_order2_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
    86  	var err error
    87  	args := map[string]interface{}{}
    88  	var arg0 string
    89  	if tmp, ok := rawArgs["location"]; ok {
    90  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("location"))
    91  		arg0, err = ec.unmarshalNString2string(ctx, tmp)
    92  		if err != nil {
    93  			return nil, err
    94  		}
    95  	}
    96  	args["location"] = arg0
    97  	return args, nil
    98  }
    99  
   100  func (ec *executionContext) dir_range_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
   101  	var err error
   102  	args := map[string]interface{}{}
   103  	var arg0 *int
   104  	if tmp, ok := rawArgs["min"]; ok {
   105  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("min"))
   106  		arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
   107  		if err != nil {
   108  			return nil, err
   109  		}
   110  	}
   111  	args["min"] = arg0
   112  	var arg1 *int
   113  	if tmp, ok := rawArgs["max"]; ok {
   114  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("max"))
   115  		arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp)
   116  		if err != nil {
   117  			return nil, err
   118  		}
   119  	}
   120  	args["max"] = arg1
   121  	return args, nil
   122  }
   123  
   124  // endregion ***************************** args.gotpl *****************************
   125  
   126  // region    ************************** directives.gotpl **************************
   127  
   128  func (ec *executionContext) _fieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) interface{} {
   129  	fc := graphql.GetFieldContext(ctx)
   130  	for _, d := range fc.Field.Directives {
   131  		switch d.Name {
   132  		case "logged":
   133  			rawArgs := d.ArgumentMap(ec.Variables)
   134  			args, err := ec.dir_logged_args(ctx, rawArgs)
   135  			if err != nil {
   136  				ec.Error(ctx, err)
   137  				return nil
   138  			}
   139  			n := next
   140  			next = func(ctx context.Context) (interface{}, error) {
   141  				if ec.directives.Logged == nil {
   142  					return nil, errors.New("directive logged is not implemented")
   143  				}
   144  				return ec.directives.Logged(ctx, obj, n, args["id"].(string))
   145  			}
   146  		}
   147  	}
   148  	res, err := ec.ResolverMiddleware(ctx, next)
   149  	if err != nil {
   150  		ec.Error(ctx, err)
   151  		return nil
   152  	}
   153  	return res
   154  }
   155  
   156  // endregion ************************** directives.gotpl **************************
   157  
   158  // region    **************************** field.gotpl *****************************
   159  
   160  func (ec *executionContext) _ObjectDirectives_text(ctx context.Context, field graphql.CollectedField, obj *ObjectDirectives) (ret graphql.Marshaler) {
   161  	fc, err := ec.fieldContext_ObjectDirectives_text(ctx, field)
   162  	if err != nil {
   163  		return graphql.Null
   164  	}
   165  	ctx = graphql.WithFieldContext(ctx, fc)
   166  	defer func() {
   167  		if r := recover(); r != nil {
   168  			ec.Error(ctx, ec.Recover(ctx, r))
   169  			ret = graphql.Null
   170  		}
   171  	}()
   172  	resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
   173  		directive0 := func(rctx context.Context) (interface{}, error) {
   174  			ctx = rctx // use context from middleware stack in children
   175  			return obj.Text, nil
   176  		}
   177  		directive1 := func(ctx context.Context) (interface{}, error) {
   178  			min, err := ec.unmarshalNInt2int(ctx, 0)
   179  			if err != nil {
   180  				return nil, err
   181  			}
   182  			max, err := ec.unmarshalOInt2ᚖint(ctx, 7)
   183  			if err != nil {
   184  				return nil, err
   185  			}
   186  			message, err := ec.unmarshalOString2ᚖstring(ctx, "not valid")
   187  			if err != nil {
   188  				return nil, err
   189  			}
   190  			if ec.directives.Length == nil {
   191  				return nil, errors.New("directive length is not implemented")
   192  			}
   193  			return ec.directives.Length(ctx, obj, directive0, min, max, message)
   194  		}
   195  
   196  		tmp, err := directive1(rctx)
   197  		if err != nil {
   198  			return nil, graphql.ErrorOnPath(ctx, err)
   199  		}
   200  		if tmp == nil {
   201  			return nil, nil
   202  		}
   203  		if data, ok := tmp.(string); ok {
   204  			return data, nil
   205  		}
   206  		return nil, fmt.Errorf(`unexpected type %T from directive, should be string`, tmp)
   207  	})
   208  
   209  	if resTmp == nil {
   210  		if !graphql.HasFieldError(ctx, fc) {
   211  			ec.Errorf(ctx, "must not be null")
   212  		}
   213  		return graphql.Null
   214  	}
   215  	res := resTmp.(string)
   216  	fc.Result = res
   217  	return ec.marshalNString2string(ctx, field.Selections, res)
   218  }
   219  
   220  func (ec *executionContext) fieldContext_ObjectDirectives_text(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
   221  	fc = &graphql.FieldContext{
   222  		Object:     "ObjectDirectives",
   223  		Field:      field,
   224  		IsMethod:   false,
   225  		IsResolver: false,
   226  		Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
   227  			return nil, errors.New("field of type String does not have child fields")
   228  		},
   229  	}
   230  	return fc, nil
   231  }
   232  
   233  func (ec *executionContext) _ObjectDirectives_nullableText(ctx context.Context, field graphql.CollectedField, obj *ObjectDirectives) (ret graphql.Marshaler) {
   234  	fc, err := ec.fieldContext_ObjectDirectives_nullableText(ctx, field)
   235  	if err != nil {
   236  		return graphql.Null
   237  	}
   238  	ctx = graphql.WithFieldContext(ctx, fc)
   239  	defer func() {
   240  		if r := recover(); r != nil {
   241  			ec.Error(ctx, ec.Recover(ctx, r))
   242  			ret = graphql.Null
   243  		}
   244  	}()
   245  	resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
   246  		directive0 := func(rctx context.Context) (interface{}, error) {
   247  			ctx = rctx // use context from middleware stack in children
   248  			return obj.NullableText, nil
   249  		}
   250  		directive1 := func(ctx context.Context) (interface{}, error) {
   251  			if ec.directives.ToNull == nil {
   252  				return nil, errors.New("directive toNull is not implemented")
   253  			}
   254  			return ec.directives.ToNull(ctx, obj, directive0)
   255  		}
   256  
   257  		tmp, err := directive1(rctx)
   258  		if err != nil {
   259  			return nil, graphql.ErrorOnPath(ctx, err)
   260  		}
   261  		if tmp == nil {
   262  			return nil, nil
   263  		}
   264  		if data, ok := tmp.(*string); ok {
   265  			return data, nil
   266  		}
   267  		return nil, fmt.Errorf(`unexpected type %T from directive, should be *string`, tmp)
   268  	})
   269  
   270  	if resTmp == nil {
   271  		return graphql.Null
   272  	}
   273  	res := resTmp.(*string)
   274  	fc.Result = res
   275  	return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
   276  }
   277  
   278  func (ec *executionContext) fieldContext_ObjectDirectives_nullableText(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
   279  	fc = &graphql.FieldContext{
   280  		Object:     "ObjectDirectives",
   281  		Field:      field,
   282  		IsMethod:   false,
   283  		IsResolver: false,
   284  		Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
   285  			return nil, errors.New("field of type String does not have child fields")
   286  		},
   287  	}
   288  	return fc, nil
   289  }
   290  
   291  func (ec *executionContext) _ObjectDirectives_order(ctx context.Context, field graphql.CollectedField, obj *ObjectDirectives) (ret graphql.Marshaler) {
   292  	fc, err := ec.fieldContext_ObjectDirectives_order(ctx, field)
   293  	if err != nil {
   294  		return graphql.Null
   295  	}
   296  	ctx = graphql.WithFieldContext(ctx, fc)
   297  	defer func() {
   298  		if r := recover(); r != nil {
   299  			ec.Error(ctx, ec.Recover(ctx, r))
   300  			ret = graphql.Null
   301  		}
   302  	}()
   303  	resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
   304  		ctx = rctx // use context from middleware stack in children
   305  		return obj.Order, nil
   306  	})
   307  
   308  	if resTmp == nil {
   309  		if !graphql.HasFieldError(ctx, fc) {
   310  			ec.Errorf(ctx, "must not be null")
   311  		}
   312  		return graphql.Null
   313  	}
   314  	res := resTmp.([]string)
   315  	fc.Result = res
   316  	return ec.marshalNString2ᚕstringᚄ(ctx, field.Selections, res)
   317  }
   318  
   319  func (ec *executionContext) fieldContext_ObjectDirectives_order(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
   320  	fc = &graphql.FieldContext{
   321  		Object:     "ObjectDirectives",
   322  		Field:      field,
   323  		IsMethod:   false,
   324  		IsResolver: false,
   325  		Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
   326  			return nil, errors.New("field of type String does not have child fields")
   327  		},
   328  	}
   329  	return fc, nil
   330  }
   331  
   332  func (ec *executionContext) _ObjectDirectivesWithCustomGoModel_nullableText(ctx context.Context, field graphql.CollectedField, obj *ObjectDirectivesWithCustomGoModel) (ret graphql.Marshaler) {
   333  	fc, err := ec.fieldContext_ObjectDirectivesWithCustomGoModel_nullableText(ctx, field)
   334  	if err != nil {
   335  		return graphql.Null
   336  	}
   337  	ctx = graphql.WithFieldContext(ctx, fc)
   338  	defer func() {
   339  		if r := recover(); r != nil {
   340  			ec.Error(ctx, ec.Recover(ctx, r))
   341  			ret = graphql.Null
   342  		}
   343  	}()
   344  	resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
   345  		directive0 := func(rctx context.Context) (interface{}, error) {
   346  			ctx = rctx // use context from middleware stack in children
   347  			return obj.NullableText, nil
   348  		}
   349  		directive1 := func(ctx context.Context) (interface{}, error) {
   350  			if ec.directives.ToNull == nil {
   351  				return nil, errors.New("directive toNull is not implemented")
   352  			}
   353  			return ec.directives.ToNull(ctx, obj, directive0)
   354  		}
   355  
   356  		tmp, err := directive1(rctx)
   357  		if err != nil {
   358  			return nil, graphql.ErrorOnPath(ctx, err)
   359  		}
   360  		if tmp == nil {
   361  			return nil, nil
   362  		}
   363  		if data, ok := tmp.(string); ok {
   364  			return data, nil
   365  		}
   366  		return nil, fmt.Errorf(`unexpected type %T from directive, should be string`, tmp)
   367  	})
   368  
   369  	if resTmp == nil {
   370  		return graphql.Null
   371  	}
   372  	res := resTmp.(string)
   373  	fc.Result = res
   374  	return ec.marshalOString2string(ctx, field.Selections, res)
   375  }
   376  
   377  func (ec *executionContext) fieldContext_ObjectDirectivesWithCustomGoModel_nullableText(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
   378  	fc = &graphql.FieldContext{
   379  		Object:     "ObjectDirectivesWithCustomGoModel",
   380  		Field:      field,
   381  		IsMethod:   false,
   382  		IsResolver: false,
   383  		Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
   384  			return nil, errors.New("field of type String does not have child fields")
   385  		},
   386  	}
   387  	return fc, nil
   388  }
   389  
   390  // endregion **************************** field.gotpl *****************************
   391  
   392  // region    **************************** input.gotpl *****************************
   393  
   394  func (ec *executionContext) unmarshalInputInnerDirectives(ctx context.Context, obj interface{}) (InnerDirectives, error) {
   395  	var it InnerDirectives
   396  	asMap := map[string]interface{}{}
   397  	for k, v := range obj.(map[string]interface{}) {
   398  		asMap[k] = v
   399  	}
   400  
   401  	fieldsInOrder := [...]string{"message"}
   402  	for _, k := range fieldsInOrder {
   403  		v, ok := asMap[k]
   404  		if !ok {
   405  			continue
   406  		}
   407  		switch k {
   408  		case "message":
   409  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("message"))
   410  			directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(ctx, v) }
   411  			directive1 := func(ctx context.Context) (interface{}, error) {
   412  				min, err := ec.unmarshalNInt2int(ctx, 1)
   413  				if err != nil {
   414  					return nil, err
   415  				}
   416  				message, err := ec.unmarshalOString2ᚖstring(ctx, "not valid")
   417  				if err != nil {
   418  					return nil, err
   419  				}
   420  				if ec.directives.Length == nil {
   421  					return nil, errors.New("directive length is not implemented")
   422  				}
   423  				return ec.directives.Length(ctx, obj, directive0, min, nil, message)
   424  			}
   425  
   426  			tmp, err := directive1(ctx)
   427  			if err != nil {
   428  				return it, graphql.ErrorOnPath(ctx, err)
   429  			}
   430  			if data, ok := tmp.(string); ok {
   431  				it.Message = data
   432  			} else {
   433  				err := fmt.Errorf(`unexpected type %T from directive, should be string`, tmp)
   434  				return it, graphql.ErrorOnPath(ctx, err)
   435  			}
   436  		}
   437  	}
   438  
   439  	return it, nil
   440  }
   441  
   442  func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, obj interface{}) (InputDirectives, error) {
   443  	var it InputDirectives
   444  	asMap := map[string]interface{}{}
   445  	for k, v := range obj.(map[string]interface{}) {
   446  		asMap[k] = v
   447  	}
   448  
   449  	fieldsInOrder := [...]string{"text", "nullableText", "inner", "innerNullable", "thirdParty"}
   450  	for _, k := range fieldsInOrder {
   451  		v, ok := asMap[k]
   452  		if !ok {
   453  			continue
   454  		}
   455  		switch k {
   456  		case "text":
   457  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("text"))
   458  			directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(ctx, v) }
   459  			directive1 := func(ctx context.Context) (interface{}, error) {
   460  				if ec.directives.Directive3 == nil {
   461  					return nil, errors.New("directive directive3 is not implemented")
   462  				}
   463  				return ec.directives.Directive3(ctx, obj, directive0)
   464  			}
   465  			directive2 := func(ctx context.Context) (interface{}, error) {
   466  				min, err := ec.unmarshalNInt2int(ctx, 0)
   467  				if err != nil {
   468  					return nil, err
   469  				}
   470  				max, err := ec.unmarshalOInt2ᚖint(ctx, 7)
   471  				if err != nil {
   472  					return nil, err
   473  				}
   474  				message, err := ec.unmarshalOString2ᚖstring(ctx, "not valid")
   475  				if err != nil {
   476  					return nil, err
   477  				}
   478  				if ec.directives.Length == nil {
   479  					return nil, errors.New("directive length is not implemented")
   480  				}
   481  				return ec.directives.Length(ctx, obj, directive1, min, max, message)
   482  			}
   483  
   484  			tmp, err := directive2(ctx)
   485  			if err != nil {
   486  				return it, graphql.ErrorOnPath(ctx, err)
   487  			}
   488  			if data, ok := tmp.(string); ok {
   489  				it.Text = data
   490  			} else {
   491  				err := fmt.Errorf(`unexpected type %T from directive, should be string`, tmp)
   492  				return it, graphql.ErrorOnPath(ctx, err)
   493  			}
   494  		case "nullableText":
   495  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nullableText"))
   496  			directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOString2ᚖstring(ctx, v) }
   497  			directive1 := func(ctx context.Context) (interface{}, error) {
   498  				if ec.directives.Directive3 == nil {
   499  					return nil, errors.New("directive directive3 is not implemented")
   500  				}
   501  				return ec.directives.Directive3(ctx, obj, directive0)
   502  			}
   503  			directive2 := func(ctx context.Context) (interface{}, error) {
   504  				if ec.directives.ToNull == nil {
   505  					return nil, errors.New("directive toNull is not implemented")
   506  				}
   507  				return ec.directives.ToNull(ctx, obj, directive1)
   508  			}
   509  
   510  			tmp, err := directive2(ctx)
   511  			if err != nil {
   512  				return it, graphql.ErrorOnPath(ctx, err)
   513  			}
   514  			if data, ok := tmp.(*string); ok {
   515  				it.NullableText = data
   516  			} else if tmp == nil {
   517  				it.NullableText = nil
   518  			} else {
   519  				err := fmt.Errorf(`unexpected type %T from directive, should be *string`, tmp)
   520  				return it, graphql.ErrorOnPath(ctx, err)
   521  			}
   522  		case "inner":
   523  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("inner"))
   524  			directive0 := func(ctx context.Context) (interface{}, error) {
   525  				return ec.unmarshalNInnerDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐInnerDirectives(ctx, v)
   526  			}
   527  			directive1 := func(ctx context.Context) (interface{}, error) {
   528  				if ec.directives.Directive3 == nil {
   529  					return nil, errors.New("directive directive3 is not implemented")
   530  				}
   531  				return ec.directives.Directive3(ctx, obj, directive0)
   532  			}
   533  
   534  			tmp, err := directive1(ctx)
   535  			if err != nil {
   536  				return it, graphql.ErrorOnPath(ctx, err)
   537  			}
   538  			if data, ok := tmp.(*InnerDirectives); ok {
   539  				it.Inner = data
   540  			} else if tmp == nil {
   541  				it.Inner = nil
   542  			} else {
   543  				err := fmt.Errorf(`unexpected type %T from directive, should be *github.com/99designs/gqlgen/codegen/testserver/followschema.InnerDirectives`, tmp)
   544  				return it, graphql.ErrorOnPath(ctx, err)
   545  			}
   546  		case "innerNullable":
   547  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("innerNullable"))
   548  			directive0 := func(ctx context.Context) (interface{}, error) {
   549  				return ec.unmarshalOInnerDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐInnerDirectives(ctx, v)
   550  			}
   551  			directive1 := func(ctx context.Context) (interface{}, error) {
   552  				if ec.directives.Directive3 == nil {
   553  					return nil, errors.New("directive directive3 is not implemented")
   554  				}
   555  				return ec.directives.Directive3(ctx, obj, directive0)
   556  			}
   557  
   558  			tmp, err := directive1(ctx)
   559  			if err != nil {
   560  				return it, graphql.ErrorOnPath(ctx, err)
   561  			}
   562  			if data, ok := tmp.(*InnerDirectives); ok {
   563  				it.InnerNullable = data
   564  			} else if tmp == nil {
   565  				it.InnerNullable = nil
   566  			} else {
   567  				err := fmt.Errorf(`unexpected type %T from directive, should be *github.com/99designs/gqlgen/codegen/testserver/followschema.InnerDirectives`, tmp)
   568  				return it, graphql.ErrorOnPath(ctx, err)
   569  			}
   570  		case "thirdParty":
   571  			ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("thirdParty"))
   572  			directive0 := func(ctx context.Context) (interface{}, error) {
   573  				return ec.unmarshalOThirdParty2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐThirdParty(ctx, v)
   574  			}
   575  			directive1 := func(ctx context.Context) (interface{}, error) {
   576  				if ec.directives.Directive3 == nil {
   577  					return nil, errors.New("directive directive3 is not implemented")
   578  				}
   579  				return ec.directives.Directive3(ctx, obj, directive0)
   580  			}
   581  			directive2 := func(ctx context.Context) (interface{}, error) {
   582  				min, err := ec.unmarshalNInt2int(ctx, 0)
   583  				if err != nil {
   584  					return nil, err
   585  				}
   586  				max, err := ec.unmarshalOInt2ᚖint(ctx, 7)
   587  				if err != nil {
   588  					return nil, err
   589  				}
   590  				if ec.directives.Length == nil {
   591  					return nil, errors.New("directive length is not implemented")
   592  				}
   593  				return ec.directives.Length(ctx, obj, directive1, min, max, nil)
   594  			}
   595  
   596  			tmp, err := directive2(ctx)
   597  			if err != nil {
   598  				return it, graphql.ErrorOnPath(ctx, err)
   599  			}
   600  			if data, ok := tmp.(*ThirdParty); ok {
   601  				it.ThirdParty = data
   602  			} else if tmp == nil {
   603  				it.ThirdParty = nil
   604  			} else {
   605  				err := fmt.Errorf(`unexpected type %T from directive, should be *github.com/99designs/gqlgen/codegen/testserver/followschema.ThirdParty`, tmp)
   606  				return it, graphql.ErrorOnPath(ctx, err)
   607  			}
   608  		}
   609  	}
   610  
   611  	return it, nil
   612  }
   613  
   614  // endregion **************************** input.gotpl *****************************
   615  
   616  // region    ************************** interface.gotpl ***************************
   617  
   618  // endregion ************************** interface.gotpl ***************************
   619  
   620  // region    **************************** object.gotpl ****************************
   621  
   622  var objectDirectivesImplementors = []string{"ObjectDirectives"}
   623  
   624  func (ec *executionContext) _ObjectDirectives(ctx context.Context, sel ast.SelectionSet, obj *ObjectDirectives) graphql.Marshaler {
   625  	fields := graphql.CollectFields(ec.OperationContext, sel, objectDirectivesImplementors)
   626  
   627  	out := graphql.NewFieldSet(fields)
   628  	deferred := make(map[string]*graphql.FieldSet)
   629  	for i, field := range fields {
   630  		switch field.Name {
   631  		case "__typename":
   632  			out.Values[i] = graphql.MarshalString("ObjectDirectives")
   633  		case "text":
   634  			out.Values[i] = ec._ObjectDirectives_text(ctx, field, obj)
   635  			if out.Values[i] == graphql.Null {
   636  				out.Invalids++
   637  			}
   638  		case "nullableText":
   639  			out.Values[i] = ec._ObjectDirectives_nullableText(ctx, field, obj)
   640  		case "order":
   641  			out.Values[i] = ec._ObjectDirectives_order(ctx, field, obj)
   642  			if out.Values[i] == graphql.Null {
   643  				out.Invalids++
   644  			}
   645  		default:
   646  			panic("unknown field " + strconv.Quote(field.Name))
   647  		}
   648  	}
   649  	out.Dispatch(ctx)
   650  	if out.Invalids > 0 {
   651  		return graphql.Null
   652  	}
   653  
   654  	atomic.AddInt32(&ec.deferred, int32(len(deferred)))
   655  
   656  	for label, dfs := range deferred {
   657  		ec.processDeferredGroup(graphql.DeferredGroup{
   658  			Label:    label,
   659  			Path:     graphql.GetPath(ctx),
   660  			FieldSet: dfs,
   661  			Context:  ctx,
   662  		})
   663  	}
   664  
   665  	return out
   666  }
   667  
   668  var objectDirectivesWithCustomGoModelImplementors = []string{"ObjectDirectivesWithCustomGoModel"}
   669  
   670  func (ec *executionContext) _ObjectDirectivesWithCustomGoModel(ctx context.Context, sel ast.SelectionSet, obj *ObjectDirectivesWithCustomGoModel) graphql.Marshaler {
   671  	fields := graphql.CollectFields(ec.OperationContext, sel, objectDirectivesWithCustomGoModelImplementors)
   672  
   673  	out := graphql.NewFieldSet(fields)
   674  	deferred := make(map[string]*graphql.FieldSet)
   675  	for i, field := range fields {
   676  		switch field.Name {
   677  		case "__typename":
   678  			out.Values[i] = graphql.MarshalString("ObjectDirectivesWithCustomGoModel")
   679  		case "nullableText":
   680  			out.Values[i] = ec._ObjectDirectivesWithCustomGoModel_nullableText(ctx, field, obj)
   681  		default:
   682  			panic("unknown field " + strconv.Quote(field.Name))
   683  		}
   684  	}
   685  	out.Dispatch(ctx)
   686  	if out.Invalids > 0 {
   687  		return graphql.Null
   688  	}
   689  
   690  	atomic.AddInt32(&ec.deferred, int32(len(deferred)))
   691  
   692  	for label, dfs := range deferred {
   693  		ec.processDeferredGroup(graphql.DeferredGroup{
   694  			Label:    label,
   695  			Path:     graphql.GetPath(ctx),
   696  			FieldSet: dfs,
   697  			Context:  ctx,
   698  		})
   699  	}
   700  
   701  	return out
   702  }
   703  
   704  // endregion **************************** object.gotpl ****************************
   705  
   706  // region    ***************************** type.gotpl *****************************
   707  
   708  func (ec *executionContext) unmarshalNInnerDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐInnerDirectives(ctx context.Context, v interface{}) (*InnerDirectives, error) {
   709  	res, err := ec.unmarshalInputInnerDirectives(ctx, v)
   710  	return &res, graphql.ErrorOnPath(ctx, err)
   711  }
   712  
   713  func (ec *executionContext) unmarshalNInputDirectives2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐInputDirectives(ctx context.Context, v interface{}) (InputDirectives, error) {
   714  	res, err := ec.unmarshalInputInputDirectives(ctx, v)
   715  	return res, graphql.ErrorOnPath(ctx, err)
   716  }
   717  
   718  func (ec *executionContext) unmarshalOInnerDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐInnerDirectives(ctx context.Context, v interface{}) (*InnerDirectives, error) {
   719  	if v == nil {
   720  		return nil, nil
   721  	}
   722  	res, err := ec.unmarshalInputInnerDirectives(ctx, v)
   723  	return &res, graphql.ErrorOnPath(ctx, err)
   724  }
   725  
   726  func (ec *executionContext) unmarshalOInputDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐInputDirectives(ctx context.Context, v interface{}) (*InputDirectives, error) {
   727  	if v == nil {
   728  		return nil, nil
   729  	}
   730  	res, err := ec.unmarshalInputInputDirectives(ctx, v)
   731  	return &res, graphql.ErrorOnPath(ctx, err)
   732  }
   733  
   734  func (ec *executionContext) marshalOObjectDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐObjectDirectives(ctx context.Context, sel ast.SelectionSet, v *ObjectDirectives) graphql.Marshaler {
   735  	if v == nil {
   736  		return graphql.Null
   737  	}
   738  	return ec._ObjectDirectives(ctx, sel, v)
   739  }
   740  
   741  func (ec *executionContext) marshalOObjectDirectivesWithCustomGoModel2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐObjectDirectivesWithCustomGoModel(ctx context.Context, sel ast.SelectionSet, v *ObjectDirectivesWithCustomGoModel) graphql.Marshaler {
   742  	if v == nil {
   743  		return graphql.Null
   744  	}
   745  	return ec._ObjectDirectivesWithCustomGoModel(ctx, sel, v)
   746  }
   747  
   748  // endregion ***************************** type.gotpl *****************************
   749  

View as plain text