graphql

package
v0.0.0-...-72fbe86 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Code generated by tools/listgen DO NOT EDIT!

Index

Constants

This section is empty.

Variables

View Source
var (
	// SkipDirective is the definition for the built-in "@skip" directive.
	SkipDirective = &ast.DirectiveDefinition{
		Name:        "skip",
		Description: "Directs the executor to skip this field or fragment when the `if` argument is true.",
		DirectiveLocations: ast.DirectiveLocationKindField |
			ast.DirectiveLocationKindFragmentSpread |
			ast.DirectiveLocationKindInlineFragment,
		ArgumentsDefinition: (*ast.InputValueDefinitions)(nil).
			Add(ast.InputValueDefinition{
				Name:        "if",
				Description: "Skipped when true.",
				Type: ast.Type{
					NamedType:   "Boolean",
					Kind:        ast.TypeKindNamed,
					NonNullable: true,
				},
			}),
	}
	// IncludeDirective is the definition for the built-in "@include" directive.
	IncludeDirective = &ast.DirectiveDefinition{
		Name:        "include",
		Description: "Directs the executor to include this field or fragment only when the `if` argument is true.",
		DirectiveLocations: ast.DirectiveLocationKindField |
			ast.DirectiveLocationKindFragmentSpread |
			ast.DirectiveLocationKindInlineFragment,
		ArgumentsDefinition: (*ast.InputValueDefinitions)(nil).
			Add(ast.InputValueDefinition{
				Name:        "if",
				Description: "Included when true.",
				Type: ast.Type{
					NamedType:   "Boolean",
					Kind:        ast.TypeKindNamed,
					NonNullable: true,
				},
			}),
	}
	// DeprecatedDirective is the definition for the built-in "@deprecated" directive.
	DeprecatedDirective = &ast.DirectiveDefinition{
		Name:        "deprecated",
		Description: "Marks an element of a GraphQL schema as no longer supported.",
		DirectiveLocations: ast.DirectiveLocationKindFieldDefinition |
			ast.DirectiveLocationKindEnumValue,
		ArgumentsDefinition: (*ast.InputValueDefinitions)(nil).
			Add(ast.InputValueDefinition{
				Name: "reason",
				Description: "Explains why this element was deprecated, usually also including a " +
					"suggestion for how to access supported similar data. Formatted using " +
					"the Markdown syntax (as specified by [CommonMark](https://commonmark.org/).",
				Type: ast.Type{
					NamedType: "String",
					Kind:      ast.TypeKindNamed,
				},
				DefaultValue: &ast.Value{
					StringValue: "No longer supported",
					Kind:        ast.ValueKindString,
				},
			}),
	}

	// IDType ...
	// TODO: Fully implement.
	IDType = &ast.TypeDefinition{
		Name: "ID",
		Kind: ast.TypeDefinitionKindScalar,
	}

	// StringType ...
	// TODO: Fully implement.
	StringType = &ast.TypeDefinition{
		Name: "String",
		Kind: ast.TypeDefinitionKindScalar,
	}
)

Functions

func SpecifiedDirectives

func SpecifiedDirectives() map[string]*ast.DirectiveDefinition

SpecifiedDirectives returns a map similar to the one found on the Schema type, containing all pre-defined GraphQL directives. It is returned from a function to avoid this map being mutated, as it is used in several places.

func SpecifiedTypes

func SpecifiedTypes() map[string]*ast.TypeDefinition

SpecifiedTypes ...

Types

type Error

type Error struct {
	Message   string
	Locations *ast.Locations
	Path      *ast.PathNodes
}

Error fulfils the requirements of a GraphQL error type.

func NewError

func NewError(message string) Error

NewError returns a new Error with the given message.

func (*Error) MarshalJSON

func (e *Error) MarshalJSON() ([]byte, error)

MarshalJSON returns this Error as some JSON bytes. If the Error is invalid, an error will be returned.

type Errors

type Errors struct {
	Data Error
	// contains filtered or unexported fields
}

Errors is a linked list that contains Error values.

func ErrorsFromSlice

func ErrorsFromSlice(sl []Error) *Errors

ErrorsFromSlice returns a Errors list from a slice of Error.

func SortErrors

func SortErrors(errs *Errors) *Errors

SortErrors ...

func (*Errors) Add

func (es *Errors) Add(data Error) *Errors

Add appends a Error to this linked list and returns this new head.

func (*Errors) ForEach

func (es *Errors) ForEach(fn func(e Error, i int))

ForEach applies the given map function to each item in this linked list.

func (*Errors) Generator

func (es *Errors) Generator() ErrorsGenerator

Generator returns a "Generator" type for this list, allowing for much more efficient iteration over items within this linked list than using ForEach, though ForEach may still be more convenient, because ForEach is a high order function, it's slower.

func (*Errors) Insert

func (es *Errors) Insert(e Error, pos int) *Errors

Insert places the Error in the position given by pos. The method will insert at top if pos is greater than or equal to list length. The method will insert at bottom if the pos is less than 0.

func (*Errors) Join

func (es *Errors) Join(otherList *Errors)

Join attaches the tail of the receiver list "es" to the head of the otherList.

func (*Errors) Len

func (es *Errors) Len() int

Len returns the length of this linked list.

func (*Errors) Reverse

func (es *Errors) Reverse() *Errors

Reverse reverses this linked list of Error. Usually when the linked list is being constructed the result will be last-to-first, so we'll want to reverse it to get it in the "right" order.

type ErrorsGenerator

type ErrorsGenerator struct {
	// contains filtered or unexported fields
}

ErrorsGenerator is a type used to iterate efficiently over Errors. @wg:ignore

func (*ErrorsGenerator) Next

func (g *ErrorsGenerator) Next() (Error, int)

Next returns the current value, and it's index in the list, and sets up the next value to be returned.

func (*ErrorsGenerator) Reset

func (g *ErrorsGenerator) Reset()

Reset returns this generator to it's initial state, allowing it to be used again to iterate over this linked list.

type Schema

type Schema struct {
	Definition *ast.SchemaDefinition

	// NOTE: The following should all have the "kind" ast.TypeKindNamed.
	QueryType        *ast.Type
	MutationType     *ast.Type
	SubscriptionType *ast.Type

	Directives map[string]*ast.DirectiveDefinition
	Types      map[string]*ast.TypeDefinition
}

Schema ...

Jump to

Keyboard shortcuts

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