Documentation
¶
Index ¶
- type Adapter
- func (a *Adapter) Bind(dst any) error
- func (a *Adapter) BindWithPrefix(dst any, prefix string) error
- func (a *Adapter) DumpRedacted() map[string]string
- func (a *Adapter) Get(key string) (string, bool)
- func (a *Adapter) GetBoolOr(key string, def bool) bool
- func (a *Adapter) GetDurationOr(key string, def int64) int64
- func (a *Adapter) GetFloat64Or(key string, def float64) float64
- func (a *Adapter) GetInt64Or(key string, def int64) int64
- func (a *Adapter) GetIntOr(key string, def int) int
- func (a *Adapter) GetOr(key, def string) string
- func (a *Adapter) GetUint64Or(key string, def uint64) uint64
- func (a *Adapter) GetUintOr(key string, def uint) uint
- func (a *Adapter) LoadEnvFiles(paths []string) error
- func (a *Adapter) MustBind(dst any)
- func (a *Adapter) MustBindWithPrefix(dst any, prefix string)
- func (a *Adapter) MustGet(key string) string
- func (a *Adapter) MustGetBool(key string) bool
- func (a *Adapter) MustGetDuration(key string) int64
- func (a *Adapter) MustGetFloat64(key string) float64
- func (a *Adapter) MustGetInt(key string) int
- func (a *Adapter) MustGetInt64(key string) int64
- func (a *Adapter) MustGetUint(key string) uint
- func (a *Adapter) MustGetUint64(key string) uint64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct{}
Adapter provides environment variable access using the envvar library.
func (*Adapter) Bind ¶
Bind populates a struct from environment variables. This is a simplified implementation that doesn't use struct tags.
func (*Adapter) BindWithPrefix ¶
BindWithPrefix binds with a prefix.
func (*Adapter) DumpRedacted ¶
DumpRedacted returns environment with secrets redacted.
func (*Adapter) GetDurationOr ¶
GetDurationOr returns the value as duration or default if not present.
func (*Adapter) GetFloat64Or ¶
GetFloat64Or returns the value as float64 or default if not present.
func (*Adapter) GetInt64Or ¶
GetInt64Or returns the value as int64 or default if not present.
func (*Adapter) GetUint64Or ¶
GetUint64Or returns the value as uint64 or default if not present.
func (*Adapter) LoadEnvFiles ¶
LoadEnvFiles loads environment variables from files. Tries .env then /env/.env by default.
func (*Adapter) MustBindWithPrefix ¶
MustBindWithPrefix panics on binding errors with prefix.
func (*Adapter) MustGetBool ¶
MustGetBool returns the value as boolean or panics if not present.
func (*Adapter) MustGetDuration ¶
MustGetDuration returns the value as duration or panics if not present.
func (*Adapter) MustGetFloat64 ¶
MustGetFloat64 returns the value as float64 or panics if not present.
func (*Adapter) MustGetInt ¶
MustGetInt returns the value as integer or panics if not present.
func (*Adapter) MustGetInt64 ¶
MustGetInt64 returns the value as int64 or panics if not present.
func (*Adapter) MustGetUint ¶
MustGetUint returns the value as uint or panics if not present.
func (*Adapter) MustGetUint64 ¶
MustGetUint64 returns the value as uint64 or panics if not present.