aboutsummaryrefslogblamecommitdiffstats
path: root/vendor/github.com/99designs/gqlgen/graphql/response.go
blob: 18664dca05c02bc79898f7299235dfab85dbd46e (plain) (tree)
1
2
3
4
5
6
7
8





                       

                                              



                                            
                                                        



                                                                                         
                                                                                 

         
package graphql

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

	"github.com/vektah/gqlparser/gqlerror"
)

type Response struct {
	Data   json.RawMessage `json:"data"`
	Errors gqlerror.List   `json:"errors,omitempty"`
}

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