Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Operation ¶
Operation represents a GraphQL operation. It can be one of Query, Mutation or Subscription.
type Request ¶
type Request struct {
Query string `json:"query"`
OperationName string `json:"operationName,omitempty"`
Variables map[string]interface{} `json:"variables,omitempty"`
}
Request represents a GraphQL request.
func ParseGraphQLRequest ¶
ParseGraphQLRequest parses a GraphQL request from an http.Request. It supports GET and POST requests. If the request is a GET request, it expects the query parameter to be present. In case of POST request the Content-Type header must be application/json or application/graphql.
func (Request) Parse ¶
ParseQuery parses a GraphQL request. Return the type of the operation. if OperationName is present in query it returns the same name as Request.OperationName if OperationName is not preset in query it returns an error if OperationName is not specified and there are multiple operations in query it retruns an error if OperationName is not specified and there is only one operation in query it returns the name of that operation if the query has multiple operations with same name it will return the first one