env

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TagEnv         = "env"
	TagEnvHelp     = "env-help"
	TagDescription = "description"
	TagDefault     = "default"
	TagParser      = "parser"
)

Variables

View Source
var (
	ErrNotPointer       = errors.New("not a pointer to a value")
	ErrInvalid          = errors.New("nil value")
	ErrNotStructPointer = errors.New("not a pointer to a struct")
)
View Source
var ErrNotFound = errors.New("env value not found")

Functions

func RegisterParser

func RegisterParser[P Parser[T], T any]()

func Unmarshal

func Unmarshal(v any) error

Types

type ErrMismatchedParseTypes

type ErrMismatchedParseTypes struct {
	Parser reflect.Type
	Struct reflect.Type
}

func (*ErrMismatchedParseTypes) Error

func (err *ErrMismatchedParseTypes) Error() string

type ErrOpFail

type ErrOpFail[Op fmt.Stringer] struct {
	Op    Op
	Field reflect.StructField
	Err   error
}

func (*ErrOpFail[Op]) Error

func (err *ErrOpFail[Op]) Error() string

func (*ErrOpFail[Op]) Unwrap

func (err *ErrOpFail[Op]) Unwrap() error

type ErrParserNotFound

type ErrParserNotFound struct {
	Name string
}

func (*ErrParserNotFound) Error

func (err *ErrParserNotFound) Error() string

type ErrTagNotSet

type ErrTagNotSet struct {
	Name string
}

func (*ErrTagNotSet) Error

func (err *ErrTagNotSet) Error() string

type OpReadTags

type OpReadTags struct{}

func (OpReadTags) String

func (OpReadTags) String() string

type Parser

type Parser[T any] interface {
	Name() string
	Parse(string) (T, error)
}

type TagOp

type TagOp string

type TagOpParse

type TagOpParse struct{ Name string }

func (TagOpParse) String

func (top TagOpParse) String() string

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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