Documentation ¶
Index ¶
- Variables
- func AddError(ctx context.Context, err error)
- func AddErrorf(ctx context.Context, format string, args ...interface{})
- func DefaultRecover(ctx context.Context, err interface{}) error
- func DefaultRequestMiddleware(ctx context.Context, next func(ctx context.Context) []byte) []byte
- func DefaultResolverMiddleware(ctx context.Context, next Resolver) (res interface{}, err error)
- func OneShot(resp *Response) func() *Response
- func UnmarshalBoolean(v interface{}) (bool, error)
- func UnmarshalFloat(v interface{}) (float64, error)
- func UnmarshalID(v interface{}) (string, error)
- func UnmarshalInt(v interface{}) (int, error)
- func UnmarshalMap(v interface{}) (map[string]interface{}, error)
- func UnmarshalString(v interface{}) (string, error)
- func UnmarshalTime(v interface{}) (time.Time, error)
- func WithRequestContext(ctx context.Context, rc *RequestContext) context.Context
- func WithResolverContext(ctx context.Context, rc *ResolverContext) context.Context
- type Array
- type CollectedField
- type Error
- type ErrorLocation
- type ErrorPresenterFunc
- type ExecutableSchema
- type ExtendedError
- type Marshaler
- func Defer(f func() Marshaler) Marshaler
- func MarshalBoolean(b bool) Marshaler
- func MarshalFloat(f float64) Marshaler
- func MarshalID(s string) Marshaler
- func MarshalInt(i int) Marshaler
- func MarshalMap(val map[string]interface{}) Marshaler
- func MarshalString(s string) Marshaler
- func MarshalTime(t time.Time) Marshaler
- type OrderedMap
- type RecoverFunc
- type RequestContext
- type RequestMiddleware
- type Resolver
- type ResolverContext
- type ResolverMiddleware
- type Response
- type Unmarshaler
- type WriterFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var False = lit(falseLit)
View Source
var Null = lit(nullLit)
View Source
var True = lit(trueLit)
Functions ¶
func DefaultRecover ¶
func UnmarshalBoolean ¶
func UnmarshalFloat ¶
func UnmarshalID ¶
func UnmarshalInt ¶
func UnmarshalMap ¶
func UnmarshalString ¶
func UnmarshalTime ¶
func WithRequestContext ¶
func WithRequestContext(ctx context.Context, rc *RequestContext) context.Context
func WithResolverContext ¶
func WithResolverContext(ctx context.Context, rc *ResolverContext) context.Context
Types ¶
type CollectedField ¶
type CollectedField struct { Alias string Name string Args map[string]interface{} Selections []query.Selection }
func CollectFields ¶
func CollectFieldsCtx ¶
func CollectFieldsCtx(ctx context.Context, satisfies []string) []CollectedField
This is just a convenient wrapper method for CollectFields
type Error ¶
type Error struct { Message string `json:"message"` Path []interface{} `json:"path,omitempty"` Locations []ErrorLocation `json:"locations,omitempty"` Extensions map[string]interface{} `json:"extensions,omitempty"` }
Error is the standard graphql error type described in https://facebook.github.io/graphql/draft/#sec-Errors
type ErrorLocation ¶
type ExecutableSchema ¶
type ExtendedError ¶
type ExtendedError interface {
Extensions() map[string]interface{}
}
type Marshaler ¶
func Defer ¶
Defer will begin executing the given function and immediately return a result that will block until the function completes
func MarshalBoolean ¶
func MarshalFloat ¶
func MarshalInt ¶
func MarshalMap ¶
func MarshalString ¶
func MarshalTime ¶
type OrderedMap ¶
func NewOrderedMap ¶
func NewOrderedMap(len int) *OrderedMap
func (*OrderedMap) Add ¶
func (m *OrderedMap) Add(key string, value Marshaler)
func (*OrderedMap) MarshalGQL ¶
func (m *OrderedMap) MarshalGQL(writer io.Writer)
type RecoverFunc ¶
type RequestContext ¶
type RequestContext struct { RawQuery string Variables map[string]interface{} Doc *query.Document // ErrorPresenter will be used to generate the error // message from errors given to Error(). ErrorPresenter ErrorPresenterFunc Recover RecoverFunc ResolverMiddleware ResolverMiddleware RequestMiddleware RequestMiddleware Errors []*Error // contains filtered or unexported fields }
func GetRequestContext ¶
func GetRequestContext(ctx context.Context) *RequestContext
func NewRequestContext ¶
func NewRequestContext(doc *query.Document, query string, variables map[string]interface{}) *RequestContext
type RequestMiddleware ¶
type ResolverContext ¶
type ResolverContext struct { // The name of the type this field belongs to Object string // These are the args after processing, they can be mutated in middleware to change what the resolver will get. Args map[string]interface{} // The raw field Field CollectedField // The path of fields to get to this resolver Path []interface{} }
func GetResolverContext ¶
func GetResolverContext(ctx context.Context) *ResolverContext
func (*ResolverContext) Pop ¶
func (r *ResolverContext) Pop()
func (*ResolverContext) PushField ¶
func (r *ResolverContext) PushField(alias string)
func (*ResolverContext) PushIndex ¶
func (r *ResolverContext) PushIndex(index int)
type ResolverMiddleware ¶
type Response ¶
type Response struct { Data json.RawMessage `json:"data"` Errors []*Error `json:"errors,omitempty"` }
type Unmarshaler ¶
type Unmarshaler interface {
UnmarshalGQL(v interface{}) error
}
type WriterFunc ¶
func (WriterFunc) MarshalGQL ¶
func (f WriterFunc) MarshalGQL(w io.Writer)
Click to show internal directories.
Click to hide internal directories.