schema

package
v0.0.0-...-ba60edf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2020 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Enum

type Enum struct {
	Name       string
	Values     []*EnumValue // NOTE: the spec refers to this as `EnumValuesDefinition`.
	Desc       string
	Directives common.DirectiveList
}

Enum types describe a set of possible values.

Like scalar types, Enum types also represent leaf values in a GraphQL type system.

http://facebook.github.io/graphql/draft/#sec-Enums

func (*Enum) Description

func (t *Enum) Description() string

func (*Enum) Kind

func (*Enum) Kind() string

func (*Enum) String

func (t *Enum) String() string

func (*Enum) TypeName

func (t *Enum) TypeName() string

type EnumValue

type EnumValue struct {
	Name       string
	Directives common.DirectiveList
	Desc       string
}

EnumValue types are unique values that may be serialized as a string: the name of the represented value.

http://facebook.github.io/graphql/draft/#EnumValueDefinition

type Extension

type Extension struct {
	Type       NamedType
	Directives common.DirectiveList
}

Extension type defines a GraphQL type extension. Schemas, Objects, Inputs and Scalars can be extended.

https://facebook.github.io/graphql/draft/#sec-Type-System-Extensions

type Field

type Field struct {
	Name       string
	Args       common.InputValueList // NOTE: the spec refers to this as `ArgumentsDefinition`.
	Type       common.Type
	Directives common.DirectiveList
	Desc       string
}

Field is a conceptual function which yields values. http://facebook.github.io/graphql/draft/#FieldDefinition

type FieldList

type FieldList []*Field

FieldsList is a list of an Object's Fields.

http://facebook.github.io/graphql/draft/#FieldsDefinition

func (FieldList) Get

func (l FieldList) Get(name string) *Field

Get iterates over the field list, returning a pointer-to-Field when the field name matches the provided `name` argument. Returns nil when no field was found by that name.

func (FieldList) Names

func (l FieldList) Names() []string

Names returns a string slice of the field names in the FieldList.

type InputObject

type InputObject struct {
	Name       string
	Desc       string
	Values     common.InputValueList
	Directives common.DirectiveList
}

InputObject types define a set of input fields; the input fields are either scalars, enums, or other input objects.

This allows arguments to accept arbitrarily complex structs.

http://facebook.github.io/graphql/draft/#sec-Input-Objects

func (*InputObject) Description

func (t *InputObject) Description() string

func (*InputObject) Kind

func (*InputObject) Kind() string

func (*InputObject) String

func (t *InputObject) String() string

func (*InputObject) TypeName

func (t *InputObject) TypeName() string

type Interface

type Interface struct {
	Name          string
	PossibleTypes []*Object
	Fields        FieldList // NOTE: the spec refers to this as `FieldsDefinition`.
	Desc          string
	Directives    common.DirectiveList
}

Interface types represent a list of named fields and their arguments.

GraphQL objects can then implement these interfaces which requires that the object type will define all fields defined by those interfaces.

http://facebook.github.io/graphql/draft/#sec-Interfaces

func (*Interface) Description

func (t *Interface) Description() string

func (*Interface) Kind

func (*Interface) Kind() string

func (*Interface) String

func (t *Interface) String() string

func (*Interface) TypeName

func (t *Interface) TypeName() string

type NamedType

type NamedType interface {
	common.Type
	TypeName() string
	Description() string
}

NamedType represents a type with a name.

http://facebook.github.io/graphql/draft/#NamedType

type Object

type Object struct {
	Name       string
	Interfaces []*Interface
	Fields     FieldList
	Desc       string
	Directives common.DirectiveList
	// contains filtered or unexported fields
}

Object types represent a list of named fields, each of which yield a value of a specific type.

GraphQL queries are hierarchical and composed, describing a tree of information. While Scalar types describe the leaf values of these hierarchical types, Objects describe the intermediate levels.

http://facebook.github.io/graphql/draft/#sec-Objects

func (*Object) Description

func (t *Object) Description() string

func (*Object) Kind

func (*Object) Kind() string

func (*Object) String

func (t *Object) String() string

func (*Object) TypeName

func (t *Object) TypeName() string

type Scalar

type Scalar struct {
	Name       string
	Desc       string
	Directives common.DirectiveList
}

Scalar types represent primitive leaf values (e.g. a string or an integer) in a GraphQL type system.

GraphQL responses take the form of a hierarchical tree; the leaves on these trees are GraphQL scalars.

http://facebook.github.io/graphql/draft/#sec-Scalars

func (*Scalar) Description

func (t *Scalar) Description() string

func (*Scalar) Kind

func (*Scalar) Kind() string

func (*Scalar) String

func (t *Scalar) String() string

func (*Scalar) TypeName

func (t *Scalar) TypeName() string

type Schema

type Schema struct {
	// EntryPoints determines the place in the type system where `query`, `mutation`, and
	// `subscription` operations begin.
	//
	// http://facebook.github.io/graphql/draft/#sec-Root-Operation-Types
	//
	// NOTE: The specification refers to this concept as "Root Operation Types".
	// TODO: Rename the `EntryPoints` field to `RootOperationTypes` to align with spec terminology.
	EntryPoints map[string]NamedType

	// Types are the fundamental unit of any GraphQL schema.
	// There are six kinds of named types, and two wrapping types.
	//
	// http://facebook.github.io/graphql/draft/#sec-Types
	Types map[string]NamedType

	// Directives are used to annotate various parts of a GraphQL document as an indicator that they
	// should be evaluated differently by a validator, executor, or client tool such as a code
	// generator.
	//
	// http://facebook.github.io/graphql/draft/#sec-Type-System.Directives
	Directives map[string]*DirectiveDecl

	UseFieldResolvers bool
	// contains filtered or unexported fields
}

Schema represents a GraphQL service's collective type system capabilities. A schema is defined in terms of the types and directives it supports as well as the root operation types for each kind of operation: `query`, `mutation`, and `subscription`.

For a more formal definition, read the relevant section in the specification:

http://facebook.github.io/graphql/draft/#sec-Schema

func New

func New() *Schema

New initializes an instance of Schema.

func (*Schema) Parse

func (s *Schema) Parse(schemaString string, useStringDescriptions bool) error

Parse the schema string.

func (*Schema) Resolve

func (s *Schema) Resolve(name string) common.Type

Resolve a named type in the schema by its name.

type Union

type Union struct {
	Name          string
	PossibleTypes []*Object // NOTE: the spec refers to this as `UnionMemberTypes`.
	Desc          string
	Directives    common.DirectiveList
	// contains filtered or unexported fields
}

Union types represent objects that could be one of a list of GraphQL object types, but provides no guaranteed fields between those types.

They also differ from interfaces in that object types declare what interfaces they implement, but are not aware of what unions contain them.

http://facebook.github.io/graphql/draft/#sec-Unions

func (*Union) Description

func (t *Union) Description() string

func (*Union) Kind

func (*Union) Kind() string

func (*Union) String

func (t *Union) String() string

func (*Union) TypeName

func (t *Union) TypeName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL