feeders

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEnvEmptyPrefixAndSuffix = errors.New("env: prefix or suffix cannot be empty")
View Source
var ErrEnvInvalidStructure = errors.New("env: invalid structure")

Functions

This section is empty.

Types

type AffixedEnvFeeder

type AffixedEnvFeeder struct {
	Prefix string
	Suffix string
}

AffixedEnvFeeder is a feeder that reads environment variables with a prefix and/or suffix

func NewAffixedEnvFeeder

func NewAffixedEnvFeeder(prefix, suffix string) AffixedEnvFeeder

func (AffixedEnvFeeder) Feed

func (f AffixedEnvFeeder) Feed(structure interface{}) error

type DotEnvFeeder

type DotEnvFeeder = feeder.DotEnv

DotEnvFeeder is a feeder that reads .env files

func NewDotEnvFeeder

func NewDotEnvFeeder(filePath string) DotEnvFeeder

type EnvFeeder

type EnvFeeder = feeder.Env

EnvFeeder is a feeder that reads environment variables

func NewEnvFeeder

func NewEnvFeeder() EnvFeeder

type JsonFeeder

type JsonFeeder struct {
	feeder.Json
}

JsonFeeder is a feeder that reads JSON files

func NewJsonFeeder

func NewJsonFeeder(filePath string) JsonFeeder

func (JsonFeeder) FeedKey

func (j JsonFeeder) FeedKey(key string, target interface{}) error

FeedKey reads a JSON file and extracts a specific key

type TenantAffixedEnvFeeder added in v1.1.0

type TenantAffixedEnvFeeder struct {
	*AffixedEnvFeeder
	SetPrefixFunc func(string)
	SetSuffixFunc func(string)
}

func NewTenantAffixedEnvFeeder added in v1.1.0

func NewTenantAffixedEnvFeeder(prefix, suffix func(string) string) TenantAffixedEnvFeeder

NewTenantAffixedEnvFeeder creates a new TenantAffixedEnvFeeder with the given prefix and suffix functions The prefix and suffix functions are used to modify the prefix and suffix of the environment variables before they are used to set the struct fields The prefix and suffix functions should take a string and return a string The prefix function is used to modify the prefix of the environment variables The suffix function is used to modify the suffix of the environment variables

type TomlFeeder

type TomlFeeder struct {
	feeder.Toml
}

TomlFeeder is a feeder that reads TOML files

func NewTomlFeeder

func NewTomlFeeder(filePath string) TomlFeeder

func (TomlFeeder) FeedKey

func (t TomlFeeder) FeedKey(key string, target interface{}) error

FeedKey reads a TOML file and extracts a specific key

type YamlFeeder

type YamlFeeder struct {
	feeder.Yaml
}

YamlFeeder is a feeder that reads YAML files

func NewYamlFeeder

func NewYamlFeeder(filePath string) YamlFeeder

func (YamlFeeder) FeedKey

func (y YamlFeeder) FeedKey(key string, target interface{}) error

FeedKey reads a YAML file and extracts a specific key

Jump to

Keyboard shortcuts

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