github.com/luciferinlove/gqlgen@v0.17.16-bzc.1/codegen/testserver/followschema/panics.generated.go (about)

     1  // Code generated by github.com/luciferinlove/gqlgen, DO NOT EDIT.
     2  
     3  package followschema
     4  
     5  import (
     6  	"context"
     7  	"errors"
     8  	"strconv"
     9  	"sync/atomic"
    10  
    11  	"github.com/luciferinlove/gqlgen/graphql"
    12  	"github.com/vektah/gqlparser/v2/ast"
    13  )
    14  
    15  // region    ************************** generated!.gotpl **************************
    16  
    17  type PanicsResolver interface {
    18  	FieldScalarMarshal(ctx context.Context, obj *Panics) ([]MarshalPanic, error)
    19  
    20  	ArgUnmarshal(ctx context.Context, obj *Panics, u []MarshalPanic) (bool, error)
    21  }
    22  
    23  // endregion ************************** generated!.gotpl **************************
    24  
    25  // region    ***************************** args.gotpl *****************************
    26  
    27  func (ec *executionContext) field_Panics_argUnmarshal_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
    28  	var err error
    29  	args := map[string]interface{}{}
    30  	var arg0 []MarshalPanic
    31  	if tmp, ok := rawArgs["u"]; ok {
    32  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("u"))
    33  		arg0, err = ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanicᚄ(ctx, tmp)
    34  		if err != nil {
    35  			return nil, err
    36  		}
    37  	}
    38  	args["u"] = arg0
    39  	return args, nil
    40  }
    41  
    42  func (ec *executionContext) field_Panics_fieldFuncMarshal_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
    43  	var err error
    44  	args := map[string]interface{}{}
    45  	var arg0 []MarshalPanic
    46  	if tmp, ok := rawArgs["u"]; ok {
    47  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("u"))
    48  		arg0, err = ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanicᚄ(ctx, tmp)
    49  		if err != nil {
    50  			return nil, err
    51  		}
    52  	}
    53  	args["u"] = arg0
    54  	return args, nil
    55  }
    56  
    57  // endregion ***************************** args.gotpl *****************************
    58  
    59  // region    ************************** directives.gotpl **************************
    60  
    61  // endregion ************************** directives.gotpl **************************
    62  
    63  // region    **************************** field.gotpl *****************************
    64  
    65  func (ec *executionContext) _Panics_fieldScalarMarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) (ret graphql.Marshaler) {
    66  	fc, err := ec.fieldContext_Panics_fieldScalarMarshal(ctx, field)
    67  	if err != nil {
    68  		return graphql.Null
    69  	}
    70  	ctx = graphql.WithFieldContext(ctx, fc)
    71  	defer func() {
    72  		if r := recover(); r != nil {
    73  			ec.Error(ctx, ec.Recover(ctx, r))
    74  			ret = graphql.Null
    75  		}
    76  	}()
    77  	resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
    78  		ctx = rctx // use context from middleware stack in children
    79  		return ec.resolvers.Panics().FieldScalarMarshal(rctx, obj)
    80  	})
    81  
    82  	if resTmp == nil {
    83  		if !graphql.HasFieldError(ctx, fc) {
    84  			ec.Errorf(ctx, "must not be null")
    85  		}
    86  		return graphql.Null
    87  	}
    88  	res := resTmp.([]MarshalPanic)
    89  	fc.Result = res
    90  	return ec.marshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanicᚄ(ctx, field.Selections, res)
    91  }
    92  
    93  func (ec *executionContext) fieldContext_Panics_fieldScalarMarshal(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
    94  	fc = &graphql.FieldContext{
    95  		Object:     "Panics",
    96  		Field:      field,
    97  		IsMethod:   true,
    98  		IsResolver: true,
    99  		Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
   100  			return nil, errors.New("field of type MarshalPanic does not have child fields")
   101  		},
   102  	}
   103  	return fc, nil
   104  }
   105  
   106  func (ec *executionContext) _Panics_fieldFuncMarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) (ret graphql.Marshaler) {
   107  	fc, err := ec.fieldContext_Panics_fieldFuncMarshal(ctx, field)
   108  	if err != nil {
   109  		return graphql.Null
   110  	}
   111  	ctx = graphql.WithFieldContext(ctx, fc)
   112  	defer func() {
   113  		if r := recover(); r != nil {
   114  			ec.Error(ctx, ec.Recover(ctx, r))
   115  			ret = graphql.Null
   116  		}
   117  	}()
   118  	resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
   119  		ctx = rctx // use context from middleware stack in children
   120  		return obj.FieldFuncMarshal(ctx, fc.Args["u"].([]MarshalPanic)), nil
   121  	})
   122  
   123  	if resTmp == nil {
   124  		if !graphql.HasFieldError(ctx, fc) {
   125  			ec.Errorf(ctx, "must not be null")
   126  		}
   127  		return graphql.Null
   128  	}
   129  	res := resTmp.([]MarshalPanic)
   130  	fc.Result = res
   131  	return ec.marshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanicᚄ(ctx, field.Selections, res)
   132  }
   133  
   134  func (ec *executionContext) fieldContext_Panics_fieldFuncMarshal(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
   135  	fc = &graphql.FieldContext{
   136  		Object:     "Panics",
   137  		Field:      field,
   138  		IsMethod:   true,
   139  		IsResolver: false,
   140  		Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
   141  			return nil, errors.New("field of type MarshalPanic does not have child fields")
   142  		},
   143  	}
   144  	defer func() {
   145  		if r := recover(); r != nil {
   146  			err = ec.Recover(ctx, r)
   147  			ec.Error(ctx, err)
   148  		}
   149  	}()
   150  	ctx = graphql.WithFieldContext(ctx, fc)
   151  	if fc.Args, err = ec.field_Panics_fieldFuncMarshal_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
   152  		ec.Error(ctx, err)
   153  		return
   154  	}
   155  	return fc, nil
   156  }
   157  
   158  func (ec *executionContext) _Panics_argUnmarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) (ret graphql.Marshaler) {
   159  	fc, err := ec.fieldContext_Panics_argUnmarshal(ctx, field)
   160  	if err != nil {
   161  		return graphql.Null
   162  	}
   163  	ctx = graphql.WithFieldContext(ctx, fc)
   164  	defer func() {
   165  		if r := recover(); r != nil {
   166  			ec.Error(ctx, ec.Recover(ctx, r))
   167  			ret = graphql.Null
   168  		}
   169  	}()
   170  	resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
   171  		ctx = rctx // use context from middleware stack in children
   172  		return ec.resolvers.Panics().ArgUnmarshal(rctx, obj, fc.Args["u"].([]MarshalPanic))
   173  	})
   174  
   175  	if resTmp == nil {
   176  		if !graphql.HasFieldError(ctx, fc) {
   177  			ec.Errorf(ctx, "must not be null")
   178  		}
   179  		return graphql.Null
   180  	}
   181  	res := resTmp.(bool)
   182  	fc.Result = res
   183  	return ec.marshalNBoolean2bool(ctx, field.Selections, res)
   184  }
   185  
   186  func (ec *executionContext) fieldContext_Panics_argUnmarshal(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
   187  	fc = &graphql.FieldContext{
   188  		Object:     "Panics",
   189  		Field:      field,
   190  		IsMethod:   true,
   191  		IsResolver: true,
   192  		Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
   193  			return nil, errors.New("field of type Boolean does not have child fields")
   194  		},
   195  	}
   196  	defer func() {
   197  		if r := recover(); r != nil {
   198  			err = ec.Recover(ctx, r)
   199  			ec.Error(ctx, err)
   200  		}
   201  	}()
   202  	ctx = graphql.WithFieldContext(ctx, fc)
   203  	if fc.Args, err = ec.field_Panics_argUnmarshal_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
   204  		ec.Error(ctx, err)
   205  		return
   206  	}
   207  	return fc, nil
   208  }
   209  
   210  // endregion **************************** field.gotpl *****************************
   211  
   212  // region    **************************** input.gotpl *****************************
   213  
   214  // endregion **************************** input.gotpl *****************************
   215  
   216  // region    ************************** interface.gotpl ***************************
   217  
   218  // endregion ************************** interface.gotpl ***************************
   219  
   220  // region    **************************** object.gotpl ****************************
   221  
   222  var panicsImplementors = []string{"Panics"}
   223  
   224  func (ec *executionContext) _Panics(ctx context.Context, sel ast.SelectionSet, obj *Panics) graphql.Marshaler {
   225  	fields := graphql.CollectFields(ec.OperationContext, sel, panicsImplementors)
   226  	out := graphql.NewFieldSet(fields)
   227  	var invalids uint32
   228  	for i, field := range fields {
   229  		switch field.Name {
   230  		case "__typename":
   231  			out.Values[i] = graphql.MarshalString("Panics")
   232  		case "fieldScalarMarshal":
   233  			field := field
   234  
   235  			innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
   236  				defer func() {
   237  					if r := recover(); r != nil {
   238  						ec.Error(ctx, ec.Recover(ctx, r))
   239  					}
   240  				}()
   241  				res = ec._Panics_fieldScalarMarshal(ctx, field, obj)
   242  				if res == graphql.Null {
   243  					atomic.AddUint32(&invalids, 1)
   244  				}
   245  				return res
   246  			}
   247  
   248  			out.Concurrently(i, func() graphql.Marshaler {
   249  				return innerFunc(ctx)
   250  
   251  			})
   252  		case "fieldFuncMarshal":
   253  			field := field
   254  
   255  			innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
   256  				defer func() {
   257  					if r := recover(); r != nil {
   258  						ec.Error(ctx, ec.Recover(ctx, r))
   259  					}
   260  				}()
   261  				res = ec._Panics_fieldFuncMarshal(ctx, field, obj)
   262  				if res == graphql.Null {
   263  					atomic.AddUint32(&invalids, 1)
   264  				}
   265  				return res
   266  			}
   267  
   268  			out.Concurrently(i, func() graphql.Marshaler {
   269  				return innerFunc(ctx)
   270  
   271  			})
   272  		case "argUnmarshal":
   273  			field := field
   274  
   275  			innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
   276  				defer func() {
   277  					if r := recover(); r != nil {
   278  						ec.Error(ctx, ec.Recover(ctx, r))
   279  					}
   280  				}()
   281  				res = ec._Panics_argUnmarshal(ctx, field, obj)
   282  				if res == graphql.Null {
   283  					atomic.AddUint32(&invalids, 1)
   284  				}
   285  				return res
   286  			}
   287  
   288  			out.Concurrently(i, func() graphql.Marshaler {
   289  				return innerFunc(ctx)
   290  
   291  			})
   292  		default:
   293  			panic("unknown field " + strconv.Quote(field.Name))
   294  		}
   295  	}
   296  	out.Dispatch()
   297  	if invalids > 0 {
   298  		return graphql.Null
   299  	}
   300  	return out
   301  }
   302  
   303  // endregion **************************** object.gotpl ****************************
   304  
   305  // region    ***************************** type.gotpl *****************************
   306  
   307  func (ec *executionContext) unmarshalNMarshalPanic2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanic(ctx context.Context, v interface{}) (MarshalPanic, error) {
   308  	var res MarshalPanic
   309  	err := res.UnmarshalGQL(v)
   310  	return res, graphql.ErrorOnPath(ctx, err)
   311  }
   312  
   313  func (ec *executionContext) marshalNMarshalPanic2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanic(ctx context.Context, sel ast.SelectionSet, v MarshalPanic) graphql.Marshaler {
   314  	return v
   315  }
   316  
   317  func (ec *executionContext) unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanicᚄ(ctx context.Context, v interface{}) ([]MarshalPanic, error) {
   318  	var vSlice []interface{}
   319  	if v != nil {
   320  		vSlice = graphql.CoerceList(v)
   321  	}
   322  	var err error
   323  	res := make([]MarshalPanic, len(vSlice))
   324  	for i := range vSlice {
   325  		ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
   326  		res[i], err = ec.unmarshalNMarshalPanic2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanic(ctx, vSlice[i])
   327  		if err != nil {
   328  			return nil, err
   329  		}
   330  	}
   331  	return res, nil
   332  }
   333  
   334  func (ec *executionContext) marshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanicᚄ(ctx context.Context, sel ast.SelectionSet, v []MarshalPanic) graphql.Marshaler {
   335  	ret := make(graphql.Array, len(v))
   336  	for i := range v {
   337  		ret[i] = ec.marshalNMarshalPanic2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanic(ctx, sel, v[i])
   338  	}
   339  
   340  	for _, e := range ret {
   341  		if e == graphql.Null {
   342  			return graphql.Null
   343  		}
   344  	}
   345  
   346  	return ret
   347  }
   348  
   349  func (ec *executionContext) marshalOPanics2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐPanics(ctx context.Context, sel ast.SelectionSet, v *Panics) graphql.Marshaler {
   350  	if v == nil {
   351  		return graphql.Null
   352  	}
   353  	return ec._Panics(ctx, sel, v)
   354  }
   355  
   356  // endregion ***************************** type.gotpl *****************************