Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InvokeMiddleware ¶
func InvokeMiddleware(middleware GraphqlMiddleware, userValues map[string][]byte, schema, request string) (result string, err error)
InvokeMiddleware is a one off middleware invocation helper This should only be used for testing as it's a waste of resources It makes use of panics to don't use this in production!
Types ¶
type ContextMiddleware ¶
type ContextMiddleware struct {
}
ContextMiddleware does rewrite graphql requests based on schema annotations using a provided context object as input
example schema:
type Query {
documents: [Document] @addArgumentFromContext(name: "user",contextKey: "user")
}
given there's an object with key "user" and value "jsmith@example.org" in the context
original Request:
query myDocuments {
documents {
sensitiveInformation
}
}
Request after rewriting:
query myDocuments {
documents(user: "jsmith@example.org") {
sensitiveInformation
}
}
func (*ContextMiddleware) OnResponse ¶
type ContextRewriteConfig ¶
type ContextRewriteConfig struct {
// contains filtered or unexported fields
}
type GraphqlMiddleware ¶
type GraphqlMiddleware interface {
OnRequest(userValues map[string][]byte, l *lookup.Lookup, w *lookup.Walker, parser *parser.Parser, mod *parser.ManualAstMod) error
OnResponse(userValues map[string][]byte, response *[]byte, l *lookup.Lookup, w *lookup.Walker, parser *parser.Parser, mod *parser.ManualAstMod) error
}
type Invoker ¶
type Invoker struct {
// contains filtered or unexported fields
}
func NewInvoker ¶
func NewInvoker(middleWares ...GraphqlMiddleware) *Invoker
func (*Invoker) InvokeMiddleWares ¶
type InvokerPool ¶ added in v1.4.0
type InvokerPool struct {
// contains filtered or unexported fields
}
func NewInvokerPool ¶ added in v1.4.0
func NewInvokerPool(size int, middleWares ...GraphqlMiddleware) *InvokerPool
func (*InvokerPool) Free ¶ added in v1.4.0
func (i *InvokerPool) Free(index int)
func (*InvokerPool) Get ¶ added in v1.4.0
func (i *InvokerPool) Get() (index int, invoker *Invoker)
type ValidationMiddleware ¶ added in v1.4.0
type ValidationMiddleware struct {
}
ValidationMiddleware is a middleware which validates the input Query against the Schema definition
func (*ValidationMiddleware) OnResponse ¶ added in v1.4.0
Click to show internal directories.
Click to hide internal directories.