Documentation ¶
Index ¶
- Constants
- func MustMarshalJSON(v map[string]interface{}) []byte
- func MustUnmarshalJSON(data []byte, v any)
- func MustWrite(w io.Writer, s string)
- func MuxWithFuncResponseArray(responses []ResponseFunc) *http.ServeMux
- func MuxWithJSONResponse(response map[string]interface{}) *http.ServeMux
- func MuxWithJSONResponseArray(responses []interface{}) *http.ServeMux
- func MuxWithJSONResponseMap(responses map[string]interface{}) *http.ServeMux
- func NewClient(mux *http.ServeMux) graphql.Client
- func NewClientWithFuncResponseArray(responses []ResponseFunc) graphql.Client
- func NewClientWithJSONResponseArray(responses []interface{}) graphql.Client
- func NewClientWithJSONResponseMap(responses map[string]interface{}) graphql.Client
- func NewClientWithSingleJSONResponse(response map[string]interface{}) graphql.Client
- func ParseInputVariables(req *http.Request) map[string]interface{}
- type GraphQLRequest
- type MutationResponse
- type MutationResponseData
- type MutationResponseMessage
- type QueryResponse
- type ResponseFunc
Constants ¶
View Source
const MockEndpoint string = "/graphql"
Variables ¶
This section is empty.
Functions ¶
func MustMarshalJSON ¶
func MustUnmarshalJSON ¶
func MuxWithFuncResponseArray ¶
func MuxWithFuncResponseArray(responses []ResponseFunc) *http.ServeMux
func MuxWithJSONResponse ¶
func MuxWithJSONResponseMap ¶
func NewClientWithFuncResponseArray ¶
func NewClientWithFuncResponseArray(responses []ResponseFunc) graphql.Client
NewClientWithFuncResponseArray creates a GQL client that will respond with a series of results of handler functions
func NewClientWithJSONResponseArray ¶
Takes an array of responses and creates a graphql client that returns them in order
func NewClientWithJSONResponseMap ¶
Takes a map of graphql operation names to JSON responses and creates a GraphQL client that returns based on operation name
func NewClientWithSingleJSONResponse ¶
Takes a JSON map and creates a GraphQL client that always returns it
func ParseInputVariables ¶
ParseInputVariables parses graphql input variables from request and returns a JSON-ish map
Types ¶
type GraphQLRequest ¶
type MutationResponse ¶
type MutationResponse struct {
Data map[string]MutationResponseData `json:"data"`
}
func MockMutationResponse ¶
func MockMutationResponse(operationName string, result interface{}) MutationResponse
MockMutationResponse creates a successful mutation response from a mutation name and payload
type MutationResponseData ¶
type MutationResponseData struct { Successful bool `json:"successful"` Result interface{} `json:"result"` Messages []MutationResponseMessage `json:"messages"` }
type MutationResponseMessage ¶
type MutationResponseMessage struct {
Message string `json:"message"`
}
type QueryResponse ¶
type QueryResponse struct {
Data map[string]interface{} `json:"data"`
}
func MockQueryResponse ¶
func MockQueryResponse(operationName string, responseData interface{}) QueryResponse
type ResponseFunc ¶
Click to show internal directories.
Click to hide internal directories.