introspection

package
v0.0.0-...-bf845eb Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadSchema

func LoadSchema(q graphql.Querier) error

LoadSchema pre-loads the schema struct

Types

type Field

type Field struct {
	Name              string
	Description       string
	Args              []inputValue
	Type              typeRef
	IsDeprecated      bool
	DeprecationReason string
}

Field represents a field of a GraphQL type

func GetFields

func GetFields(q graphql.Querier, query *querybuilder.Query) ([]Field, error)

GetFields gets the fields for a given query

func (Field) GetHumanTypeName

func (f Field) GetHumanTypeName() string

GetHumanTypeName is a human-readable type name

func (Field) GetTypeName

func (f Field) GetTypeName() string

GetTypeName gets the name of the field's type

type FullType

type FullType struct {
	Kind        string
	Name        string
	Description string
	Fields      []Field
	InputFields []inputValue
	Interfaces  []typeRef
	EnumValues  []struct {
		Name              string
		Description       string
		IsDeprecated      bool
		DeprecationReason string
	}
	PossibleTypes []typeRef
}

FullType is a full type description

func (FullType) GetField

func (t FullType) GetField(name string) (*Field, bool)

GetField gets a field with the given name, if it exists

type Schema

type Schema struct {
	QueryType struct {
		Name string
	}

	MutationType *struct {
		Name string
	}

	SubscriptionType *struct {
		Name string
	}

	Types []FullType

	Directives []struct {
		Name        string
		Description string
		Locations   []string
		Args        []inputValue
	}
}

Schema is a GraphQL schema, the result of an introspection query

func (Schema) GetQueryType

func (s Schema) GetQueryType() (*FullType, bool)

GetQueryType returns the full query type

func (Schema) GetType

func (s Schema) GetType(name string) (*FullType, bool)

GetType returns a type with the given name if one exists

Jump to

Keyboard shortcuts

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