refparse

package
v0.0.0-...-4962d78 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BreakValueIntoMandates

func BreakValueIntoMandates(value string) map[string]string

func Parse

func Parse(po types.ParserOptions, dst interface{}, source lookup.Getter) error

Parse parses a config struct and fills it with coerced data, or returns an error if something went wrong.

Types

type ArgHelp

type ArgHelp struct {
	FieldDef
	Description string
}

func (ArgHelp) String

func (a ArgHelp) String() string

type FieldDef

type FieldDef struct {
	Name        string
	Type        reflect.Type
	Required    bool
	Default     string
	Description string
}

FieldDef holds the type definition of a field in a custom struct, as well as its Figyr metadata.

func BuildFieldDef

func BuildFieldDef(name string, typ reflect.Type, tagVal string) (FieldDef, error)

BuildFieldDef builds a FieldDef from the given field name, type, and Figyr tag.

func (*FieldDef) Coerce

func (f *FieldDef) Coerce(raw string) (any, error)

Coerce converts the given value to a type compatible with the field.

func (FieldDef) Constraint

func (f FieldDef) Constraint() string

Jump to

Keyboard shortcuts

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