directive

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStopExecutionWithoutError = fmt.Errorf("stop execution without error")

ErrStopExecutionWithoutError can be returned from directive.Execute and works like "break" in for loops but on directives chain

Functions

This section is empty.

Types

type Arguments

type Arguments map[string]ast.Value

type ConstructorFun

type ConstructorFun = func(args Arguments, nodeKind string) (Directive, error)

type Definition

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

func NewDirectiveDefinition

func NewDirectiveDefinition(name string, constructor ConstructorFun) Definition

func (Definition) Construct

func (d Definition) Construct(arguments Arguments, node ast.Node) (Directive, error)

func (Definition) Name

func (d Definition) Name() string

type Deprecated added in v0.0.6

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

func (*Deprecated) Define added in v0.0.6

func (d *Deprecated) Define(kind string, obj interface{}) error

func (*Deprecated) Execute added in v0.0.6

func (d *Deprecated) Execute(
	ctx context.Context,
	_ interface{},
	resolvedValue interface{},
	_ map[string]interface{},
) (interface{}, context.Context, error)

type Directive

type Directive interface {
	// Execute defined directive (runtime)
	Execute(
		ctx context.Context,
		source interface{},
		resolvedValue interface{},
		fieldArgs map[string]interface{},
	) (interface{}, context.Context, error) // resolved value with updated context or error

	// Define will take pointer to graphql object and can modify it on making schema stage
	//   kind => obj
	//   "field" => *graphql.Field
	Define(kind string, obj interface{}) error
}

func NewDeprecated added in v0.0.6

func NewDeprecated(args Arguments, nodeKind string) (Directive, error)

func NewValue added in v0.0.6

func NewValue(args Arguments, nodeKind string) (Directive, error)

type Value added in v0.0.6

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

func (*Value) Define added in v0.0.6

func (d *Value) Define(kind string, obj interface{}) error

func (*Value) Execute added in v0.0.6

func (d *Value) Execute(
	ctx context.Context,
	source interface{},
	resolvedValue interface{},
	fieldArgs map[string]interface{},
) (interface{}, context.Context, error)

Jump to

Keyboard shortcuts

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