internal

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package internal provides internal implementation logic for environment variables parsing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bool added in v1.9.0

type Bool interface {
	bool | []bool
}

Bool is a constraint for bool and slice of bool.

type Complex added in v1.9.0

type Complex interface {
	complex64 | []complex64 | complex128 | []complex128
}

Complex is a constraint for complex and slice of complex.

type EnvParsable

type EnvParsable interface {
	String | Int | Uint | Float | Time | Bool | URL | IP | Complex
}

EnvParsable is a constraint for types that can be parsed from environment variable.

type EnvParser

type EnvParser interface {
	// ParseEnv parses environment variable by key and returns value.
	ParseEnv(key string, defaltVal any, options Parameters) any
}

EnvParser interface for parsing environment variables.

func NewEnvParser

func NewEnvParser(v any) EnvParser

NewEnvParser is a constructor for EnvParser.

type Float

type Float interface {
	float32 | []float32 | float64 | []float64
}

Float is a constraint for float and slice of floats.

type IP added in v1.9.0

type IP interface {
	net.IP | []net.IP
}

IP is a constraint for net.IP and slice of net.IP.

type Int

type Int interface {
	int | []int | int8 | []int8 | int16 | []int16 | int32 | []int32 | int64 | []int64
}

Int is a constraint for integer and slice of integers.

type Parameters

type Parameters struct {
	Separator string
	Layout    string
}

Parameters is a struct for holding parameters for the parser. It is used to pass parameters to the parser. Separator is a separator for the environment variable that holds slice. Layout is a layout for the time.Time.

type String

type String interface {
	string | []string
}

String is a constraint for string and slice of strings.

type Time

type Time interface {
	time.Time | []time.Time | time.Duration | []time.Duration
}

Time is a constraint for time.Time and slice of time.Time.

type URL added in v1.9.0

type URL interface {
	url.URL | []url.URL
}

URL is a constraint for url.URL and slice of url.URL.

type Uint added in v1.6.0

type Uint interface {
	uint | []uint | uint8 | []uint8 | uint16 | []uint16 | uint32 | []uint32 | uint64 | []uint64 | uintptr | []uintptr
}

Uint is a constraint for unsigned integer and slice of unsigned integers.

Jump to

Keyboard shortcuts

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