github.com/operandinc/gqlgen@v0.16.1/codegen/testserver/followschema/builtinscalar.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  
     9  	"github.com/operandinc/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) _Map_id(ctx context.Context, field graphql.CollectedField, obj *Map) (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:     "Map",
    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.ID, nil
    46  	})
    47  
    48  	if resTmp == nil {
    49  		if !graphql.HasFieldError(ctx, fc) {
    50  			ec.Errorf(ctx, "must not be null")
    51  		}
    52  		return graphql.Null
    53  	}
    54  	res := resTmp.(string)
    55  	fc.Result = res
    56  	return ec.marshalNID2string(ctx, field.Selections, res)
    57  }
    58  
    59  // endregion **************************** field.gotpl *****************************
    60  
    61  // region    **************************** input.gotpl *****************************
    62  
    63  // endregion **************************** input.gotpl *****************************
    64  
    65  // region    ************************** interface.gotpl ***************************
    66  
    67  // endregion ************************** interface.gotpl ***************************
    68  
    69  // region    **************************** object.gotpl ****************************
    70  
    71  var mapImplementors = []string{"Map"}
    72  
    73  func (ec *executionContext) _Map(ctx context.Context, sel ast.SelectionSet, obj *Map) graphql.Marshaler {
    74  	fields := graphql.CollectFields(ec.OperationContext, sel, mapImplementors)
    75  	out := graphql.NewFieldSet(fields)
    76  	var invalids uint32
    77  	for i, field := range fields {
    78  		switch field.Name {
    79  		case "__typename":
    80  			out.Values[i] = graphql.MarshalString("Map")
    81  		case "id":
    82  			innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
    83  				return ec._Map_id(ctx, field, obj)
    84  			}
    85  
    86  			out.Values[i] = innerFunc(ctx)
    87  
    88  			if out.Values[i] == graphql.Null {
    89  				invalids++
    90  			}
    91  		default:
    92  			panic("unknown field " + strconv.Quote(field.Name))
    93  		}
    94  	}
    95  	out.Dispatch()
    96  	if invalids > 0 {
    97  		return graphql.Null
    98  	}
    99  	return out
   100  }
   101  
   102  // endregion **************************** object.gotpl ****************************
   103  
   104  // region    ***************************** type.gotpl *****************************
   105  
   106  // endregion ***************************** type.gotpl *****************************