Documentation ¶
Overview ¶
Package graphql offers a param extractor and basic types for building GraphQL requests
Index ¶
Constants ¶
const ( // OperationMutation marks an operation as a mutation OperationMutation OperationType = "mutation" // OperationQuery marks an operation as a query OperationQuery OperationType = "query" MethodPost OperationMethod = http.MethodPost MethodGet OperationMethod = http.MethodGet )
const Namespace = "github.com/devopsfaith/krakend/transport/http/client/graphql"
Namespace is the key for the backend's extra config
Variables ¶
var ErrNoConfigFound = errors.New("grapghql: no configuration found")
Functions ¶
This section is empty.
Types ¶
type Extractor ¶
type Extractor struct {
// contains filtered or unexported fields
}
Extractor exposes two extractor factories: one for the params (query) and one for the request body (mutator)
func (*Extractor) BodyFromBody ¶
BodyFromBody returns a request body containing the graphql request with the given query and the default variables overiden by the request body
func (*Extractor) BodyFromParams ¶
BodyFromParams returns a request body containing the grapql request generated for the given query and the default variables overiden by the request params
func (*Extractor) QueryFromBody ¶
QueryFromBody returns a url.Values containing the graphql request with the given query and the default variables overiden by the request body
type GraphQLRequest ¶
type GraphQLRequest struct { Query string `json:"query"` OperationName string `json:"operationName,omitempty"` Variables map[string]interface{} `json:"variables,omitempty"` }
GraphQLRequest represents the graphql request body
type OperationMethod ¶
type OperationMethod string
OperationMethod details the method to be used with the request
type OperationType ¶
type OperationType string
OperationType contains all the operations allowed by graphql
type Options ¶
type Options struct { GraphQLRequest QueryPath string `json:"query_path,omitempty"` Type OperationType `json:"type"` Method OperationMethod `json:"method"` }
Options defines a GraphQLRequest with a type, so the middlewares know what to do
func GetOptions ¶
func GetOptions(cfg config.ExtraConfig) (*Options, error)
GetOptions extracts the Options config from the backend's extra config