underlying

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound shows supplied value could not be found for supported underlying type.

Functions

func CastMap

func CastMap[T Basic, U ~map[T]struct{}](val *U) (m *map[T]struct{})

CastMap converts `map[T]struct{}` from `U` (defined type of map). Because if `U` represents as defined type, convert process will be so complicated.

func CastSlice

func CastSlice[T Basic, U ~[]T](val *U) (s *[]T)

CastSlice converts `[]T` from `U` (defined type of slice). Because if `U` represents as defined type, convert process will be so complicated.

func Resolve

func Resolve(env string, val any) error

Resolve resolves underlying type of value which it receives. supported: (via https://cs.opensource.google/go/x/exp/+/master:constraints/constraints.go) - int, int8, int16, int32, int64 (equivarent of constraints.Signed) - uint, uint8, uint16, uint32, uint64 (equivarent of constraints.Unsigned) - float32, float64 (equivarent of constraints.Float) - string - bool - time.Time - time.Duration if this function receives value except aboves, returns nil.

Types

type Basic

type Basic interface {
	~string | ~*string | ~bool | ~*bool | numbers | numbersPtr | time.Time
}

Basic sets underlying basic types and its pointer types.

Jump to

Keyboard shortcuts

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