github.com/luciferinlove/gqlgen@v0.17.16-bzc.1/codegen/testserver/followschema/issue896.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"
    10  
    11  	"github.com/luciferinlove/gqlgen/graphql"
    12  	"github.com/vektah/gqlparser/v2/ast"
    13  )
    14  
    15  // region    ************************** generated!.gotpl **************************
    16  
    17  // endregion ************************** generated!.gotpl **************************
    18  
    19  // region    ***************************** args.gotpl *****************************
    20  
    21  // endregion ***************************** args.gotpl *****************************
    22  
    23  // region    ************************** directives.gotpl **************************
    24  
    25  // endregion ************************** directives.gotpl **************************
    26  
    27  // region    **************************** field.gotpl *****************************
    28  
    29  func (ec *executionContext) _CheckIssue896_id(ctx context.Context, field graphql.CollectedField, obj *CheckIssue896) (ret graphql.Marshaler) {
    30  	fc, err := ec.fieldContext_CheckIssue896_id(ctx, field)
    31  	if err != nil {
    32  		return graphql.Null
    33  	}
    34  	ctx = graphql.WithFieldContext(ctx, fc)
    35  	defer func() {
    36  		if r := recover(); r != nil {
    37  			ec.Error(ctx, ec.Recover(ctx, r))
    38  			ret = graphql.Null
    39  		}
    40  	}()
    41  	resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
    42  		ctx = rctx // use context from middleware stack in children
    43  		return obj.ID, nil
    44  	})
    45  
    46  	if resTmp == nil {
    47  		return graphql.Null
    48  	}
    49  	res := resTmp.(*int)
    50  	fc.Result = res
    51  	return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
    52  }
    53  
    54  func (ec *executionContext) fieldContext_CheckIssue896_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
    55  	fc = &graphql.FieldContext{
    56  		Object:     "CheckIssue896",
    57  		Field:      field,
    58  		IsMethod:   false,
    59  		IsResolver: false,
    60  		Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
    61  			return nil, errors.New("field of type Int does not have child fields")
    62  		},
    63  	}
    64  	return fc, nil
    65  }
    66  
    67  // endregion **************************** field.gotpl *****************************
    68  
    69  // region    **************************** input.gotpl *****************************
    70  
    71  // endregion **************************** input.gotpl *****************************
    72  
    73  // region    ************************** interface.gotpl ***************************
    74  
    75  // endregion ************************** interface.gotpl ***************************
    76  
    77  // region    **************************** object.gotpl ****************************
    78  
    79  var checkIssue896Implementors = []string{"CheckIssue896"}
    80  
    81  func (ec *executionContext) _CheckIssue896(ctx context.Context, sel ast.SelectionSet, obj *CheckIssue896) graphql.Marshaler {
    82  	fields := graphql.CollectFields(ec.OperationContext, sel, checkIssue896Implementors)
    83  	out := graphql.NewFieldSet(fields)
    84  	var invalids uint32
    85  	for i, field := range fields {
    86  		switch field.Name {
    87  		case "__typename":
    88  			out.Values[i] = graphql.MarshalString("CheckIssue896")
    89  		case "id":
    90  
    91  			out.Values[i] = ec._CheckIssue896_id(ctx, field, obj)
    92  
    93  		default:
    94  			panic("unknown field " + strconv.Quote(field.Name))
    95  		}
    96  	}
    97  	out.Dispatch()
    98  	if invalids > 0 {
    99  		return graphql.Null
   100  	}
   101  	return out
   102  }
   103  
   104  // endregion **************************** object.gotpl ****************************
   105  
   106  // region    ***************************** type.gotpl *****************************
   107  
   108  func (ec *executionContext) marshalNCheckIssue8962ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐCheckIssue896(ctx context.Context, sel ast.SelectionSet, v *CheckIssue896) graphql.Marshaler {
   109  	if v == nil {
   110  		if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
   111  			ec.Errorf(ctx, "the requested element is null which the schema does not allow")
   112  		}
   113  		return graphql.Null
   114  	}
   115  	return ec._CheckIssue896(ctx, sel, v)
   116  }
   117  
   118  func (ec *executionContext) marshalOCheckIssue8962ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐCheckIssue896(ctx context.Context, sel ast.SelectionSet, v []*CheckIssue896) graphql.Marshaler {
   119  	if v == nil {
   120  		return graphql.Null
   121  	}
   122  	ret := make(graphql.Array, len(v))
   123  	var wg sync.WaitGroup
   124  	isLen1 := len(v) == 1
   125  	if !isLen1 {
   126  		wg.Add(len(v))
   127  	}
   128  	for i := range v {
   129  		i := i
   130  		fc := &graphql.FieldContext{
   131  			Index:  &i,
   132  			Result: &v[i],
   133  		}
   134  		ctx := graphql.WithFieldContext(ctx, fc)
   135  		f := func(i int) {
   136  			defer func() {
   137  				if r := recover(); r != nil {
   138  					ec.Error(ctx, ec.Recover(ctx, r))
   139  					ret = nil
   140  				}
   141  			}()
   142  			if !isLen1 {
   143  				defer wg.Done()
   144  			}
   145  			ret[i] = ec.marshalOCheckIssue8962ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐCheckIssue896(ctx, sel, v[i])
   146  		}
   147  		if isLen1 {
   148  			f(i)
   149  		} else {
   150  			go f(i)
   151  		}
   152  
   153  	}
   154  	wg.Wait()
   155  
   156  	return ret
   157  }
   158  
   159  func (ec *executionContext) marshalOCheckIssue8962ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐCheckIssue896ᚄ(ctx context.Context, sel ast.SelectionSet, v []*CheckIssue896) graphql.Marshaler {
   160  	if v == nil {
   161  		return graphql.Null
   162  	}
   163  	ret := make(graphql.Array, len(v))
   164  	var wg sync.WaitGroup
   165  	isLen1 := len(v) == 1
   166  	if !isLen1 {
   167  		wg.Add(len(v))
   168  	}
   169  	for i := range v {
   170  		i := i
   171  		fc := &graphql.FieldContext{
   172  			Index:  &i,
   173  			Result: &v[i],
   174  		}
   175  		ctx := graphql.WithFieldContext(ctx, fc)
   176  		f := func(i int) {
   177  			defer func() {
   178  				if r := recover(); r != nil {
   179  					ec.Error(ctx, ec.Recover(ctx, r))
   180  					ret = nil
   181  				}
   182  			}()
   183  			if !isLen1 {
   184  				defer wg.Done()
   185  			}
   186  			ret[i] = ec.marshalNCheckIssue8962ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐCheckIssue896(ctx, sel, v[i])
   187  		}
   188  		if isLen1 {
   189  			f(i)
   190  		} else {
   191  			go f(i)
   192  		}
   193  
   194  	}
   195  	wg.Wait()
   196  
   197  	for _, e := range ret {
   198  		if e == graphql.Null {
   199  			return graphql.Null
   200  		}
   201  	}
   202  
   203  	return ret
   204  }
   205  
   206  func (ec *executionContext) marshalOCheckIssue8962ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐCheckIssue896(ctx context.Context, sel ast.SelectionSet, v *CheckIssue896) graphql.Marshaler {
   207  	if v == nil {
   208  		return graphql.Null
   209  	}
   210  	return ec._CheckIssue896(ctx, sel, v)
   211  }
   212  
   213  // endregion ***************************** type.gotpl *****************************