1package graphql 2 3import ( 4 "github.com/graphql-go/graphql/gqlerrors" 5) 6 7// type Schema interface{} 8 9// Result has the response, errors and extensions from the resolved schema 10type Result struct { 11 Data interface{} `json:"data"` 12 Errors []gqlerrors.FormattedError `json:"errors,omitempty"` 13 Extensions map[string]interface{} `json:"extensions,omitempty"` 14} 15 16// HasErrors just a simple function to help you decide if the result has errors or not 17func (r *Result) HasErrors() bool { 18 return len(r.Errors) > 0 19} 20