Documentation ¶
Overview ¶
Package graphql provides utilties to deal with graphql calls
Limitations:
- Variables with properties are not supported (example: $user.id)
Index ¶
- type Argument
- type ArgumentDefinition
- type Arguments
- type Directive
- type Document
- type EnumDefinition
- type EnumValue
- type Field
- type FieldDefinition
- type FragmentDefinition
- type FragmentSpread
- type InlineFragment
- type Interface
- type Operation
- type OperationType
- type Selection
- type SelectionSet
- type Type
- type TypeDefinition
- type TypeExtension
- type Value
- type Variable
- type VariableDefinition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Argument ¶
type Argument struct { Name string Value interface{} }
Argument is an argument to a Field Call.
type ArgumentDefinition ¶
ArgumentDefinition defines an argument for a field on a type.
type Directive ¶
type Directive struct { Name string Type *Type `json:",omitempty"` Value *Value `json:",omitempty"` }
Directive describes a directive which can alter behavior in different parts of a GraphQL Operation.
type Document ¶
type Document struct { Operations []Operation FragmentDefinitions []FragmentDefinition `json:",omitempty"` EnumDefinitions []EnumDefinition `json:",omitempty"` TypeDefinitions []TypeDefinition `json:",omitempty"` TypeExtensions []TypeExtension `json:",omitempty"` }
Document is the top-level representation of a string in GraphQL.
type EnumDefinition ¶
EnumDefinition defines an enum.
type Field ¶
type Field struct { Name string `json:",omitempty"` Arguments Arguments `json:",omitempty"` SelectionSet SelectionSet `json:",omitempty"` Alias string `json:",omitempty"` Directives []Directive `json:",omitempty"` }
A Field is one of the most important concepts in GraphQL. Fields specify what parts of data you would like to select.
type FieldDefinition ¶
type FieldDefinition struct { Name string Type Type ArgumentDefinitions []ArgumentDefinition `json:",omitempty"` }
FieldDefinition defines a fields on a type.
type FragmentDefinition ¶
type FragmentDefinition struct { Name string TypeCondition string SelectionSet SelectionSet Directives []Directive `json:",omitempty"` }
FragmentDefinition defines a Query Fragment
type FragmentSpread ¶
type FragmentSpread struct { Name string `json:",omitempty"` Directives []Directive `json:",omitempty"` }
FragmentSpread is a reference to a QueryFragment elsewhere in an Operation.
type InlineFragment ¶
type InlineFragment struct { TypeCondition string `json:",omitempty"` Directives []Directive `json:",omitempty"` SelectionSet SelectionSet }
InlineFragment is used in-line to apply a type condition within a selection.
type Interface ¶
type Interface struct{}
Interface descibes a set of methods a type must conform to to satisfy it. TODO
type Operation ¶
type Operation struct { Type OperationType `json:",omitempty"` Name string `json:",omitempty"` SelectionSet SelectionSet `json:",omitempty"` VariableDefinitions []VariableDefinition `json:",omitempty"` Directives []Directive `json:",omitempty"` }
Operation is either a read or mutation in GraphQL.
type OperationType ¶
type OperationType string
OperationType is either "query" or "mutation" Queries are reads and mutations cause side-effects.
const ( // OperationQuery is a read operation. OperationQuery OperationType = "query" // OperationMutation is a mutation. OperationMutation OperationType = "mutation" )
type Selection ¶
type Selection struct { Field *Field `json:",omitempty"` FragmentSpread *FragmentSpread `json:",omitempty"` InlineFragment *InlineFragment `json:",omitempty"` }
A Selection is either a Field, a FragmentSpread, or an InlineFragment
type TypeDefinition ¶
type TypeDefinition struct { Name string Interfaces []Interface `json:",omitempty"` FieldDefinitions []FieldDefinition }
TypeDefinition defines a type.
type TypeExtension ¶
type TypeExtension struct { Name string Interfaces []Interface `json:",omitempty"` FieldDefinitions []FieldDefinition }
TypeExtension extends an existing type.
type VariableDefinition ¶
type VariableDefinition struct { Variable Variable Type Type DefaultValue *Value `json:",omitempty"` }
VariableDefinition defines a variable for an Operation.
Directories ¶
Path | Synopsis |
---|---|
Package example contains usage examples.
|
Package example contains usage examples. |
basic_graphql_server
Program basic_graphql_server shows a simple HTTP server that exposes a bare schema.
|
Program basic_graphql_server shows a simple HTTP server that exposes a bare schema. |
Package executor produces results from a graphql Operation and Schema.
|
Package executor produces results from a graphql Operation and Schema. |
resolver
Package resolver exposes the Resolver interface
|
Package resolver exposes the Resolver interface |
tracer
Package tracer provides an interface to attach execution metadata to a context.
|
Package tracer provides an interface to attach execution metadata to a context. |
Package handler implements an HTTP interface to a Schema.
|
Package handler implements an HTTP interface to a Schema. |
internal
|
|
Package parser implements an experimental parser for a subset of graphql.
|
Package parser implements an experimental parser for a subset of graphql. |
Package schema provides the ability to register objects to be exposed via a graphql api.
|
Package schema provides the ability to register objects to be exposed via a graphql api. |