...

Source file src/github.com/99designs/gqlgen/codegen/testserver/followschema/builtinscalar.generated.go

Documentation: github.com/99designs/gqlgen/codegen/testserver/followschema

     1  // Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
     2  
     3  package followschema
     4  
     5  import (
     6  	"context"
     7  	"errors"
     8  	"strconv"
     9  	"sync/atomic"
    10  
    11  	"github.com/99designs/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) _Map_id(ctx context.Context, field graphql.CollectedField, obj *Map) (ret graphql.Marshaler) {
    30  	fc, err := ec.fieldContext_Map_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  		if !graphql.HasFieldError(ctx, fc) {
    48  			ec.Errorf(ctx, "must not be null")
    49  		}
    50  		return graphql.Null
    51  	}
    52  	res := resTmp.(string)
    53  	fc.Result = res
    54  	return ec.marshalNID2string(ctx, field.Selections, res)
    55  }
    56  
    57  func (ec *executionContext) fieldContext_Map_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
    58  	fc = &graphql.FieldContext{
    59  		Object:     "Map",
    60  		Field:      field,
    61  		IsMethod:   false,
    62  		IsResolver: false,
    63  		Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
    64  			return nil, errors.New("field of type ID does not have child fields")
    65  		},
    66  	}
    67  	return fc, nil
    68  }
    69  
    70  // endregion **************************** field.gotpl *****************************
    71  
    72  // region    **************************** input.gotpl *****************************
    73  
    74  // endregion **************************** input.gotpl *****************************
    75  
    76  // region    ************************** interface.gotpl ***************************
    77  
    78  // endregion ************************** interface.gotpl ***************************
    79  
    80  // region    **************************** object.gotpl ****************************
    81  
    82  var mapImplementors = []string{"Map"}
    83  
    84  func (ec *executionContext) _Map(ctx context.Context, sel ast.SelectionSet, obj *Map) graphql.Marshaler {
    85  	fields := graphql.CollectFields(ec.OperationContext, sel, mapImplementors)
    86  
    87  	out := graphql.NewFieldSet(fields)
    88  	deferred := make(map[string]*graphql.FieldSet)
    89  	for i, field := range fields {
    90  		switch field.Name {
    91  		case "__typename":
    92  			out.Values[i] = graphql.MarshalString("Map")
    93  		case "id":
    94  			out.Values[i] = ec._Map_id(ctx, field, obj)
    95  			if out.Values[i] == graphql.Null {
    96  				out.Invalids++
    97  			}
    98  		default:
    99  			panic("unknown field " + strconv.Quote(field.Name))
   100  		}
   101  	}
   102  	out.Dispatch(ctx)
   103  	if out.Invalids > 0 {
   104  		return graphql.Null
   105  	}
   106  
   107  	atomic.AddInt32(&ec.deferred, int32(len(deferred)))
   108  
   109  	for label, dfs := range deferred {
   110  		ec.processDeferredGroup(graphql.DeferredGroup{
   111  			Label:    label,
   112  			Path:     graphql.GetPath(ctx),
   113  			FieldSet: dfs,
   114  			Context:  ctx,
   115  		})
   116  	}
   117  
   118  	return out
   119  }
   120  
   121  // endregion **************************** object.gotpl ****************************
   122  
   123  // region    ***************************** type.gotpl *****************************
   124  
   125  // endregion ***************************** type.gotpl *****************************
   126  

View as plain text