parser

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotObject      = fmt.Errorf("type is not object")
	ErrNotInputObject = fmt.Errorf("type is not input object")
	ErrNotUnion       = fmt.Errorf("type is not union")
	ErrNotInterface   = fmt.Errorf("type is not interface")
	ErrNotScalar      = fmt.Errorf("type is not scalar")
	ErrNotEnum        = fmt.Errorf("type is not enum")
)

Functions

This section is empty.

Types

type Argument

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

func NewArgument

func NewArgument(input *Input, field reflect.StructField) (*Argument, error)

func (*Argument) DefaultValue

func (arg *Argument) DefaultValue() string

func (*Argument) Description

func (arg *Argument) Description() string

func (*Argument) Input

func (arg *Argument) Input() *Input

func (*Argument) JSONName

func (arg *Argument) JSONName() string

func (*Argument) StructField added in v0.1.6

func (arg *Argument) StructField() reflect.StructField

func (*Argument) Type added in v0.1.6

func (arg *Argument) Type() Type

func (*Argument) Validator added in v0.1.6

func (arg *Argument) Validator() *ArgumentValidator

type ArgumentValidator added in v0.1.6

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

func NewArgumentValidator added in v0.1.6

func NewArgumentValidator(argument *Argument) (*ArgumentValidator, error)

func (*ArgumentValidator) ReflectMethod added in v0.1.6

func (v *ArgumentValidator) ReflectMethod() reflect.Method

type Array

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

func NewArray

func NewArray(t reflect.Type, isArgument bool) (*Array, error)

func (*Array) Element

func (a *Array) Element() Type

func (*Array) ReflectType

func (a *Array) ReflectType() reflect.Type

type Enum

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

func NewEnum

func NewEnum(t reflect.Type) (*Enum, error)

func ParseEnum

func ParseEnum(t reflect.Type) (*Enum, error)

func (*Enum) ReflectType

func (e *Enum) ReflectType() reflect.Type

func (*Enum) Values

func (e *Enum) Values() []string

type EnumType

type EnumType interface {
	Values() []string
}

type Field

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

func NewField

func NewField(t TypeWithFields, field reflect.StructField) (*Field, error)

func (*Field) ArgsInput added in v0.1.6

func (f *Field) ArgsInput() *Input

func (*Field) DeprecationReason

func (f *Field) DeprecationReason() string

func (*Field) Description

func (f *Field) Description() string

func (*Field) JSONName

func (f *Field) JSONName() string

func (*Field) Object

func (f *Field) Object() TypeWithFields

func (*Field) Resolver

func (f *Field) Resolver() *Resolver

func (*Field) StructField added in v0.1.5

func (f *Field) StructField() reflect.StructField

func (*Field) Subscriber

func (f *Field) Subscriber() *Subscriber

func (*Field) Type

func (f *Field) Type() Type

type Input

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

func NewInput

func NewInput(t reflect.Type) (*Input, error)

func ParseInputObject

func ParseInputObject(t reflect.Type) (*Input, error)

func (*Input) Arguments

func (i *Input) Arguments() []*Argument

func (*Input) ReflectType

func (i *Input) ReflectType() reflect.Type

func (*Input) Validator added in v0.1.6

func (i *Input) Validator() *InputValidator

type InputValidator added in v0.1.6

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

func NewInputValidator added in v0.1.6

func NewInputValidator(input *Input) (*InputValidator, error)

func (*InputValidator) ReflectMethod added in v0.1.6

func (v *InputValidator) ReflectMethod() reflect.Method

type Interface

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

func NewInterface

func NewInterface(t reflect.Type) (*Interface, error)

func NewInterfaceFromDefinition

func NewInterfaceFromDefinition(t reflect.Type) (*Interface, error)

func ParseInterface

func ParseInterface(t reflect.Type) (*Interface, error)

func (*Interface) Fields

func (i *Interface) Fields() []*Field

func (*Interface) Name

func (i *Interface) Name() string

func (*Interface) ReflectType

func (i *Interface) ReflectType() reflect.Type

type InterfaceType

type InterfaceType struct{}

type Kind

type Kind int
const (
	KindScalar Kind = iota
	KindCustomScalar
	KindObject
	KindInterface
	KindInterfaceDefinition
	KindUnion
	KindEnum
	KindList
	KindNullable
	KindInvalidType
)

func (Kind) String

func (kind Kind) String() string

type Nullable

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

func NewNullable

func NewNullable(t reflect.Type, isArgument bool) (*Nullable, error)

func (*Nullable) Element

func (n *Nullable) Element() Type

func (*Nullable) ReflectType

func (n *Nullable) ReflectType() reflect.Type

type Object

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

func NewObject

func NewObject(t reflect.Type) (*Object, error)

func ParseObject

func ParseObject(t reflect.Type) (*Object, error)

func (*Object) Fields

func (o *Object) Fields() []*Field

func (*Object) Interfaces

func (o *Object) Interfaces() []*Interface

func (*Object) ReflectType

func (o *Object) ReflectType() reflect.Type

type ResolveType added in v0.1.1

type ResolveType int

type Resolver

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

func NewResolver

func NewResolver(field *Field) (*Resolver, error)

func (*Resolver) ArgsSignature

func (r *Resolver) ArgsSignature() []ResolverArgType

func (*Resolver) Field

func (r *Resolver) Field() *Field

func (*Resolver) ReflectMethod added in v0.1.5

func (r *Resolver) ReflectMethod() reflect.Method

func (*Resolver) ReturnsThunk added in v0.1.1

func (r *Resolver) ReturnsThunk() bool

type ResolverArgType

type ResolverArgType int
const (
	ResolverArgOther ResolverArgType = iota
	ResolverArgInput
	ResolverArgContext
	ResolverArgInfo
)

type Scalar

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

func NewScalar

func NewScalar(t reflect.Type) (*Scalar, error)

func ParseScalar

func ParseScalar(t reflect.Type) (*Scalar, error)

func (Scalar) ReflectType

func (s Scalar) ReflectType() reflect.Type

type ScalarKind

type ScalarKind int
const (
	BuiltInScalar ScalarKind = iota
	CustomScalar
)

type ScalarType

type ScalarType interface {
	json.Marshaler
	json.Unmarshaler
}

type Subscriber

type Subscriber = Resolver

type Type

type Type interface {
	ReflectType() reflect.Type
}

type TypeWithElement

type TypeWithElement interface {
	Type
	Element() Type
}

type TypeWithFields

type TypeWithFields interface {
	Type
	Fields() []*Field
}

type Union

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

func NewUnion

func NewUnion(t reflect.Type) (*Union, error)

func ParseUnion

func ParseUnion(t reflect.Type) (*Union, error)

func (*Union) Members

func (u *Union) Members() []*Object

func (*Union) ReflectType

func (u *Union) ReflectType() reflect.Type

type UnionType

type UnionType struct{}

Jump to

Keyboard shortcuts

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