marker

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWrongType = errors.New("incorrect type")
	ErrUnmarshal = errors.New("unable to unmarshal arg value")
)
View Source
var (
	ErrTypeMustBeStruct = errors.New("type must be a struct")
	ErrArgNotFound      = errors.New("argument not found")
	ErrMissingArguments = errors.New("missing arguments")
)

Functions

This section is empty.

Types

type Argument

type Argument struct {
	Name      string
	FieldName string
	// Type is the type of this argument.
	Type reflect.Type
	// Optional indicates if this argument is optional.
	Optional bool
	// Pointer indicates if this argument was a pointer (this is really only
	// needed for deserialization, and should alway imply optional).
	Pointer bool

	Value reflect.Value
	// contains filtered or unexported fields
}

Argument is the type of a marker argument.

func ArgumentFromField

func ArgumentFromField(field *reflect.StructField) (Argument, error)

func (*Argument) InitializeValue

func (a *Argument) InitializeValue()

func (*Argument) SetTypeInfo

func (a *Argument) SetTypeInfo() error

ArgumentFromType constructs an Argument by examining the given reflect.Type.

func (*Argument) SetValue

func (a *Argument) SetValue(value interface{}) error

func (Argument) String

func (a Argument) String() string

type Definition

type Definition struct {
	Name   string
	Output reflect.Type
	Fields map[string]Argument
}

func Define

func Define(name string, outputType interface{}) (*Definition, error)

func (*Definition) GetName

func (m *Definition) GetName() string

func (*Definition) InflateObject

func (m *Definition) InflateObject() (interface{}, error)

func (*Definition) LookupArgument

func (m *Definition) LookupArgument(argName string) bool

func (*Definition) SetArgument

func (m *Definition) SetArgument(argName string, value interface{}) error

func (Definition) String

func (m Definition) String() string

type Registry

type Registry struct {
	Results chan interface{}
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Add

func (r *Registry) Add(marker *Definition)

func (*Registry) GetDefinition

func (r *Registry) GetDefinition(name string) parser.Definition

func (*Registry) Lookup

func (r *Registry) Lookup(name string) bool

Jump to

Keyboard shortcuts

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