Documentation ¶
Overview ¶
Most of this file was reused from the ecoding/json package, since we want to use the same json encoding.
Most of this file was reused from the ecoding/json package, since we want to use the same json encoding.
Index ¶
- Constants
- Variables
- func Dereference(value reflect.Value) reflect.Value
- func TryCastFunction(value reflect.Value, toType string) (v reflect.Value, ok bool)
- type Cache
- type DirectiveResolver
- type ExecutionContext
- type Func
- type RawMessage
- type Resolution
- type ResolveRequest
- type Resolver
- type ResolverList
- type TypeAndFieldKey
- type TypeAndFieldResolver
- type TypeResolver
- type ValueWithContext
Constants ¶
const FieldResolver = fieldResolver(0)
const MapResolver = mapResolver(0)
const MetadataResolver = metadataResolver(0)
const MethodResolver = methodResolver(0)
Variables ¶
var NilResolver = nilResolver(0)
Functions ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func (*Cache) GetOrElseUpdate ¶
func (cache *Cache) GetOrElseUpdate(key interface{}, create func() interface{}) (x interface{})
type DirectiveResolver ¶
type DirectiveResolver struct { Directive string Create func(request *ResolveRequest, next Resolution, args map[string]interface{}) Resolution }
/////////////////////////////////////////////////////////////////////
DirectiveResolver gets applied to fields or types that have a given directive
/////////////////////////////////////////////////////////////////////
func (DirectiveResolver) Resolve ¶
func (factory DirectiveResolver) Resolve(request *ResolveRequest, next Resolution) Resolution
type ExecutionContext ¶
type ExecutionContext interface { GetRoot() interface{} FireSubscriptionEvent(value reflect.Value, err error) FireSubscriptionClose() GetSchema() *schema.Schema GetContext() context.Context GetLimiter() *chan byte HandlePanic(selectionPath []string) error GetQuery() string GetDocument() *schema.QueryDocument GetOperation() *schema.Operation GetVars() map[string]interface{} }
type Func ¶
type Func func(request *ResolveRequest, next Resolution) Resolution
func (Func) Resolve ¶
func (f Func) Resolve(request *ResolveRequest, next Resolution) Resolution
type RawMessage ¶
type RawMessage json.RawMessage
When RawMessage is the result of a Resolution, for a field, no sub field resolution performed.
type Resolution ¶
type ResolveRequest ¶
type ResolveRequest struct { Context context.Context ExecutionContext ExecutionContext ParentResolve *ResolveRequest SelectionPath func() []string ParentType schema.Type Parent reflect.Value Field *schema.Field Args map[string]interface{} Selection *schema.FieldSelection }
func (*ResolveRequest) RunAsync ¶
func (this *ResolveRequest) RunAsync(resolver Resolution) Resolution
type Resolver ¶
type Resolver interface { // Resolve allows you to inspect a ResolveRequest to see if your resolver can resolve it. // If you can resolve it, return a new Resolution that computes the value of the field. // If you don't know how to resolve that request, return next. // // The next variable hold the Resolution of the previous resolver, this allows your resolver // to filter it's results. next may be nil if no resolution has been found yet. Resolve(request *ResolveRequest, next Resolution) Resolution }
func DynamicResolverFactory ¶
func DynamicResolverFactory() Resolver
func Sniff ¶
func Sniff(sniffer func(request *ResolveRequest, next Resolution)) Resolver
Sniff allows you see resolution requests, but does not impact them
type ResolverList ¶
type ResolverList []Resolver
/////////////////////////////////////////////////////////////////////
ResolverFactoryList uses a list of other resolvers to resolve requests. Last resolver wins.
/////////////////////////////////////////////////////////////////////
func List ¶
func List(factories ...Resolver) *ResolverList
func (*ResolverList) Add ¶
func (this *ResolverList) Add(factory Resolver)
func (*ResolverList) Resolve ¶
func (this *ResolverList) Resolve(request *ResolveRequest, next Resolution) Resolution
type TypeAndFieldKey ¶
type TypeAndFieldResolver ¶
type TypeAndFieldResolver map[TypeAndFieldKey]Func
func (TypeAndFieldResolver) Resolve ¶
func (r TypeAndFieldResolver) Resolve(request *ResolveRequest, next Resolution) Resolution
type TypeResolver ¶
func (TypeResolver) Resolve ¶
func (this TypeResolver) Resolve(request *ResolveRequest, next Resolution) Resolution
func (TypeResolver) Set ¶
func (this TypeResolver) Set(typeName string, factory Resolver)
Source Files ¶
- async.go
- cache.go
- cast.go
- directive_resolver.go
- dynamic_resolver.go
- field_resolver.go
- field_resolver_reflect.go
- map_resolver.go
- metadata_resolver.go
- method_resolver.go
- method_resolver_reflect.go
- nil_resolver.go
- resolver_func.go
- resolver_list.go
- resolvers.go
- type_and_field_resolver.go
- type_resolver.go
- value.go