aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/vektah/gqlgen/graphql/response.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/vektah/gqlgen/graphql/response.go')
-rw-r--r--vendor/github.com/vektah/gqlgen/graphql/response.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/vendor/github.com/vektah/gqlgen/graphql/response.go b/vendor/github.com/vektah/gqlgen/graphql/response.go
new file mode 100644
index 00000000..c0dc1c23
--- /dev/null
+++ b/vendor/github.com/vektah/gqlgen/graphql/response.go
@@ -0,0 +1,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...)}},
+ }
+}