bagger

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsNodes

func AsNodes(raw interface{}) ([]ast.Node, error)

AsNodes takes a map or slice of the pointer type of the node and turns it into an array of the interface `ast.Node` to make passing it to generic functions easier

Types

type Bagger

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

Bagger helpers accumulate a unique (and therefore schema-valid) set of each kind of graphql type keyed by node name, handily providing helpers to add fields directly to top-level query/mutation/subscription types

func NewBagger

func NewBagger() *Bagger

NewBagger constructs the bagger and allocates the necessary internal maps

func (*Bagger) AddFieldMutation

func (b *Bagger) AddFieldMutation(field *ast.FieldDefinition) error

AddFieldMutation adds a single mutation field definition

func (*Bagger) AddFieldQuery

func (b *Bagger) AddFieldQuery(field *ast.FieldDefinition) error

AddFieldQuery adds a single query field definition

func (*Bagger) AddFieldSubscription

func (b *Bagger) AddFieldSubscription(field *ast.FieldDefinition) error

AddFieldSubscription adds a single subscription field definition

func (*Bagger) AddNode

func (b *Bagger) AddNode(node ast.Node) error

AddNode adds a single node of any kind, don't add fields directly here, see one of the following:

AddFieldQuery, AddFieldMutation, AddFieldSubscription

func (*Bagger) Export

func (b *Bagger) Export(
	queryObject, mutationObject, subscriptionObject *ast.ObjectDefinition,
) *ast.Document

Export writes the contents of the Bager to a document, sorting everything along the way

func (*Bagger) GetDirectives

func (b *Bagger) GetDirectives() map[string]*ast.DirectiveDefinition

GetDirectives returns the underlying map, which can be directly edited (carefully)

func (*Bagger) GetEnums

func (b *Bagger) GetEnums() map[string]*ast.EnumDefinition

GetEnums returns the underlying map, which can be directly edited (carefully)

func (*Bagger) GetExtensions

func (b *Bagger) GetExtensions() map[string]*ast.TypeExtensionDefinition

GetExtensions returns the underlying map, which can be directly edited (carefully)

func (*Bagger) GetFieldsMutation

func (b *Bagger) GetFieldsMutation() map[string]*ast.FieldDefinition

GetFieldsMutation returns the underlying map, which can be directly edited (carefully)

func (*Bagger) GetFieldsQuery

func (b *Bagger) GetFieldsQuery() map[string]*ast.FieldDefinition

GetFieldsQuery returns the underlying map, which can be directly edited (carefully)

func (*Bagger) GetFieldsSubscription

func (b *Bagger) GetFieldsSubscription() map[string]*ast.FieldDefinition

GetFieldsSubscription returns the underlying map, which can be directly edited (carefully)

func (*Bagger) GetInputObjects

func (b *Bagger) GetInputObjects() map[string]*ast.InputObjectDefinition

GetInputObjects returns the underlying map, which can be directly edited (carefully)

func (*Bagger) GetInterfaces

func (b *Bagger) GetInterfaces() map[string]*ast.InterfaceDefinition

GetInterfaces returns the underlying map, which can be directly edited (carefully)

func (*Bagger) GetObjects

func (b *Bagger) GetObjects() map[string]*ast.ObjectDefinition

GetObjects returns the underlying map, which can be directly edited (carefully)

func (*Bagger) GetScalars

func (b *Bagger) GetScalars() map[string]*ast.ScalarDefinition

GetScalars returns the underlying map, which can be directly edited (carefully)

func (*Bagger) GetUnions

func (b *Bagger) GetUnions() map[string]*ast.UnionDefinition

GetUnions returns the underlying map, which can be directly edited (carefully)

func (*Bagger) IngestBags

func (b *Bagger) IngestBags(bags ...*Bagger) error

IngestBags merges all types across 1+ bags into the current bag

func (*Bagger) IngestDocument

func (b *Bagger) IngestDocument(doc *ast.Document) error

IngestDocument ingests the contents of a document

func (*Bagger) ValidateName

func (b *Bagger) ValidateName(node ast.Node) error

ValidateName assures the node's Name is valid if a node doesn't have a name, no error is returned

Jump to

Keyboard shortcuts

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