reflector

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyRegisterd    = errors.New("already registered")
	ErrInvalidEnvTag       = errors.New("env tag empty or invalid")
	ErrUnmarshalerNotFound = errors.New("unmarshaler not found")
)

Functions

func Register

func Register(u unmarshal.Unmarshaler) error

func RegisterForType

func RegisterForType(i interface{}, u unmarshal.Unmarshaler) error

func SortWithDeps

func SortWithDeps(keys []string, envs map[string]*Target) []string

Types

type ConditionEnum

type ConditionEnum []string

type ConditionRequireIf

type ConditionRequireIf struct {
	Target   *TargetField
	ValueStr string
}

type ConditionRequireIfCombined

type ConditionRequireIfCombined struct {
	First  *ConditionRequireIf
	Second interface{}
}

type ConditionRequired

type ConditionRequired bool

type InvalidConfigTypeError

type InvalidConfigTypeError string

func (InvalidConfigTypeError) Error

func (e InvalidConfigTypeError) Error() string

type Reflector

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

func New

func New() *Reflector

func (*Reflector) Reflect

func (r *Reflector) Reflect(conf interface{}) (*Result, error)

type Result

type Result struct {
	ConfigPkg  string
	ConfigType string
	Packages   map[string]struct{}
	Envs       map[string]*Target
}

type Target

type Target struct {
	Field     *TargetField
	Condition interface{}
}

type TargetField

type TargetField struct {
	Name        string
	Unmarshaler unmarshal.UnmarshalerName
}

type UnsupportedFieldTypeError

type UnsupportedFieldTypeError struct {
	Field string
	Type  string
}

func (*UnsupportedFieldTypeError) Error

func (e *UnsupportedFieldTypeError) Error() string

Jump to

Keyboard shortcuts

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