Documentation ¶
Index ¶
- Variables
- func CanonicalModelName(modelName string) string
- func IntrospectionHandler(rw ResponseWriter, r *Request)
- func NewHandler(h Handler, schema *graphql.Schema) http.HandlerFunc
- func UnmarshalBoolean(raw string) (interface{}, error)
- func UnmarshalDateTime(raw string) (interface{}, error)
- func UnmarshalFloat(raw string) (interface{}, error)
- func UnmarshalInt(raw string) (interface{}, error)
- func UnmarshalString(raw string) (interface{}, error)
- type Decoder
- type ErrConstraintNotFound
- type ErrUnsupportedType
- type Handler
- type HandlerFunc
- type Mapper
- type Request
- type ResponseWriter
- type RoutingTable
- type Schema
- func (s *Schema) AddCreateOp(model *activerecord.Relation, action actioncontroller.Action) *graphql.FieldDefinition
- func (s *Schema) AddDestroyOp(model *activerecord.Relation) *graphql.FieldDefinition
- func (s *Schema) AddIndexOp(model *activerecord.Relation) *graphql.FieldDefinition
- func (s *Schema) AddModel(model *activerecord.Relation) *graphql.Definition
- func (s *Schema) AddShowOp(model *activerecord.Relation) *graphql.FieldDefinition
- type SchemaReflect
- type TypeReflect
- type Unmarshaler
- type UnmarshalerFunc
Constants ¶
This section is empty.
Variables ¶
var Boolean = &graphql.Definition{ Kind: graphql.Scalar, Name: "Boolean", Description: "Represents true of false.", }
Boolean is a scalar type that represents true or false.
var DateTime = &graphql.Definition{ Kind: graphql.Scalar, Name: "DateTime", }
var DefaultDecoder = new(Decoder)
var Float = &graphql.Definition{ Kind: graphql.Scalar, Name: "Float", Description: "A signed double-precision finite value as specified by IEEE 754.", }
Float is a scalar type that represents signed double-precision finite values as specified by IEEE 754.
var Int = &graphql.Definition{ Kind: graphql.Scalar, Name: "Int", Description: "A signed 32-bit numeric non-fractional value.", }
Int is a scalar type that represents a signed 32-bit numeric non-fractional value.
var String = &graphql.Definition{ Kind: graphql.Scalar, Name: "String", Description: "A sequence of Unicode code points.", }
String is a scalar type that represents a sequence of Unicode code points.
Functions ¶
func CanonicalModelName ¶
func IntrospectionHandler ¶
func IntrospectionHandler(rw ResponseWriter, r *Request)
func NewHandler ¶
func NewHandler(h Handler, schema *graphql.Schema) http.HandlerFunc
NewHandler returns a new HTTP handler that attempts to parse GraphQL request from URL, body, or form and executes request using the specifies schema.
On failed request parsing and execution method writes plain error message as a response.
func UnmarshalBoolean ¶
func UnmarshalDateTime ¶
func UnmarshalFloat ¶
func UnmarshalInt ¶
func UnmarshalString ¶
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder decodes GraphQL values.
func (*Decoder) RegisterName ¶
func (d *Decoder) RegisterName(name string, unmarshaler Unmarshaler)
RegisterName registers the type unmarshaler under the given name.
type ErrConstraintNotFound ¶
func (ErrConstraintNotFound) Error ¶
func (e ErrConstraintNotFound) Error() string
type ErrUnsupportedType ¶
ErrUnsupportedType is returned by Decoder when attempting to decode an unsupported value type.
func (ErrUnsupportedType) Error ¶
func (e ErrUnsupportedType) Error() string
type Handler ¶
type Handler interface {
Serve(ResponseWriter, *Request)
}
Handler responds to a GraphQL request.
Serve would write the reply to the ResponseWriter and then returns. Returning signals that the request is finished.
type HandlerFunc ¶
type HandlerFunc func(ResponseWriter, *Request)
func (HandlerFunc) Serve ¶
func (fn HandlerFunc) Serve(rw ResponseWriter, r *Request)
type Mapper ¶
type Mapper struct {
// contains filtered or unexported fields
}
func (*Mapper) Match ¶
func (m *Mapper) Match( via, path string, action actioncontroller.Action, constraints ...actioncontroller.Constraints, )
func (*Mapper) Resources ¶
func (m *Mapper) Resources( model actioncontroller.AbstractModel, controller actioncontroller.AbstractController, )
type Request ¶
type Request struct { Query string `json:"query"` Variables map[string]interface{} `json:"variables"` OperationName string `json:"operationName"` // Header contains the request underlying HTTP header fields. // // These headers must be provided by the underlying HTTP request. Header http.Header // contains filtered or unexported fields }
Request represents a GraphQL request received by server or to be sent by a client.
func ParseRequest ¶
ParseRequest parses HTTP request and returns GraphQL request instance that contains all required parameters.
This function supports requests provided as part of URL parameters, within body as pure GraphQL request, within body as JSON request, and as part of form request.
Method ensures that query contains a valid GraphQL document and returns an error if it's not true.
type ResponseWriter ¶
ResponseWriter interface is used by a GraphQL handler to construct a response.
type RoutingTable ¶
type RoutingTable struct {
// contains filtered or unexported fields
}
func NewRoutingTable ¶
func NewRoutingTable() *RoutingTable
func (*RoutingTable) AddOperation ¶
func (rt *RoutingTable) AddOperation(name string, action actioncontroller.Action)
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
func (*Schema) AddCreateOp ¶
func (s *Schema) AddCreateOp( model *activerecord.Relation, action actioncontroller.Action, ) *graphql.FieldDefinition
func (*Schema) AddDestroyOp ¶
func (s *Schema) AddDestroyOp(model *activerecord.Relation) *graphql.FieldDefinition
func (*Schema) AddIndexOp ¶
func (s *Schema) AddIndexOp(model *activerecord.Relation) *graphql.FieldDefinition
func (*Schema) AddModel ¶
func (s *Schema) AddModel(model *activerecord.Relation) *graphql.Definition
func (*Schema) AddShowOp ¶
func (s *Schema) AddShowOp(model *activerecord.Relation) *graphql.FieldDefinition
type SchemaReflect ¶
type SchemaReflect struct {
// contains filtered or unexported fields
}
type TypeReflect ¶
type TypeReflect struct {
// contains filtered or unexported fields
}
func (*TypeReflect) Introspect ¶
func (t *TypeReflect) Introspect() activesupport.Hash
func (*TypeReflect) Kind ¶
func (t *TypeReflect) Kind() string
type Unmarshaler ¶
type UnmarshalerFunc ¶
UnmarshalerFunc is a function adapter for Unmarshaler interface.
func (UnmarshalerFunc) Unmarshal ¶
func (fn UnmarshalerFunc) Unmarshal(raw string) (interface{}, error)