github.com/operandinc/gqlgen@v0.16.1/codegen/testserver/followschema/issue896.generated.go (about)

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