github.com/apipluspower/gqlgen@v0.15.2/codegen/testserver/followschema/ptr_to_slice.generated.go (about)

     1  // Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
     2  
     3  package followschema
     4  
     5  import (
     6  	"context"
     7  	"strconv"
     8  
     9  	"github.com/apipluspower/gqlgen/graphql"
    10  	"github.com/vektah/gqlparser/v2/ast"
    11  )
    12  
    13  // region    ************************** generated!.gotpl **************************
    14  
    15  // endregion ************************** generated!.gotpl **************************
    16  
    17  // region    ***************************** args.gotpl *****************************
    18  
    19  // endregion ***************************** args.gotpl *****************************
    20  
    21  // region    ************************** directives.gotpl **************************
    22  
    23  // endregion ************************** directives.gotpl **************************
    24  
    25  // region    **************************** field.gotpl *****************************
    26  
    27  func (ec *executionContext) _PtrToSliceContainer_ptrToSlice(ctx context.Context, field graphql.CollectedField, obj *PtrToSliceContainer) (ret graphql.Marshaler) {
    28  	defer func() {
    29  		if r := recover(); r != nil {
    30  			ec.Error(ctx, ec.Recover(ctx, r))
    31  			ret = graphql.Null
    32  		}
    33  	}()
    34  	fc := &graphql.FieldContext{
    35  		Object:     "PtrToSliceContainer",
    36  		Field:      field,
    37  		Args:       nil,
    38  		IsMethod:   false,
    39  		IsResolver: false,
    40  	}
    41  
    42  	ctx = graphql.WithFieldContext(ctx, fc)
    43  	resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
    44  		ctx = rctx // use context from middleware stack in children
    45  		return obj.PtrToSlice, nil
    46  	})
    47  
    48  	if resTmp == nil {
    49  		return graphql.Null
    50  	}
    51  	res := resTmp.(*[]string)
    52  	fc.Result = res
    53  	return ec.marshalOString2ᚖᚕstringᚄ(ctx, field.Selections, res)
    54  }
    55  
    56  // endregion **************************** field.gotpl *****************************
    57  
    58  // region    **************************** input.gotpl *****************************
    59  
    60  // endregion **************************** input.gotpl *****************************
    61  
    62  // region    ************************** interface.gotpl ***************************
    63  
    64  // endregion ************************** interface.gotpl ***************************
    65  
    66  // region    **************************** object.gotpl ****************************
    67  
    68  var ptrToSliceContainerImplementors = []string{"PtrToSliceContainer"}
    69  
    70  func (ec *executionContext) _PtrToSliceContainer(ctx context.Context, sel ast.SelectionSet, obj *PtrToSliceContainer) graphql.Marshaler {
    71  	fields := graphql.CollectFields(ec.OperationContext, sel, ptrToSliceContainerImplementors)
    72  	out := graphql.NewFieldSet(fields)
    73  	var invalids uint32
    74  	for i, field := range fields {
    75  		switch field.Name {
    76  		case "__typename":
    77  			out.Values[i] = graphql.MarshalString("PtrToSliceContainer")
    78  		case "ptrToSlice":
    79  			innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
    80  				return ec._PtrToSliceContainer_ptrToSlice(ctx, field, obj)
    81  			}
    82  
    83  			out.Values[i] = innerFunc(ctx)
    84  
    85  		default:
    86  			panic("unknown field " + strconv.Quote(field.Name))
    87  		}
    88  	}
    89  	out.Dispatch()
    90  	if invalids > 0 {
    91  		return graphql.Null
    92  	}
    93  	return out
    94  }
    95  
    96  // endregion **************************** object.gotpl ****************************
    97  
    98  // region    ***************************** type.gotpl *****************************
    99  
   100  func (ec *executionContext) marshalNPtrToSliceContainer2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐPtrToSliceContainer(ctx context.Context, sel ast.SelectionSet, v PtrToSliceContainer) graphql.Marshaler {
   101  	return ec._PtrToSliceContainer(ctx, sel, &v)
   102  }
   103  
   104  func (ec *executionContext) marshalNPtrToSliceContainer2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐPtrToSliceContainer(ctx context.Context, sel ast.SelectionSet, v *PtrToSliceContainer) graphql.Marshaler {
   105  	if v == nil {
   106  		if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
   107  			ec.Errorf(ctx, "must not be null")
   108  		}
   109  		return graphql.Null
   110  	}
   111  	return ec._PtrToSliceContainer(ctx, sel, v)
   112  }
   113  
   114  // endregion ***************************** type.gotpl *****************************