github.com/luciferinlove/gqlgen@v0.17.16-bzc.1/codegen/testserver/followschema/builtinscalar.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  
    10  	"github.com/luciferinlove/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) _Map_id(ctx context.Context, field graphql.CollectedField, obj *Map) (ret graphql.Marshaler) {
    29  	fc, err := ec.fieldContext_Map_id(ctx, field)
    30  	if err != nil {
    31  		return graphql.Null
    32  	}
    33  	ctx = graphql.WithFieldContext(ctx, fc)
    34  	defer func() {
    35  		if r := recover(); r != nil {
    36  			ec.Error(ctx, ec.Recover(ctx, r))
    37  			ret = graphql.Null
    38  		}
    39  	}()
    40  	resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) {
    41  		ctx = rctx // use context from middleware stack in children
    42  		return obj.ID, nil
    43  	})
    44  
    45  	if resTmp == nil {
    46  		if !graphql.HasFieldError(ctx, fc) {
    47  			ec.Errorf(ctx, "must not be null")
    48  		}
    49  		return graphql.Null
    50  	}
    51  	res := resTmp.(string)
    52  	fc.Result = res
    53  	return ec.marshalNID2string(ctx, field.Selections, res)
    54  }
    55  
    56  func (ec *executionContext) fieldContext_Map_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
    57  	fc = &graphql.FieldContext{
    58  		Object:     "Map",
    59  		Field:      field,
    60  		IsMethod:   false,
    61  		IsResolver: false,
    62  		Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
    63  			return nil, errors.New("field of type ID does not have child fields")
    64  		},
    65  	}
    66  	return fc, nil
    67  }
    68  
    69  // endregion **************************** field.gotpl *****************************
    70  
    71  // region    **************************** input.gotpl *****************************
    72  
    73  // endregion **************************** input.gotpl *****************************
    74  
    75  // region    ************************** interface.gotpl ***************************
    76  
    77  // endregion ************************** interface.gotpl ***************************
    78  
    79  // region    **************************** object.gotpl ****************************
    80  
    81  var mapImplementors = []string{"Map"}
    82  
    83  func (ec *executionContext) _Map(ctx context.Context, sel ast.SelectionSet, obj *Map) graphql.Marshaler {
    84  	fields := graphql.CollectFields(ec.OperationContext, sel, mapImplementors)
    85  	out := graphql.NewFieldSet(fields)
    86  	var invalids uint32
    87  	for i, field := range fields {
    88  		switch field.Name {
    89  		case "__typename":
    90  			out.Values[i] = graphql.MarshalString("Map")
    91  		case "id":
    92  
    93  			out.Values[i] = ec._Map_id(ctx, field, obj)
    94  
    95  			if out.Values[i] == graphql.Null {
    96  				invalids++
    97  			}
    98  		default:
    99  			panic("unknown field " + strconv.Quote(field.Name))
   100  		}
   101  	}
   102  	out.Dispatch()
   103  	if invalids > 0 {
   104  		return graphql.Null
   105  	}
   106  	return out
   107  }
   108  
   109  // endregion **************************** object.gotpl ****************************
   110  
   111  // region    ***************************** type.gotpl *****************************
   112  
   113  // endregion ***************************** type.gotpl *****************************