aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/vektah/gqlgen/graphql/response.go
blob: c0dc1c2355e2d1496181db8e3636f03592efa8ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package graphql

import (
	"context"
	"encoding/json"
	"fmt"
)

type Response struct {
	Data   json.RawMessage `json:"data"`
	Errors []*Error        `json:"errors,omitempty"`
}

func ErrorResponse(ctx context.Context, messagef string, args ...interface{}) *Response {
	return &Response{
		Errors: []*Error{{Message: fmt.Sprintf(messagef, args...)}},
	}
}