testserver

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllStatus = []Status{
	StatusOk,
	StatusError,
}

Functions

func MarshalBytes added in v0.8.3

func MarshalBytes(b []byte) graphql.Marshaler

func MarshalThirdParty added in v0.8.0

func MarshalThirdParty(tp ThirdParty) graphql.Marshaler

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

func UnmarshalBytes added in v0.8.3

func UnmarshalBytes(v interface{}) ([]byte, error)

Types

type A added in v0.8.2

type A struct {
	ID string `json:"id"`
}

func (A) IsTestUnion added in v0.8.2

func (A) IsTestUnion()

type AIt added in v0.8.2

type AIt struct {
	ID string `json:"id"`
}

type AbIt added in v0.8.1

type AbIt struct {
	ID string `json:"id"`
}

type AsdfIt added in v0.8.1

type AsdfIt struct {
	ID string `json:"id"`
}

type Autobind added in v0.8.0

type Autobind struct {
	Int   int
	Int32 int32
	Int64 int64

	IdStr string
	IdInt int
}

type B added in v0.8.2

type B struct {
	ID string `json:"id"`
}

func (B) IsTestUnion added in v0.8.2

func (B) IsTestUnion()

type Circle

type Circle struct {
	Radius float64
}

func (*Circle) Area

func (c *Circle) Area() float64

type ComplexityRoot added in v0.5.0

type ComplexityRoot struct {
	A struct {
		ID func(childComplexity int) int
	}

	AIt struct {
		ID func(childComplexity int) int
	}

	AbIt struct {
		ID func(childComplexity int) int
	}

	Autobind struct {
		IdInt func(childComplexity int) int
		IdStr func(childComplexity int) int
		Int   func(childComplexity int) int
		Int32 func(childComplexity int) int
		Int64 func(childComplexity int) int
	}

	B struct {
		ID func(childComplexity int) int
	}

	Circle struct {
		Area   func(childComplexity int) int
		Radius func(childComplexity int) int
	}

	EmbeddedDefaultScalar struct {
		Value func(childComplexity int) int
	}

	EmbeddedPointer struct {
		ID    func(childComplexity int) int
		Title func(childComplexity int) int
	}

	Error struct {
		ErrorOnNonRequiredField func(childComplexity int) int
		ErrorOnRequiredField    func(childComplexity int) int
		ID                      func(childComplexity int) int
		NilOnRequiredField      func(childComplexity int) int
	}

	ForcedResolver struct {
		Field func(childComplexity int) int
	}

	InnerObject struct {
		ID func(childComplexity int) int
	}

	InvalidIdentifier struct {
		ID func(childComplexity int) int
	}

	It struct {
		ID func(childComplexity int) int
	}

	Map struct {
		ID func(childComplexity int) int
	}

	MapStringInterfaceType struct {
		A func(childComplexity int) int
		B func(childComplexity int) int
	}

	ModelMethods struct {
		NoContext     func(childComplexity int) int
		ResolverField func(childComplexity int) int
		WithContext   func(childComplexity int) int
	}

	OuterObject struct {
		Inner func(childComplexity int) int
	}

	OverlappingFields struct {
		Foo    func(childComplexity int) int
		NewFoo func(childComplexity int) int
		OldFoo func(childComplexity int) int
	}

	Panics struct {
		ArgUnmarshal       func(childComplexity int, u []MarshalPanic) int
		FieldFuncMarshal   func(childComplexity int, u []MarshalPanic) int
		FieldScalarMarshal func(childComplexity int) int
	}

	Query struct {
		Autobind               func(childComplexity int) int
		Collision              func(childComplexity int) int
		DefaultScalar          func(childComplexity int, arg string) int
		DeprecatedField        func(childComplexity int) int
		DirectiveArg           func(childComplexity int, arg string) int
		DirectiveInput         func(childComplexity int, arg InputDirectives) int
		DirectiveInputNullable func(childComplexity int, arg *InputDirectives) int
		DirectiveInputType     func(childComplexity int, arg InnerInput) int
		DirectiveNullableArg   func(childComplexity int, arg *int, arg2 *int) int
		ErrorBubble            func(childComplexity int) int
		Fallback               func(childComplexity int, arg FallbackToStringEncoding) int
		InputSlice             func(childComplexity int, arg []string) int
		InvalidIdentifier      func(childComplexity int) int
		MapInput               func(childComplexity int, input map[string]interface{}) int
		MapStringInterface     func(childComplexity int, in map[string]interface{}) int
		ModelMethods           func(childComplexity int) int
		NestedInputs           func(childComplexity int, input [][]*OuterInput) int
		NestedOutputs          func(childComplexity int) int
		NullableArg            func(childComplexity int, arg *int) int
		OptionalUnion          func(childComplexity int) int
		Overlapping            func(childComplexity int) int
		Panics                 func(childComplexity int) int
		Recursive              func(childComplexity int, input *RecursiveInputSlice) int
		ScalarSlice            func(childComplexity int) int
		ShapeUnion             func(childComplexity int) int
		Shapes                 func(childComplexity int) int
		Slices                 func(childComplexity int) int
		User                   func(childComplexity int, id int) int
		Valid                  func(childComplexity int) int
		ValidType              func(childComplexity int) int
	}

	Rectangle struct {
		Area   func(childComplexity int) int
		Length func(childComplexity int) int
		Width  func(childComplexity int) int
	}

	Slices struct {
		Test1 func(childComplexity int) int
		Test2 func(childComplexity int) int
		Test3 func(childComplexity int) int
		Test4 func(childComplexity int) int
	}

	Subscription struct {
		InitPayload func(childComplexity int) int
		Updated     func(childComplexity int) int
	}

	User struct {
		Created func(childComplexity int) int
		Friends func(childComplexity int) int
		ID      func(childComplexity int) int
		Updated func(childComplexity int) int
	}

	ValidType struct {
		DifferentCase      func(childComplexity int) int
		DifferentCaseOld   func(childComplexity int) int
		ValidArgs          func(childComplexity int, breakArg string, defaultArg string, funcArg string, interfaceArg string, selectArg string, caseArg string, deferArg string, goArg string, mapArg string, structArg string, chanArg string, elseArg string, gotoArg string, packageArg string, switchArg string, constArg string, fallthroughArg string, ifArg string, rangeArg string, typeArg string, continueArg string, forArg string, importArg string, returnArg string, varArg string, _Arg string) int
		ValidInputKeywords func(childComplexity int, input *ValidInput) int
	}

	XXIt struct {
		ID func(childComplexity int) int
	}

	XxIt struct {
		ID func(childComplexity int) int
	}

	AsdfIt struct {
		ID func(childComplexity int) int
	}

	IIt struct {
		ID func(childComplexity int) int
	}
}

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot

type DirectiveRoot struct {
	Custom func(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error)

	Length func(ctx context.Context, obj interface{}, next graphql.Resolver, min int, max *int) (res interface{}, err error)

	Range func(ctx context.Context, obj interface{}, next graphql.Resolver, min *int, max *int) (res interface{}, err error)
}

type EmbeddedDefaultScalar added in v0.8.2

type EmbeddedDefaultScalar struct {
	Value *string `json:"value"`
}

type EmbeddedPointer added in v0.6.0

type EmbeddedPointer struct {
	Title string
}

type EmbeddedPointerModel added in v0.6.0

type EmbeddedPointerModel struct {
	*EmbeddedPointer
	ID string
}

type Error added in v0.5.0

type Error struct {
	ID string
}

func (Error) ErrorOnNonRequiredField added in v0.5.0

func (Error) ErrorOnNonRequiredField() (string, error)

func (Error) ErrorOnRequiredField added in v0.5.0

func (Error) ErrorOnRequiredField() (string, error)

func (Error) NilOnRequiredField added in v0.5.0

func (Error) NilOnRequiredField() *string

type FallbackToStringEncoding added in v0.8.2

type FallbackToStringEncoding string
const (
	FallbackToStringEncodingA FallbackToStringEncoding = "A"
	FallbackToStringEncodingB FallbackToStringEncoding = "B"
	FallbackToStringEncodingC FallbackToStringEncoding = "C"
)

type ForcedResolver

type ForcedResolver struct {
	Field Circle
}

type ForcedResolverResolver

type ForcedResolverResolver interface {
	Field(ctx context.Context, obj *ForcedResolver) (*Circle, error)
}

type IIt added in v0.8.1

type IIt struct {
	ID string `json:"id"`
}

type InnerDirectives added in v0.8.0

type InnerDirectives struct {
	Message string `json:"message"`
}

type InnerInput

type InnerInput struct {
	ID int `json:"id"`
}

type InnerObject

type InnerObject struct {
	ID int `json:"id"`
}

type InputDirectives added in v0.8.0

type InputDirectives struct {
	Text          string           `json:"text"`
	Inner         InnerDirectives  `json:"inner"`
	InnerNullable *InnerDirectives `json:"innerNullable"`
	ThirdParty    *ThirdParty      `json:"thirdParty"`
}

type Map added in v0.8.2

type Map struct {
	ID string `json:"id"`
}

Since gqlgen defines default implementation for a Map scalar, this tests that the builtin is _not_ added to the TypeMap

type MarshalPanic added in v0.8.0

type MarshalPanic string

func (MarshalPanic) MarshalGQL added in v0.8.0

func (m MarshalPanic) MarshalGQL(w io.Writer)

func (*MarshalPanic) UnmarshalGQL added in v0.8.0

func (m *MarshalPanic) UnmarshalGQL(v interface{}) error

type ModelMethods added in v0.7.0

type ModelMethods struct {
}

func (ModelMethods) NoContext added in v0.7.0

func (m ModelMethods) NoContext() bool

func (ModelMethods) WithContext added in v0.7.0

func (m ModelMethods) WithContext(_ context.Context) bool

type ModelMethodsResolver added in v0.7.0

type ModelMethodsResolver interface {
	ResolverField(ctx context.Context, obj *ModelMethods) (bool, error)
}

type OuterInput

type OuterInput struct {
	Inner InnerInput `json:"inner"`
}

type OuterObject

type OuterObject struct {
	Inner InnerObject `json:"inner"`
}

type OverlappingFields added in v0.8.2

type OverlappingFields struct {
	Foo    int
	NewFoo int
}

type OverlappingFieldsResolver added in v0.8.2

type OverlappingFieldsResolver interface {
	OldFoo(ctx context.Context, obj *OverlappingFields) (int, error)
}

type Panics added in v0.8.0

type Panics struct {
}

func (*Panics) FieldFuncMarshal added in v0.8.0

func (p *Panics) FieldFuncMarshal(ctx context.Context, u []MarshalPanic) []MarshalPanic

type PanicsResolver added in v0.8.0

type PanicsResolver interface {
	FieldScalarMarshal(ctx context.Context, obj *Panics) ([]MarshalPanic, error)

	ArgUnmarshal(ctx context.Context, obj *Panics, u []MarshalPanic) (bool, error)
}

type QueryResolver

type QueryResolver interface {
	InvalidIdentifier(ctx context.Context) (*invalid_packagename.InvalidIdentifier, error)
	Collision(ctx context.Context) (*introspection1.It, error)
	MapInput(ctx context.Context, input map[string]interface{}) (*bool, error)
	Recursive(ctx context.Context, input *RecursiveInputSlice) (*bool, error)
	NestedInputs(ctx context.Context, input [][]*OuterInput) (*bool, error)
	NestedOutputs(ctx context.Context) ([][]*OuterObject, error)
	Shapes(ctx context.Context) ([]Shape, error)
	ErrorBubble(ctx context.Context) (*Error, error)
	ModelMethods(ctx context.Context) (*ModelMethods, error)
	Valid(ctx context.Context) (string, error)
	User(ctx context.Context, id int) (*User, error)
	NullableArg(ctx context.Context, arg *int) (*string, error)
	DirectiveArg(ctx context.Context, arg string) (*string, error)
	DirectiveNullableArg(ctx context.Context, arg *int, arg2 *int) (*string, error)
	DirectiveInputNullable(ctx context.Context, arg *InputDirectives) (*string, error)
	DirectiveInput(ctx context.Context, arg InputDirectives) (*string, error)
	DirectiveInputType(ctx context.Context, arg InnerInput) (*string, error)
	InputSlice(ctx context.Context, arg []string) (bool, error)
	ShapeUnion(ctx context.Context) (ShapeUnion, error)
	Autobind(ctx context.Context) (*Autobind, error)
	DeprecatedField(ctx context.Context) (string, error)
	Overlapping(ctx context.Context) (*OverlappingFields, error)
	MapStringInterface(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error)
	Panics(ctx context.Context) (*Panics, error)
	DefaultScalar(ctx context.Context, arg string) (string, error)
	Slices(ctx context.Context) (*Slices, error)
	ScalarSlice(ctx context.Context) ([]byte, error)
	Fallback(ctx context.Context, arg FallbackToStringEncoding) (FallbackToStringEncoding, error)
	OptionalUnion(ctx context.Context) (TestUnion, error)
	ValidType(ctx context.Context) (*ValidType, error)
}

type Rectangle

type Rectangle struct {
	Length, Width float64
}

func (*Rectangle) Area

func (r *Rectangle) Area() float64

type RecursiveInputSlice

type RecursiveInputSlice struct {
	Self []RecursiveInputSlice
}

type Resolver

type Resolver struct{}

func (*Resolver) ForcedResolver

func (r *Resolver) ForcedResolver() ForcedResolverResolver

func (*Resolver) ModelMethods added in v0.7.0

func (r *Resolver) ModelMethods() ModelMethodsResolver

func (*Resolver) OverlappingFields added in v0.8.2

func (r *Resolver) OverlappingFields() OverlappingFieldsResolver

func (*Resolver) Panics added in v0.8.0

func (r *Resolver) Panics() PanicsResolver

func (*Resolver) Query

func (r *Resolver) Query() QueryResolver

func (*Resolver) Subscription added in v0.5.1

func (r *Resolver) Subscription() SubscriptionResolver

func (*Resolver) User added in v0.6.0

func (r *Resolver) User() UserResolver

type ResolverRoot

type ResolverRoot interface {
	ForcedResolver() ForcedResolverResolver
	ModelMethods() ModelMethodsResolver
	OverlappingFields() OverlappingFieldsResolver
	Panics() PanicsResolver
	Query() QueryResolver
	Subscription() SubscriptionResolver
	User() UserResolver
}

type Shape

type Shape interface {
	Area() float64
	// contains filtered or unexported methods
}

type ShapeUnion

type ShapeUnion interface {
	Area() float64
	// contains filtered or unexported methods
}

type Slices added in v0.8.2

type Slices struct {
	Test1 []*string `json:"test1"`
	Test2 []string  `json:"test2"`
	Test3 []*string `json:"test3"`
	Test4 []string  `json:"test4"`
}

type Status added in v0.8.0

type Status string
const (
	StatusOk    Status = "OK"
	StatusError Status = "ERROR"
)

func (Status) IsValid added in v0.8.0

func (e Status) IsValid() bool

func (Status) MarshalGQL added in v0.8.0

func (e Status) MarshalGQL(w io.Writer)

func (Status) String added in v0.8.0

func (e Status) String() string

func (*Status) UnmarshalGQL added in v0.8.0

func (e *Status) UnmarshalGQL(v interface{}) error

type Stub added in v0.8.0

type Stub struct {
	ForcedResolverResolver struct {
		Field func(ctx context.Context, obj *ForcedResolver) (*Circle, error)
	}
	ModelMethodsResolver struct {
		ResolverField func(ctx context.Context, obj *ModelMethods) (bool, error)
	}
	OverlappingFieldsResolver struct {
		OldFoo func(ctx context.Context, obj *OverlappingFields) (int, error)
	}
	PanicsResolver struct {
		FieldScalarMarshal func(ctx context.Context, obj *Panics) ([]MarshalPanic, error)
		ArgUnmarshal       func(ctx context.Context, obj *Panics, u []MarshalPanic) (bool, error)
	}
	QueryResolver struct {
		InvalidIdentifier      func(ctx context.Context) (*invalid_packagename.InvalidIdentifier, error)
		Collision              func(ctx context.Context) (*introspection1.It, error)
		MapInput               func(ctx context.Context, input map[string]interface{}) (*bool, error)
		Recursive              func(ctx context.Context, input *RecursiveInputSlice) (*bool, error)
		NestedInputs           func(ctx context.Context, input [][]*OuterInput) (*bool, error)
		NestedOutputs          func(ctx context.Context) ([][]*OuterObject, error)
		Shapes                 func(ctx context.Context) ([]Shape, error)
		ErrorBubble            func(ctx context.Context) (*Error, error)
		ModelMethods           func(ctx context.Context) (*ModelMethods, error)
		Valid                  func(ctx context.Context) (string, error)
		User                   func(ctx context.Context, id int) (*User, error)
		NullableArg            func(ctx context.Context, arg *int) (*string, error)
		DirectiveArg           func(ctx context.Context, arg string) (*string, error)
		DirectiveNullableArg   func(ctx context.Context, arg *int, arg2 *int) (*string, error)
		DirectiveInputNullable func(ctx context.Context, arg *InputDirectives) (*string, error)
		DirectiveInput         func(ctx context.Context, arg InputDirectives) (*string, error)
		DirectiveInputType     func(ctx context.Context, arg InnerInput) (*string, error)
		InputSlice             func(ctx context.Context, arg []string) (bool, error)
		ShapeUnion             func(ctx context.Context) (ShapeUnion, error)
		Autobind               func(ctx context.Context) (*Autobind, error)
		DeprecatedField        func(ctx context.Context) (string, error)
		Overlapping            func(ctx context.Context) (*OverlappingFields, error)
		MapStringInterface     func(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error)
		Panics                 func(ctx context.Context) (*Panics, error)
		DefaultScalar          func(ctx context.Context, arg string) (string, error)
		Slices                 func(ctx context.Context) (*Slices, error)
		ScalarSlice            func(ctx context.Context) ([]byte, error)
		Fallback               func(ctx context.Context, arg FallbackToStringEncoding) (FallbackToStringEncoding, error)
		OptionalUnion          func(ctx context.Context) (TestUnion, error)
		ValidType              func(ctx context.Context) (*ValidType, error)
	}
	SubscriptionResolver struct {
		Updated     func(ctx context.Context) (<-chan string, error)
		InitPayload func(ctx context.Context) (<-chan string, error)
	}
	UserResolver struct {
		Friends func(ctx context.Context, obj *User) ([]User, error)
	}
}

func (*Stub) ForcedResolver added in v0.8.0

func (r *Stub) ForcedResolver() ForcedResolverResolver

func (*Stub) ModelMethods added in v0.8.0

func (r *Stub) ModelMethods() ModelMethodsResolver

func (*Stub) OverlappingFields added in v0.8.2

func (r *Stub) OverlappingFields() OverlappingFieldsResolver

func (*Stub) Panics added in v0.8.0

func (r *Stub) Panics() PanicsResolver

func (*Stub) Query added in v0.8.0

func (r *Stub) Query() QueryResolver

func (*Stub) Subscription added in v0.8.0

func (r *Stub) Subscription() SubscriptionResolver

func (*Stub) User added in v0.8.0

func (r *Stub) User() UserResolver

type SubscriptionResolver added in v0.5.1

type SubscriptionResolver interface {
	Updated(ctx context.Context) (<-chan string, error)
	InitPayload(ctx context.Context) (<-chan string, error)
}

type TestUnion added in v0.8.2

type TestUnion interface {
	IsTestUnion()
}

type ThirdParty added in v0.8.0

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

func UnmarshalThirdParty added in v0.8.0

func UnmarshalThirdParty(input interface{}) (ThirdParty, error)

type User added in v0.6.0

type User struct {
	ID      int        `json:"id"`
	Friends []User     `json:"friends"`
	Created time.Time  `json:"created"`
	Updated *time.Time `json:"updated"`
}

type UserResolver added in v0.6.0

type UserResolver interface {
	Friends(ctx context.Context, obj *User) ([]User, error)
}

type ValidInput added in v0.8.0

type ValidInput struct {
	Break       string `json:"break"`
	Default     string `json:"default"`
	Func        string `json:"func"`
	Interface   string `json:"interface"`
	Select      string `json:"select"`
	Case        string `json:"case"`
	Defer       string `json:"defer"`
	Go          string `json:"go"`
	Map         string `json:"map"`
	Struct      string `json:"struct"`
	Chan        string `json:"chan"`
	Else        string `json:"else"`
	Goto        string `json:"goto"`
	Package     string `json:"package"`
	Switch      string `json:"switch"`
	Const       string `json:"const"`
	Fallthrough string `json:"fallthrough"`
	If          string `json:"if"`
	Range       string `json:"range"`
	Type        string `json:"type"`
	Continue    string `json:"continue"`
	For         string `json:"for"`
	Import      string `json:"import"`
	Return      string `json:"return"`
	Var         string `json:"var"`
	Underscore  string `json:"_"`
}

type ValidType added in v0.8.0

type ValidType struct {
	DifferentCase      string `json:"differentCase"`
	DifferentCaseOld   string `json:"different_case"`
	ValidInputKeywords bool   `json:"validInputKeywords"`
	ValidArgs          bool   `json:"validArgs"`
}

These things are all valid, but without care generate invalid go code

type XXIt added in v0.8.2

type XXIt struct {
	ID string `json:"id"`
}

type XxIt added in v0.8.1

type XxIt struct {
	ID string `json:"id"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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