schema

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashFieldName added in v1.2.1

func HashFieldName(fieldName string) uint32

HashFieldName returns a integer hash for the field name.

Types

type ASTParts

type ASTParts struct {
	Types            map[string]ast.TypeDefinition
	Objects          map[string]*ast.ObjectDefinition
	Enums            map[string]*ast.EnumDefinition
	Unions           map[string]*ast.UnionDefinition
	SchemaOperations map[string]*ast.OperationTypeDefinition
	AllNamed         map[string]ast.Node

	Schemas []*ast.SchemaDefinition

	RootQuery *ast.ObjectDefinition
}

ASTParts classifies parts of a GraphQL schema.

func DocumentToParts

func DocumentToParts(doc *ast.Document) *ASTParts

DocumentToParts classifies the parts of a ast.Document in an AstParts

func (*ASTParts) Apply

func (ap *ASTParts) Apply(other *ASTParts)

Apply merges two ASTParts together. Rarely used.

func (*ASTParts) ApplyIntrospection

func (ap *ASTParts) ApplyIntrospection()

func (*ASTParts) LookupType

func (ap *ASTParts) LookupType(typ ast.Type) (atd ast.TypeDefinition)

LookupType finds what the GraphQL type `typ` is pointing to.

type Schema

type Schema struct {
	Document       *ast.Document
	Definitions    *ASTParts
	SchemaResolver *introspect.SchemaResolver

	// QueryResolver    *execution.Model
	// MutationModel *execution.Model
	CacheSize uint32
}

Schema is a combination of a parsed AST Schema and a resolver tree.

func FromDocument

func FromDocument(doc *ast.Document) *Schema

FromDocument makes a Schema from an AST document.

func Parse

func Parse(docStr string) (*Schema, error)

Parse a AST document given a docStr GraphQL schema string.

func (*Schema) BuildQueryTree

func (s *Schema) BuildQueryTree(sendCh chan<- *proto.RGQLQueryError) (*qtree.QueryTreeNode, error)

BuildQueryTree builds a new query tree from this schema.

Jump to

Keyboard shortcuts

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