github.com/Kartograf/gqlgen@v0.7.2/example/type-system-extension/directive.go (about)

     1  package type_system_extension
     2  
     3  import (
     4  	"context"
     5  	"log"
     6  
     7  	"github.com/99designs/gqlgen/graphql"
     8  )
     9  
    10  func EnumLogging(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) {
    11  	rc := graphql.GetResolverContext(ctx)
    12  	log.Printf("enum logging: %v, %s, %T, %+v", rc.Path(), rc.Field.Name, obj, obj)
    13  	return next(ctx)
    14  }
    15  
    16  func FieldLogging(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) {
    17  	rc := graphql.GetResolverContext(ctx)
    18  	log.Printf("field logging: %v, %s, %T, %+v", rc.Path(), rc.Field.Name, obj, obj)
    19  	return next(ctx)
    20  }
    21  
    22  func InputLogging(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) {
    23  	rc := graphql.GetResolverContext(ctx)
    24  	log.Printf("input object logging: %v, %s, %T, %+v", rc.Path(), rc.Field.Name, obj, obj)
    25  	return next(ctx)
    26  }
    27  
    28  func ObjectLogging(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) {
    29  	rc := graphql.GetResolverContext(ctx)
    30  	log.Printf("object logging: %v, %s, %T, %+v", rc.Path(), rc.Field.Name, obj, obj)
    31  	return next(ctx)
    32  }
    33  
    34  func ScalarLogging(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) {
    35  	rc := graphql.GetResolverContext(ctx)
    36  	log.Printf("scalar logging: %v, %s, %T, %+v", rc.Path(), rc.Field.Name, obj, obj)
    37  	return next(ctx)
    38  }
    39  
    40  func UnionLogging(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) {
    41  	rc := graphql.GetResolverContext(ctx)
    42  	log.Printf("union logging: %v, %s, %T, %+v", rc.Path(), rc.Field.Name, obj, obj)
    43  	return next(ctx)
    44  }