Documentation
¶
Overview ¶
The module util/graphQL is an implementation of the GraphQL query interface
Index ¶
- Constants
- func Compile(r io.Reader) (*Document, Response)
- func DecodeString(s string) string
- func ExecutableDefinitions(doc *Document) bool
- func GetObjectValueInputField(ov *InputObjectValue, name string, value *Value) bool
- func GetTypeFlatString(t Type) string
- func GetTypeString(t Type) string
- func GetValue(argumentValues *A.Tree, name string, v *Value) bool
- func GetValueFlatString(v Value) string
- func GetValueString(v Value) string
- func InsertJsonValue(t *A.Tree, name string, value J.Value) bool
- func PrintDocument(w io.Writer, doc *Document)
- func ReadGraphQL(name string) (*Document, Response)
- func ReadString(s string) (*Document, Response)
- func ResponseToJson(r Response) J.Json
- func SetDir(td TypeDirectory)
- func SetRComp(rComp io.Reader)
- func Unsubscribe(responseStream *ResponseStream)
- func Unwrap(rootValue *OutputObjectValue, n int) interface{}
- func WriteType(w io.Writer, t Type)
- func WriteTypeFlat(w io.Writer, t Type)
- func WriteValue(w io.Writer, v Value)
- func WriteValueFlat(w io.Writer, v Value)
- type AbstractTypeResolver
- type AnyPtr
- type AnyValue
- type Argument
- type Arguments
- type ArgumentsDefinition
- type BooleanValue
- type Definition
- type Definitions
- type Directive
- type DirectiveDefinition
- type DirectiveLocation
- type DirectiveLocations
- type Directives
- type Document
- type EnumTypeDefinition
- type EnumTypeExtension
- type EnumValue
- type EnumValueDefinition
- type EnumValuesDefinition
- type ErrorElem
- type EventStream
- type EventStreamer
- type ExecSystem
- type ExecutableDefinition
- type ExecutableDirectiveLocation
- type Field
- type FieldDefinition
- type FieldResolver
- type FieldsDefinition
- type FloatValue
- type FragmentDefinition
- type FragmentSpread
- type InlineFragment
- type InputObjectTypeDefinition
- type InputObjectTypeExtension
- type InputObjectValue
- type InputValueDefinition
- type InstantResponse
- type IntValue
- type InterfaceTypeDefinition
- type InterfaceTypeExtension
- type LinkGQL
- type ListType
- type ListValue
- type NameMapItem
- type NamedType
- type NamedTypes
- type NonNullType
- type NullValue
- type ObjectField
- type ObjectTypeDefinition
- type ObjectTypeExtension
- type OperationDefinition
- type OperationTypeDefinition
- type OperationTypeDefinitions
- type OutputObjectValue
- type Path
- type PathBuilder
- type PathNb
- type PathString
- type PosList
- type PosT
- type Response
- type ResponseStream
- type ResponseStreamer
- type ResponseStreams
- type ScalarCoercer
- type ScalarTypeDefinition
- type ScalarTypeExtension
- type Scalarer
- type SchemaDefinition
- type SchemaExtension
- type Selection
- type SelectionSet
- type SourceEventNotification
- type StrArray
- type StrPtr
- type StreamResolver
- type StringValue
- type SubscribeResponse
- type Type
- type TypeDefinition
- type TypeDefinitionCommon
- type TypeDirectory
- type TypeExtension
- type TypeExtensionC
- type TypeSystem
- type TypeSystemDefinition
- type TypeSystemDirectiveLocation
- type TypeSystemExtension
- type UnionTypeDefinition
- type UnionTypeExtension
- type ValMapItem
- type Value
- type ValueElem
- type Variable
- type VariableDefinition
- type VariableDefinitions
Constants ¶
View Source
const ( // Ranks of root operation types in 'typeSystem.root', 'OperationTypeDefinition.OpType' and 'OperationDefinition.OpType' QueryOp = l_QUERY MutationOp = l_MUTATION SubscriptionOp = l_SUBSCRIPTION )
View Source
const (
// Prefix added to error messages
ErrorPrefix = "#util/graphQL:"
)
Variables ¶
This section is empty.
Functions ¶
func DecodeString ¶
func ExecutableDefinitions ¶
func GetObjectValueInputField ¶
func GetObjectValueInputField(ov *InputObjectValue, name string, value *Value) bool
func GetTypeFlatString ¶ added in v1.0.2
func GetTypeString ¶ added in v1.0.2
func GetValueFlatString ¶
func GetValueString ¶
func PrintDocument ¶
func ReadGraphQL ¶
func ReadString ¶
func ResponseToJson ¶
func SetDir ¶
func SetDir(td TypeDirectory)
func Unsubscribe ¶
func Unsubscribe(responseStream *ResponseStream)
func Unwrap ¶ added in v1.0.2
func Unwrap(rootValue *OutputObjectValue, n int) interface{}
func WriteTypeFlat ¶ added in v1.0.2
func WriteValue ¶
func WriteValueFlat ¶
Types ¶
type AbstractTypeResolver ¶
type AbstractTypeResolver func(ts TypeSystem, td TypeDefinition, ov *OutputObjectValue) *ObjectTypeDefinition
type ArgumentsDefinition ¶
type ArgumentsDefinition []*InputValueDefinition
type BooleanValue ¶
type BooleanValue struct {
Boolean bool
}
func MakeBooleanValue ¶
func MakeBooleanValue(b bool) *BooleanValue
type Definition ¶
type Definition interface { }
type Definitions ¶
type Definitions []Definition
type DirectiveDefinition ¶
type DirectiveDefinition struct { Desc *StringValue Name *StrPtr ArgsDef ArgumentsDefinition Rep bool DirLocs DirectiveLocations // != nil // contains filtered or unexported fields }
type DirectiveLocation ¶
type DirectiveLocation interface {
LocM() int
}
type DirectiveLocations ¶
type DirectiveLocations []DirectiveLocation
type Directives ¶
type Directives []Directive
type Document ¶
type Document struct { Defs Definitions // contains filtered or unexported fields }
func (*Document) GetFlatString ¶
type EnumTypeDefinition ¶
type EnumTypeDefinition struct { TypeDefinitionCommon EnumValsDef EnumValuesDefinition // != nil }
func (*EnumTypeDefinition) TypeDefinitionC ¶
func (e *EnumTypeDefinition) TypeDefinitionC() *TypeDefinitionCommon
type EnumTypeExtension ¶
type EnumTypeExtension struct { TypeExtensionC EnumValsDef EnumValuesDefinition }
func (*EnumTypeExtension) TEM ¶
func (e *EnumTypeExtension) TEM() *TypeExtensionC
type EnumValueDefinition ¶
type EnumValueDefinition struct { Desc *StringValue EnumVal *EnumValue Dirs Directives // contains filtered or unexported fields }
type EnumValuesDefinition ¶
type EnumValuesDefinition []*EnumValueDefinition
type ErrorElem ¶
type EventStream ¶
type EventStream struct { EventStreamer ResponseStreams ResponseStreams }
func MakeEventStream ¶
func MakeEventStream(es EventStreamer) *EventStream
type EventStreamer ¶
type EventStreamer interface { StreamName() string RecordNotificationProc(notification SourceEventNotification) CloseEvent() }
Stream of OutputObjectValue(s)
type ExecSystem ¶
type ExecSystem interface { TypeSystem ListOperations() StrArray GetOperation(operationName string) *OperationDefinition Execute(doc *Document, operationName string, variableValues *A.Tree) Response // *ValMapItem // contains filtered or unexported methods }
type ExecutableDefinition ¶
type ExecutableDefinition interface {
// contains filtered or unexported methods
}
type ExecutableDirectiveLocation ¶
type ExecutableDirectiveLocation struct {
Loc int
}
func (ExecutableDirectiveLocation) LocM ¶
func (dir ExecutableDirectiveLocation) LocM() int
type Field ¶
type Field struct { Alias, Name *StrPtr Arguments Arguments Dirs Directives SelSet SelectionSet // contains filtered or unexported fields }
func (*Field) DirsM ¶
func (f *Field) DirsM() Directives
type FieldDefinition ¶
type FieldDefinition struct { Desc *StringValue Name *StrPtr ArgsDef ArgumentsDefinition Type Type Dirs Directives // contains filtered or unexported fields }
type FieldResolver ¶
type FieldResolver func(ts TypeSystem, rootValue *OutputObjectValue, argumentValues *A.Tree) Value // *ValMapItem
type FieldsDefinition ¶
type FieldsDefinition []*FieldDefinition
type FloatValue ¶
type FloatValue struct {
Float float64
}
func MakeFloat32Value ¶
func MakeFloat32Value(f float32) *FloatValue
func MakeFloat64Value ¶
func MakeFloat64Value(f float64) *FloatValue
type FragmentDefinition ¶
type FragmentDefinition struct { Name *StrPtr TypeCond *NamedType // != nil Dirs Directives SelSet SelectionSet }
type FragmentSpread ¶
type FragmentSpread struct { Name *StrPtr Dirs Directives }
func (*FragmentSpread) DirsM ¶
func (f *FragmentSpread) DirsM() Directives
type InlineFragment ¶
type InlineFragment struct { TypeCond *NamedType // may be nil Dirs Directives SelSet SelectionSet }
func (*InlineFragment) DirsM ¶
func (i *InlineFragment) DirsM() Directives
type InputObjectTypeDefinition ¶
type InputObjectTypeDefinition struct { TypeDefinitionCommon InFieldsDef ArgumentsDefinition // != nil }
func (*InputObjectTypeDefinition) TypeDefinitionC ¶
func (i *InputObjectTypeDefinition) TypeDefinitionC() *TypeDefinitionCommon
type InputObjectTypeExtension ¶
type InputObjectTypeExtension struct { TypeExtensionC InFieldsDef ArgumentsDefinition }
func (*InputObjectTypeExtension) TEM ¶
func (e *InputObjectTypeExtension) TEM() *TypeExtensionC
type InputObjectValue ¶
type InputObjectValue struct {
// contains filtered or unexported fields
}
func (*InputObjectValue) First ¶
func (ov *InputObjectValue) First() *ObjectField
func (*InputObjectValue) Next ¶
func (*InputObjectValue) Next(f *ObjectField) *ObjectField
type InputValueDefinition ¶
type InputValueDefinition struct { Desc *StringValue Name *StrPtr Type Type DefVal Value Dirs Directives }
type InstantResponse ¶
type InstantResponse struct { Data *OutputObjectValue // contains filtered or unexported fields }
func (*InstantResponse) Errors ¶
func (r *InstantResponse) Errors() *A.Tree
func (*InstantResponse) SetErrors ¶
func (r *InstantResponse) SetErrors(err *A.Tree)
type InterfaceTypeDefinition ¶
type InterfaceTypeDefinition struct { TypeDefinitionCommon ImpInter NamedTypes FieldsDef FieldsDefinition // contains filtered or unexported fields }
func (*InterfaceTypeDefinition) TypeDefinitionC ¶
func (i *InterfaceTypeDefinition) TypeDefinitionC() *TypeDefinitionCommon
type InterfaceTypeExtension ¶
type InterfaceTypeExtension struct { TypeExtensionC ImpInter NamedTypes FieldsDef FieldsDefinition }
func (*InterfaceTypeExtension) TEM ¶
func (e *InterfaceTypeExtension) TEM() *TypeExtensionC
type LinkGQL ¶
type LinkGQL func(name string) io.ReadCloser
LinkGQL(name) returns the ReadCloser corresponding to name
type ListValue ¶
type ListValue struct {
// contains filtered or unexported fields
}
func NewListValue ¶
func NewListValue() *ListValue
type NameMapItem ¶
type NameMapItem struct {
Name *StrPtr
}
Base type of elements of an avl tree
func (*NameMapItem) Copy ¶
func (n *NameMapItem) Copy() A.Copier
type NamedTypes ¶
type NamedTypes []*NamedType
type NonNullType ¶
type NonNullType struct {
NullT Type
}
type ObjectField ¶
type ObjectTypeDefinition ¶
type ObjectTypeDefinition struct { TypeDefinitionCommon ImpInter NamedTypes FieldsDef FieldsDefinition // != nil }
func (*ObjectTypeDefinition) TypeDefinitionC ¶
func (o *ObjectTypeDefinition) TypeDefinitionC() *TypeDefinitionCommon
type ObjectTypeExtension ¶
type ObjectTypeExtension struct { TypeExtensionC ImpInter NamedTypes FieldsDef FieldsDefinition }
func (*ObjectTypeExtension) TEM ¶
func (e *ObjectTypeExtension) TEM() *TypeExtensionC
type OperationDefinition ¶
type OperationDefinition struct { OpType int Name *StrPtr VarDefs VariableDefinitions Dirs Directives SelSet SelectionSet }
type OperationTypeDefinition ¶
type OperationTypeDefinitions ¶
type OperationTypeDefinitions []OperationTypeDefinition
type OutputObjectValue ¶
type OutputObjectValue struct {
// contains filtered or unexported fields
}
func NewOutputObjectValue ¶
func NewOutputObjectValue() *OutputObjectValue
func Wrap ¶ added in v1.0.2
func Wrap(i ...interface{}) *OutputObjectValue
func (*OutputObjectValue) First ¶
func (ov *OutputObjectValue) First() *ObjectField
func (*OutputObjectValue) InsertOutputField ¶
func (ov *OutputObjectValue) InsertOutputField(name string, value Value) *ObjectField
Exported variant of 'insertOutputField' using string instead of *StrPtr
func (*OutputObjectValue) Next ¶
func (ov *OutputObjectValue) Next(f *ObjectField) *ObjectField
type Path ¶
type Path interface { Next() Path // contains filtered or unexported methods }
Path of an error in data structure
type PathBuilder ¶
type PathBuilder struct {
// contains filtered or unexported fields
}
Queue
func NewPathBuilder ¶
func NewPathBuilder() *PathBuilder
func (*PathBuilder) GetPath ¶
func (pb *PathBuilder) GetPath() Path
func (*PathBuilder) PushPathNb ¶
func (pb *PathBuilder) PushPathNb(n int) *PathBuilder
func (*PathBuilder) PushPathString ¶
func (pb *PathBuilder) PushPathString(s string) *PathBuilder
type PathString ¶
type PathString struct { S string // contains filtered or unexported fields }
func (*PathString) Next ¶
func (p *PathString) Next() Path
type PosT ¶
type PosT struct {
// Position from start in bytes, line number, column number in bytes
P, L, C int
}
Position in compiled text
type ResponseStream ¶
type ResponseStream struct { ResponseStreamer SourceStream *EventStream // contains filtered or unexported fields }
Stream of Response(s)
func (*ResponseStream) FixResponseStream ¶
func (rs *ResponseStream) FixResponseStream(s ResponseStreamer)
type ResponseStreamer ¶
type ResponseStreamer interface {
ManageResponseEvent(r Response)
}
type ResponseStreams ¶
type ResponseStreams []*ResponseStream
type ScalarCoercer ¶
type ScalarCoercer func(ts TypeSystem, v Value, path Path, cV *Value) bool
A 'ScalarCoercer' tries to coerce 'v' to a scalar value *'cV' valid for this coercer. If success, 'ScalarCoercer' returns true; otherwise, an error is raised in 'ts' with the path 'path' and 'ScalarCoercer' returns false
type ScalarTypeDefinition ¶
type ScalarTypeDefinition struct { TypeDefinitionCommon SpecifiedByURL *StringValue // contains filtered or unexported fields }
func (*ScalarTypeDefinition) TypeDefinitionC ¶
func (s *ScalarTypeDefinition) TypeDefinitionC() *TypeDefinitionCommon
type ScalarTypeExtension ¶
type ScalarTypeExtension struct {
TypeExtensionC
}
func (*ScalarTypeExtension) TEM ¶
func (e *ScalarTypeExtension) TEM() *TypeExtensionC
type Scalarer ¶
type Scalarer interface {
FixScalarCoercer(scalarName string, sc *ScalarCoercer)
}
type SchemaDefinition ¶
type SchemaDefinition struct { Desc *StringValue Dirs Directives OpTypeDefs OperationTypeDefinitions // contains filtered or unexported fields }
type SchemaExtension ¶
type SchemaExtension struct { Dirs Directives OpTypeDefs OperationTypeDefinitions }
type Selection ¶
type Selection interface {
DirsM() Directives
}
type SelectionSet ¶
type SelectionSet []Selection
type SourceEventNotification ¶
type SourceEventNotification func(es *EventStream, event *OutputObjectValue)
type StreamResolver ¶
type StreamResolver func(rootValue *OutputObjectValue, argumentValues *A.Tree) *EventStream // *ValMapItem
type StringValue ¶
type StringValue struct {
String *StrPtr
}
func MakeStringValue ¶
func MakeStringValue(s string) *StringValue
type SubscribeResponse ¶
type SubscribeResponse struct { Data *ResponseStream Name string // contains filtered or unexported fields }
func (*SubscribeResponse) Errors ¶
func (r *SubscribeResponse) Errors() *A.Tree
func (*SubscribeResponse) SetErrors ¶
func (r *SubscribeResponse) SetErrors(err *A.Tree)
type TypeDefinition ¶
type TypeDefinition interface { TypeSystemDefinition TypeDefinitionC() *TypeDefinitionCommon }
type TypeDefinitionCommon ¶
type TypeDefinitionCommon struct { Desc *StringValue Name *StrPtr Dirs Directives // contains filtered or unexported fields }
type TypeDirectory ¶
type TypeDirectory interface {
NewTypeSystem(sc Scalarer) TypeSystem
}
var ( StdDir TypeDirectory = new(typeDirectory) Dir = StdDir )
type TypeExtension ¶
type TypeExtension interface { TypeSystemExtension TEM() *TypeExtensionC }
type TypeExtensionC ¶
type TypeExtensionC struct { Name *StrPtr Dirs Directives }
type TypeSystem ¶
type TypeSystem interface { Scalarer Error(mes string, pos PosList, path Path) MappedError(mes, aux1, aux2 string, pos PosList, path Path) GetErrors() *A.Tree // *ErrorElem GetTypeDefinition(name string) TypeDefinition FixFieldResolver(object, field string, resolver FieldResolver) FixStreamResolver(fieldName string, resolver StreamResolver) FixAbstractTypeResolver(resolver AbstractTypeResolver) InitTypeSystem(doc *Document) ExecValidate(doc *Document) ExecSystem FixInitialValue(ov *OutputObjectValue) // contains filtered or unexported methods }
type TypeSystemDefinition ¶
type TypeSystemDefinition interface {
// contains filtered or unexported methods
}
type TypeSystemDirectiveLocation ¶
type TypeSystemDirectiveLocation struct {
Loc int
}
func (TypeSystemDirectiveLocation) LocM ¶
func (dir TypeSystemDirectiveLocation) LocM() int
type TypeSystemExtension ¶
type TypeSystemExtension interface {
// contains filtered or unexported methods
}
type UnionTypeDefinition ¶
type UnionTypeDefinition struct { TypeDefinitionCommon UnionMTypes NamedTypes }
func (*UnionTypeDefinition) TypeDefinitionC ¶
func (u *UnionTypeDefinition) TypeDefinitionC() *TypeDefinitionCommon
type UnionTypeExtension ¶
type UnionTypeExtension struct { TypeExtensionC UnionMTypes NamedTypes }
func (*UnionTypeExtension) TEM ¶
func (e *UnionTypeExtension) TEM() *TypeExtensionC
type ValMapItem ¶
type ValMapItem struct { NameMapItem Value Value }
type VariableDefinition ¶
type VariableDefinition struct { Var *StrPtr Type Type DefVal Value Dirs Directives }
type VariableDefinitions ¶
type VariableDefinitions []*VariableDefinition
Directories
¶
Path | Synopsis |
---|---|
examples
|
|
static
The package graphQL is an implementation of the GraphQL query interface This package must be imported for its side effects when the GraphQL compiler and errors are stored in "util/graphQL/static" (file "compVar.go", variable "compiler" and file errorsVar.go, var strEn)
|
The package graphQL is an implementation of the GraphQL query interface This package must be imported for its side effects when the GraphQL compiler and errors are stored in "util/graphQL/static" (file "compVar.go", variable "compiler" and file errorsVar.go, var strEn) |
The package graphQL is an implementation of the GraphQL query interface This package must be imported for its side effects when the GraphQL compiler and errors are stored in "util/graphQL/static" (file "compVar.go", variable "compiler" and file errorsVar.go, var strEn)
|
The package graphQL is an implementation of the GraphQL query interface This package must be imported for its side effects when the GraphQL compiler and errors are stored in "util/graphQL/static" (file "compVar.go", variable "compiler" and file errorsVar.go, var strEn) |
Click to show internal directories.
Click to hide internal directories.