Documentation ¶
Overview ¶
copy of github.com/go-task/task/v3/internal/execext/devnull.go
Package godotenv is a go port of the ruby dotenv library (https://github.com/bkeepers/dotenv)
Examples/readme can be found on the github page at https://github.com/joho/godotenv
The TL;DR is that you make a .env file that looks something like
SOME_ENV_VAR=somevalue
and then in your go code you can call
godotenv.Load()
and all the env vars declared in .env will be available through os.Getenv("SOME_ENV_VAR")
Index ¶
- Constants
- Variables
- func AbsPath(cwd string, _path string) string
- func BroadcastInterfaces(dump bool) ([]net.Interface, error)
- func BroadcastInterfacesP(dump bool) []net.Interface
- func BroadcastIpWithInterface(intf net.Interface) (net.IP, error)
- func BroadcastIpWithInterfaceP(intf net.Interface) net.IP
- func CopyFile(fs afero.Fs, path string, newPath string) (int64, error)
- func CopyFileP(fs afero.Fs, path string, newPath string) int64
- func CreateLockFile(fs afero.Fs, filename string) (afero.File, error)
- func DeepCopyMap[T any](that map[string]T) map[string]T
- func DefaultEtcHosts() (string, error)
- func DefaultEtcHostsP() string
- func DefaultOutput() io.Writer
- func DirExists(fs afero.Fs, path string) (bool, error)
- func DirExistsP(fs afero.Fs, path string) bool
- func DowncastMap[V any](m map[string]V) map[string]any
- func DownloadBytes(logger Logger, fallbackDir string, fs afero.Fs, url string, ...) (result []byte, err error)
- func DownloadBytesP(logger Logger, fallbackDir string, fs afero.Fs, url string, ...) []byte
- func DownloadText(logger Logger, fallbackDir string, fs afero.Fs, url string, ...) (string, error)
- func DownloadTextP(logger Logger, fallbackDir string, fs afero.Fs, url string, ...) string
- func EnsureDirExists(fs afero.Fs, path string) error
- func EnsureDirExistsP(fs afero.Fs, path string)
- func EnsureFileExists(fs afero.Fs, path string) error
- func EnsureFileExistsP(fs afero.Fs, path string)
- func EnvSubst(input string, env map[string]string) (string, error)
- func EnvSubstP(input string, env map[string]string) string
- func EnvSubstSlice(inputs []string, env map[string]string) ([]string, error)
- func EnvSubstSliceP(inputs []string, env map[string]string) []string
- func EnvironList(overrides map[string]string) ([]string, error)
- func EnvironListP(overrides map[string]string) []string
- func EnvironMap(overrides map[string]string) (map[string]string, error)
- func EnvironMapP(overrides map[string]string) map[string]string
- func ExecEnv(fs afero.Fs, filenames []string, cmd string, cmdArgs []string) error
- func ExecZenity(ctx context.Context, hc interp.HandlerContext, args []string) error
- func Executable() (string, error)
- func ExecutableP() string
- func ExpandHomePath(path string) (string, error)
- func ExpandHomePathP(path string) string
- func ExtractTitle(filePath string) string
- func FallbackFilePath(fallbackDir string, url string) string
- func FileExists(fs afero.Fs, path string) (bool, error)
- func FileExistsP(fs afero.Fs, path string) bool
- func FromJson(jsonText string, envsubt bool, result any) (err error)
- func FromJsonFile(fs afero.Fs, path string, envsubt bool, result any) error
- func FromJsonFileP(fs afero.Fs, path string, envsubt bool, result any)
- func FromJsonP(jsonText string, envsubt bool, result any)
- func FromYaml(yamlText string, envsubt bool, result any) (err error)
- func FromYamlFile(fs afero.Fs, path string, envsubt bool, result any) error
- func FromYamlFileP(fs afero.Fs, path string, envsubt bool, result any)
- func FromYamlP(yamlText string, envsubt bool, result any)
- func GetLockFilePid(fs afero.Fs, filename string) (pid int, err error)
- func GetMapValue[T any](m map[string]any, key string, devault func() T) T
- func GoshExecHandler(killTimeout time.Duration) interp.ExecHandlerFunc
- func HasFallbackFile(fallbackDir string, fs afero.Fs, url string) (bool, error)
- func Hostname() (string, error)
- func HostnameP() string
- func InputSudoPassword(passwordInput FnInput) string
- func InstrumentSudoCommand(cmd string) string
- func IsDarwin() bool
- func IsDiscardLogger(logger Logger) bool
- func IsEmptyReflectValue(v reflect.Value) bool
- func IsEmptyValue(v any) bool
- func IsFileProtocol(url string) bool
- func IsLinux() bool
- func IsPrimitiveReflectValue(v reflect.Value) bool
- func IsPrimitiveValue(v any) bool
- func IsRemote(url string) bool
- func IsSudoCommand(cmd string) bool
- func IsTerminal() bool
- func IsWindows() bool
- func JoinedLines(lines ...string) string
- func JoinedLinesAsBytes(lines ...string) []byte
- func ListSuffixedFiles(fs afero.Fs, targetDir string, suffix string, skipEmptyFile bool) (map[string]string, error)
- func ListSuffixedFilesP(fs afero.Fs, targetDir string, suffix string, skipEmptyFile bool) map[string]string
- func LoadEnv(fs afero.Fs, filenames ...string) (err error)
- func LoadEnvScript(fs afero.Fs, vars map[string]string, filename string) (map[string]string, error)
- func LoadEnvScripts(fs afero.Fs, vars map[string]string, filenames ...string) (map[string]string, error)
- func Map2Struct(src map[string]any, dest any) error
- func Map2StructP(src map[string]any, dest any)
- func MapFromJson(yamlText string, envsubt bool) (map[string]any, error)
- func MapFromJsonFile(fs afero.Fs, path string, envsubt bool) (map[string]any, error)
- func MapFromJsonFileP(fs afero.Fs, path string, envsubt bool) map[string]any
- func MapFromJsonP(yamlText string, envsubt bool) map[string]any
- func MapFromYaml(yamlText string, envsubt bool) (map[string]any, error)
- func MapFromYamlFile(fs afero.Fs, path string, envsubt bool) (map[string]any, error)
- func MapFromYamlFileP(fs afero.Fs, path string, envsubt bool) map[string]any
- func MapFromYamlP(yamlText string, envsubt bool) map[string]any
- func MarshalEnv(envMap map[string]string) (string, error)
- func MergeMap[T any](bases ...map[string]T) map[string]T
- func Mkdir(fs afero.Fs, path string) error
- func MkdirP(fs afero.Fs, path string)
- func OverloadEnv(fs afero.Fs, filenames ...string) (err error)
- func Pair2Vars(pairs []string) map[string]string
- func ParseEnv(r io.Reader) (envMap map[string]string, err error)
- func ReadBytes(reader io.Reader) ([]byte, error)
- func ReadBytesP(reader io.Reader) []byte
- func ReadEnv(fs afero.Fs, filenames ...string) (envMap map[string]string, err error)
- func ReadFallbackFile(fallbackDir string, fs afero.Fs, url string) (string, []byte, error)
- func ReadFileBytes(fs afero.Fs, path string) ([]byte, error)
- func ReadFileBytesP(fs afero.Fs, path string) []byte
- func ReadFileLines(fs afero.Fs, path string) ([]string, error)
- func ReadFileLinesP(fs afero.Fs, path string) []string
- func ReadFileText(fs afero.Fs, path string) (string, error)
- func ReadFileTextP(fs afero.Fs, path string) string
- func ReadLines(reader io.Reader) []string
- func ReadText(reader io.Reader) (string, error)
- func ReadTextP(reader io.Reader) string
- func RemoveDir(fs afero.Fs, path string) error
- func RemoveDirP(fs afero.Fs, path string)
- func RemoveFile(fs afero.Fs, path string) error
- func RemoveFileP(fs afero.Fs, path string)
- func Rename(fs afero.Fs, path string, newPath string) error
- func RenameP(fs afero.Fs, path string, newPath string)
- func RenderAsTemplate(tmpl string, data map[string]any) (string, error)
- func RenderAsTemplateArray(tmplArray []string, data map[string]any) ([]string, error)
- func RenderAsTemplateArrayP(tmplArray []string, data map[string]any) []string
- func RenderAsTemplateP(tmpl string, data map[string]any) string
- func RenderWithTemplate(w io.Writer, name string, tmpl string, data map[string]any) error
- func RenderWithTemplateP(w io.Writer, name string, tmpl string, data map[string]any)
- func ResolveBroadcastIp(interfaces []net.Interface, interfaceName string) (net.IP, net.IP, error)
- func ResolveBroadcastIpP(interfaces []net.Interface, interfaceName string) (net.IP, net.IP)
- func RunCommandWithInput(vars map[string]string, dir string, cmd string, args ...string) func(...string) (CommandOutput, error)
- func Set2Strings(set *hashset.Set) []string
- func ShortDescription(url string) string
- func Slice2Map[V any](arr []V, keyFunc func(v V) string) map[string]V
- func Slice2Set[T comparable](arr ...T) *hashset.Set
- func SliceEquals[T comparable](a []T, b []T) bool
- func Stat(fs afero.Fs, path string, ensureExists bool) (os.FileInfo, error)
- func StatP(fs afero.Fs, path string, ensureExists bool) os.FileInfo
- func StructToMap(src any) map[string]any
- func SubstVars(useGoTemplate bool, m map[string]any, parentVars map[string]any, ...) (map[string]any, error)
- func SubstVarsP(useGoTemplate bool, m map[string]any, parentVars map[string]any, ...) map[string]any
- func SysEnvFileNames(fs afero.Fs, shell string) []string
- func TempFile(fs afero.Fs, pattern string) (string, error)
- func TempFileP(fs afero.Fs, pattern string) string
- func TempTextFile(fs afero.Fs, pattern string, content string) (string, error)
- func TempTextFileP(fs afero.Fs, pattern string, content string) string
- func Text2Lines(text string) []string
- func Text2Vars(text string) map[string]string
- func TextLine2Array(line string) []string
- func ToYaml(hint string, me any) (string, error)
- func ToYamlP(hint string, me any) string
- func UnmarshalEnv(str string) (envMap map[string]string, err error)
- func UserHomeDir() (string, error)
- func UserHomeDirP() string
- func Vars2Pair(vars map[string]string) []string
- func WorkDir(url string, defaultDir string) string
- func WorkingDirectory() (string, error)
- func WorkingDirectoryP() string
- func WriteEnv(fs afero.Fs, envMap map[string]string, filename string) error
- func WriteFallbackFile(fallbackDir string, fs afero.Fs, url string, bytes []byte) (string, error)
- func WriteFile(fs afero.Fs, path string, content []byte) error
- func WriteFileIfNotFound(fs afero.Fs, path string, content []byte) (bool, error)
- func WriteFileIfNotFoundP(fs afero.Fs, path string, content []byte) bool
- func WriteFileLines(fs afero.Fs, path string, lines ...string) error
- func WriteFileLinesP(fs afero.Fs, path string, lines ...string)
- func WriteFileP(fs afero.Fs, path string, content []byte)
- func WriteFileText(fs afero.Fs, path string, content string) error
- func WriteFileTextIfNotFound(fs afero.Fs, path string, content string) (bool, error)
- func WriteFileTextIfNotFoundP(fs afero.Fs, path string, content string) bool
- func WriteFileTextP(fs afero.Fs, path string, content string)
- func ZenityError(ctx context.Context, hc interp.HandlerContext, args []string) error
- func ZenityInfo(ctx context.Context, hc interp.HandlerContext, args []string) error
- func ZenityQuestion(ctx context.Context, hc interp.HandlerContext, args []string) error
- func ZenityWarning(ctx context.Context, hc interp.HandlerContext, args []string) error
- type AferoBlob
- type AferoBlobT
- type AferoFile
- func (me AferoFile) Credentials() Credentials
- func (me AferoFile) Dir() string
- func (me AferoFile) Download() (Content, error)
- func (me AferoFile) DownloadP() Content
- func (me AferoFile) Fs() afero.Fs
- func (me AferoFile) Name() string
- func (me AferoFile) Protocol() string
- func (me AferoFile) Timeout() time.Duration
- func (me AferoFile) URL() *url.URL
- func (me AferoFile) Url() string
- type AferoFileT
- type CommandOutput
- func ParseCommandOutput(outputText string) (CommandOutput, error)
- func ParseCommandOutputP(outputText string) CommandOutput
- func RunCommandNoInput(vars map[string]string, dir string, cmd string, args ...string) (CommandOutput, error)
- func RunCommandNoInputP(vars map[string]string, dir string, cmd string, args ...string) CommandOutput
- func RunGoshCommand(vars map[string]string, dir string, cmd string, passwordInput FnInput) (CommandOutput, error)
- func RunGoshCommandP(vars map[string]string, dir string, cmd string, passwordInput FnInput) CommandOutput
- func RunShellCommand(vars map[string]string, dir string, sh string, cmd string, ...) (CommandOutput, error)
- func RunShellCommandP(vars map[string]string, dir string, sh string, cmd string, ...) CommandOutput
- func RunSudoCommand(vars map[string]string, dir string, cmd string, passwordInput FnInput) (CommandOutput, error)
- func RunUserCommand(vars map[string]string, dir string, cmd string) (CommandOutput, error)
- func RunUserCommandP(vars map[string]string, dir string, cmd string) CommandOutput
- type CommandOutputKind
- type CommandOutputT
- type ConfigConfig
- type ConfigMetadata
- func DecodeWithMap[T any](input map[string]any, cfgcfg *ConfigConfig, result *T, devault map[string]any) (*T, *ConfigMetadata, error)
- func DecodeWithMapP[T any](input map[string]any, cfgcfg *ConfigConfig, result *T, devault map[string]any) (*T, *ConfigMetadata)
- func DecodeWithYaml[T any](yamlText string, cfgcfg *ConfigConfig, result *T, devault map[string]any) (*T, *ConfigMetadata, error)
- func DecodeWithYamlP[T any](yamlText string, cfgcfg *ConfigConfig, result *T, devault map[string]any) (*T, *ConfigMetadata)
- type Content
- type ContentT
- type Credentials
- type CredentialsT
- type ErrorGroup
- type ErrorGroupT
- type EventLogger
- func (me EventLogger) LogDebug(enm event.LogEnum, hub string, topic string, lsner string)
- func (me EventLogger) LogError(enm event.LogEnum, hub string, topic string, lsner string, err any)
- func (me EventLogger) LogEventDebug(enm event.LogEnum, lsner string, evnt event.Event)
- func (me EventLogger) LogEventError(enm event.LogEnum, lsner string, evnt event.Event, err any)
- func (me EventLogger) LogEventInfo(enm event.LogEnum, lsner string, evnt event.Event)
- func (me EventLogger) LogInfo(enm event.LogEnum, hub string, topic string, lsner string)
- func (me EventLogger) Target() Logger
- type EventLoggerT
- type File
- type FnInput
- type KeyValue
- type LogContext
- type LogEntry
- type Logger
- type LoggerConfig
- type LoggerConfigT
- type LoggerT
- type OrderedMap
- func (me *OrderedMap[K]) Delete(key string)
- func (me *OrderedMap[K]) Entries() []*KeyValue[K]
- func (me *OrderedMap[K]) Find(key string) (K, bool)
- func (me *OrderedMap[K]) Get(key string) K
- func (me *OrderedMap[K]) Has(key string) bool
- func (me *OrderedMap[K]) Keys() *hashset.Set
- func (me *OrderedMap[K]) Len() int
- func (me *OrderedMap[K]) MarshalJSON() ([]byte, error)
- func (me *OrderedMap[K]) Put(key string, value K)
- func (me *OrderedMap[K]) PutAll(nameResolver func(v K) string, values []K)
- func (me *OrderedMap[K]) PutIfAbsent(key string, value K) bool
- func (me *OrderedMap[K]) SortByKey(revert bool)
- func (me *OrderedMap[K]) UnmarshalJSON(bytes []byte) error
- func (me *OrderedMap[K]) Values() []K
- type RemoteFile
- func (me RemoteFile) Credentials() Credentials
- func (me RemoteFile) Dir() string
- func (me RemoteFile) Download() (Content, error)
- func (me RemoteFile) DownloadP() Content
- func (me RemoteFile) Name() string
- func (me RemoteFile) Protocol() string
- func (me RemoteFile) Timeout() time.Duration
- func (me RemoteFile) URL() *url.URL
- func (me RemoteFile) Url() string
- type RemoteFileT
Constants ¶
Variables ¶
var AppFs = afero.NewOsFs()
var TraceId atomic.Int64
Functions ¶
func BroadcastInterfacesP ¶
func CreateLockFile ¶ added in v2.2.0
CreateLockFile tries to create a file with given name and acquire an exclusive lock on it. If the file already exists AND is still locked, it will fail.
func DeepCopyMap ¶ added in v2.2.8
func DefaultEtcHosts ¶ added in v2.2.0
func DefaultEtcHostsP ¶ added in v2.2.0
func DefaultEtcHostsP() string
func DefaultOutput ¶
func DownloadBytes ¶ added in v2.2.0
func DownloadBytesP ¶ added in v2.2.0
func DownloadText ¶ added in v2.2.0
func DownloadTextP ¶ added in v2.2.0
func EnsureDirExistsP ¶ added in v2.2.0
func EnsureFileExistsP ¶ added in v2.2.0
func EnvironListP ¶
func ExecEnv ¶ added in v2.2.2
Exec loads env vars from the specified filenames (empty map falls back to default) then executes the cmd specified.
Simply hooks up os.Stdin/err/out to the command and calls Run()
If you want more fine grained control over your command it's recommended that you use `Load()` or `Read()` and the `os/exec` package yourself.
func ExecZenity ¶
func Executable ¶
func ExecutableP ¶
func ExecutableP() string
func ExpandHomePath ¶ added in v2.2.0
ExpandHomePath ...
func ExpandHomePathP ¶ added in v2.2.0
func ExtractTitle ¶ added in v2.2.0
func FallbackFilePath ¶ added in v2.2.0
func FileExists ¶ added in v2.2.0
FileExists ...
func FromJsonFile ¶ added in v2.2.9
func FromJsonFileP ¶ added in v2.2.9
func FromYamlFile ¶ added in v2.2.0
func FromYamlFileP ¶ added in v2.2.0
func GetLockFilePid ¶ added in v2.2.0
If filename is a lock file, returns the PID of the process locking it
func GetMapValue ¶ added in v2.2.13
func GoshExecHandler ¶
func GoshExecHandler(killTimeout time.Duration) interp.ExecHandlerFunc
func HasFallbackFile ¶ added in v2.2.0
func InputSudoPassword ¶ added in v2.0.3
func InstrumentSudoCommand ¶ added in v2.0.3
func IsDiscardLogger ¶ added in v2.2.2
func IsEmptyReflectValue ¶ added in v2.2.10
Copied From http://golang.org/src/encoding/json/encode.go Lines 280 - 296
func IsEmptyValue ¶ added in v2.2.12
func IsFileProtocol ¶ added in v2.2.0
func IsPrimitiveReflectValue ¶ added in v2.2.10
func IsPrimitiveValue ¶ added in v2.2.12
func IsSudoCommand ¶
func IsTerminal ¶
func IsTerminal() bool
func JoinedLines ¶
func JoinedLinesAsBytes ¶
func ListSuffixedFiles ¶ added in v2.2.0
func ListSuffixedFilesP ¶ added in v2.2.0
func LoadEnv ¶ added in v2.2.2
Load will read your env file(s) and load them into ENV for this process.
Call this function as close as possible to the start of your program (ideally in main)
If you call Load without any args it will default to loading .env in the current path ¶
You can otherwise tell it which files to load (there can be more than one) like
godotenv.Load("fileone", "filetwo")
It's important to note that it WILL NOT OVERRIDE an env variable that already exists - consider the .env file to set dev vars or sensible defaults
func LoadEnvScript ¶ added in v2.2.17
func LoadEnvScripts ¶ added in v2.2.17
func Map2StructP ¶
func MapFromJson ¶ added in v2.2.9
func MapFromJsonFile ¶ added in v2.2.9
func MapFromJsonFileP ¶ added in v2.2.9
func MapFromYaml ¶ added in v2.2.0
func MapFromYamlFile ¶ added in v2.2.0
func MapFromYamlFileP ¶ added in v2.2.0
func MarshalEnv ¶ added in v2.2.2
Marshal outputs the given environment as a dotenv-formatted environment file. Each line is in the format: KEY="VALUE" where VALUE is backslash-escaped.
func OverloadEnv ¶ added in v2.2.2
Overload will read your env file(s) and load them into ENV for this process.
Call this function as close as possible to the start of your program (ideally in main)
If you call Overload without any args it will default to loading .env in the current path ¶
You can otherwise tell it which files to load (there can be more than one) like
godotenv.Overload("fileone", "filetwo")
It's important to note this WILL OVERRIDE an env variable that already exists - consider the .env file to forcefilly set all vars.
func ParseEnv ¶ added in v2.2.2
Parse reads an env file from io.Reader, returning a map of keys and values.
func ReadEnv ¶ added in v2.2.2
Read all env (with same file loading semantics as Load) but return values as a map rather than automatically writing values into env
func ReadFallbackFile ¶ added in v2.2.0
func ReadFileBytes ¶ added in v2.2.0
ReadBytes ...
func RemoveDirP ¶ added in v2.2.0
func RemoveFileP ¶ added in v2.2.0
func RenderAsTemplateArray ¶
func RenderAsTemplateArrayP ¶
func RenderWithTemplate ¶
func RenderWithTemplateP ¶
func ResolveBroadcastIp ¶
func ResolveBroadcastIpP ¶
func RunCommandWithInput ¶
func Set2Strings ¶ added in v2.2.5
func ShortDescription ¶ added in v2.2.0
func Slice2Set ¶
func Slice2Set[T comparable](arr ...T) *hashset.Set
func SliceEquals ¶
func SliceEquals[T comparable](a []T, b []T) bool
func StructToMap ¶
func SubstVarsP ¶
func TempTextFile ¶ added in v2.2.0
func TempTextFileP ¶ added in v2.2.0
func Text2Lines ¶
func TextLine2Array ¶
func UnmarshalEnv ¶ added in v2.2.2
Unmarshal reads an env file from a string, returning a map of keys and values.
func UserHomeDir ¶ added in v2.2.0
func UserHomeDirP ¶ added in v2.2.0
func UserHomeDirP() string
func WorkingDirectory ¶
func WorkingDirectoryP ¶
func WorkingDirectoryP() string
func WriteFallbackFile ¶ added in v2.2.0
func WriteFileIfNotFound ¶ added in v2.2.0
WriteIfNotFound ...
func WriteFileIfNotFoundP ¶ added in v2.2.0
func WriteFileLines ¶ added in v2.2.0
func WriteFileLinesP ¶ added in v2.2.0
WriteLines ...
func WriteFileText ¶ added in v2.2.0
WriteText ...
func WriteFileTextIfNotFound ¶ added in v2.2.0
func WriteFileTextIfNotFoundP ¶ added in v2.2.0
WriteTextIfNotFound ...
func ZenityError ¶
func ZenityInfo ¶
func ZenityQuestion ¶
func ZenityWarning ¶
Types ¶
type AferoBlob ¶ added in v2.2.0
type AferoBlob = *AferoBlobT
type AferoBlobT ¶ added in v2.2.0
type AferoBlobT struct {
// contains filtered or unexported fields
}
type AferoFile ¶ added in v2.2.0
type AferoFile = *AferoFileT
func NewAferoFile ¶ added in v2.2.0
func NewAferoFileP ¶ added in v2.2.0
func (AferoFile) Credentials ¶ added in v2.2.0
func (me AferoFile) Credentials() Credentials
type AferoFileT ¶ added in v2.2.0
type AferoFileT struct {
// contains filtered or unexported fields
}
type CommandOutput ¶
type CommandOutput = *CommandOutputT
func ParseCommandOutput ¶
func ParseCommandOutput(outputText string) (CommandOutput, error)
func ParseCommandOutputP ¶
func ParseCommandOutputP(outputText string) CommandOutput
func RunCommandNoInput ¶
func RunCommandNoInputP ¶
func RunGoshCommand ¶
func RunGoshCommandP ¶
func RunShellCommand ¶
func RunShellCommandP ¶
func RunSudoCommand ¶
func RunUserCommand ¶
func RunUserCommandP ¶
func RunUserCommandP(vars map[string]string, dir string, cmd string) CommandOutput
type CommandOutputKind ¶
type CommandOutputKind byte
const ( COMMAND_OUTPUT_KIND_TEXT CommandOutputKind COMMAND_OUTPUT_KIND_VARS COMMAND_OUTPUT_KIND_JSON )
type CommandOutputT ¶
type CommandOutputT struct { Kind CommandOutputKind Vars map[string]string Text string Json any }
type ConfigConfig ¶ added in v2.2.1
type ConfigConfig struct { // If ErrorUnused is true, then it is an error for there to exist // keys in the original map that were unused in the decoding process // (extra keys). ErrorUnused bool // If ErrorUnset is true, then it is an error for there to exist // fields in the result that were not set in the decoding process // (extra fields). This only applies to decoding to a struct. This // will affect all nested structs as well. ErrorUnset bool // ZeroFields, if set to true, will zero fields before writing them. // For example, a map will be emptied before decoded values are put in // it. If this is false, a map will be merged. ZeroFields bool // If WeaklyTypedInput is true, the decoder will make the following // "weak" conversions: // // - bools to string (true = "1", false = "0") // - numbers to string (base 10) // - bools to int/uint (true = 1, false = 0) // - strings to int/uint (base implied by prefix) // - int to bool (true if value != 0) // - string to bool (accepts: 1, t, T, TRUE, true, True, 0, f, F, // FALSE, false, False. Anything else is an error) // - empty array = empty map and vice versa // - negative numbers to overflowed uint values (base 10) // - slice of maps to a merged map // - single values are converted to slices if required. Each // element is weakly decoded. For example: "4" can become []int{4} // if the target type is an int slice. // WeaklyTypedInput bool // Squash will squash embedded structs. A squash tag may also be // added to an individual struct field using a tag. For example: // // type Parent struct { // Child `mapstructure:",squash"` // } Squash bool // IgnoreUntaggedFields ignores all struct fields without explicit // TagName, comparable to `mapstructure:"-"` as default behaviour. IgnoreUntaggedFields bool Metadata ConfigMetadata DoValidate bool }
Derived from mapstructure.DecodeConfig
func DynamicConfigConfig ¶ added in v2.2.1
func DynamicConfigConfig() *ConfigConfig
func StrictConfigConfig ¶ added in v2.2.1
func StrictConfigConfig() *ConfigConfig
func (*ConfigConfig) ToMapstruct ¶ added in v2.2.1
func (me *ConfigConfig) ToMapstruct() *mapstructure.DecoderConfig
type ConfigMetadata ¶ added in v2.2.11
type ConfigMetadata = mapstructure.Metadata
func DecodeWithMap ¶ added in v2.2.3
func DecodeWithMap[T any](input map[string]any, cfgcfg *ConfigConfig, result *T, devault map[string]any) (*T, *ConfigMetadata, error)
func DecodeWithMapP ¶ added in v2.2.3
func DecodeWithMapP[T any](input map[string]any, cfgcfg *ConfigConfig, result *T, devault map[string]any) (*T, *ConfigMetadata)
func DecodeWithYaml ¶ added in v2.2.1
func DecodeWithYaml[T any](yamlText string, cfgcfg *ConfigConfig, result *T, devault map[string]any) (*T, *ConfigMetadata, error)
func DecodeWithYamlP ¶ added in v2.2.1
func DecodeWithYamlP[T any](yamlText string, cfgcfg *ConfigConfig, result *T, devault map[string]any) (*T, *ConfigMetadata)
type ContentT ¶ added in v2.2.0
type ContentT = models.RemoteFileContent
type Credentials ¶ added in v2.2.0
type Credentials = *CredentialsT
type CredentialsT ¶ added in v2.2.0
type CredentialsT = models.Credentials
type ErrorGroup ¶
type ErrorGroup = *ErrorGroupT
func NewErrorGroup ¶
func NewErrorGroup(dumpStack bool) ErrorGroup
func (ErrorGroup) Add ¶
func (me ErrorGroup) Add(err error)
func (ErrorGroup) AddAll ¶ added in v2.1.3
func (me ErrorGroup) AddAll(that ErrorGroup)
func (ErrorGroup) AmountOfErrors ¶
func (me ErrorGroup) AmountOfErrors() int
func (ErrorGroup) Error ¶
func (me ErrorGroup) Error() string
func (ErrorGroup) HasError ¶
func (me ErrorGroup) HasError() bool
func (ErrorGroup) MayError ¶ added in v2.2.17
func (me ErrorGroup) MayError() error
type ErrorGroupT ¶
type ErrorGroupT struct {
// contains filtered or unexported fields
}
type EventLogger ¶
type EventLogger = *EventLoggerT
func NewEventLogger ¶
func NewEventLogger(target Logger) EventLogger
func (EventLogger) LogDebug ¶
func (me EventLogger) LogDebug(enm event.LogEnum, hub string, topic string, lsner string)
func (EventLogger) LogError ¶
func (me EventLogger) LogError(enm event.LogEnum, hub string, topic string, lsner string, err any)
func (EventLogger) LogEventDebug ¶
func (me EventLogger) LogEventDebug(enm event.LogEnum, lsner string, evnt event.Event)
func (EventLogger) LogEventError ¶
func (me EventLogger) LogEventError(enm event.LogEnum, lsner string, evnt event.Event, err any)
func (EventLogger) LogEventInfo ¶
func (me EventLogger) LogEventInfo(enm event.LogEnum, lsner string, evnt event.Event)
func (EventLogger) LogInfo ¶
func (me EventLogger) LogInfo(enm event.LogEnum, hub string, topic string, lsner string)
func (EventLogger) Target ¶
func (me EventLogger) Target() Logger
type EventLoggerT ¶
type EventLoggerT struct {
// contains filtered or unexported fields
}
type File ¶ added in v2.2.0
type File interface { Name() string Dir() string Url() string Protocol() string URL() *url.URL Credentials() Credentials Timeout() time.Duration DownloadP() Content Download() (Content, error) }
type LogContext ¶
type LogContext = LogEntry
func NewLogContext ¶
func NewLogContext(generateNewTraceId bool) LogContext
type Logger ¶
type Logger = *LoggerT
func NewDiscardLogger ¶
func NewDiscardLogger() Logger
func NewLoggerP ¶
func NewLoggerP(console io.Writer, config LoggerConfig, fileName string) Logger
func (Logger) NewSubLogger ¶
func (me Logger) NewSubLogger(lctx LogContext) Logger
type LoggerConfig ¶
type LoggerConfig = *LoggerConfigT
type LoggerConfigT ¶
type LoggerConfigT struct { MaxSize int `json:"max_size" yaml:"maxsize"` MaxAge int `json:"max_age" yaml:"maxage"` MaxBackups int `json:"max_backups" yaml:"maxbackups"` LocalTime bool `json:"local_time" yaml:"localtime"` Compress bool `json:"compress" yaml:"compress"` }
see lumberjack.Logger
type OrderedMap ¶ added in v2.1.0
type OrderedMap[K any] struct { // contains filtered or unexported fields }
func NewOrderedMap ¶ added in v2.1.0
func NewOrderedMap[K any](nilValue K) *OrderedMap[K]
func (*OrderedMap[K]) Delete ¶ added in v2.1.0
func (me *OrderedMap[K]) Delete(key string)
func (*OrderedMap[K]) Entries ¶ added in v2.1.0
func (me *OrderedMap[K]) Entries() []*KeyValue[K]
func (*OrderedMap[K]) Find ¶ added in v2.1.0
func (me *OrderedMap[K]) Find(key string) (K, bool)
func (*OrderedMap[K]) Get ¶ added in v2.1.0
func (me *OrderedMap[K]) Get(key string) K
func (*OrderedMap[K]) Has ¶ added in v2.1.0
func (me *OrderedMap[K]) Has(key string) bool
func (*OrderedMap[K]) Keys ¶ added in v2.1.0
func (me *OrderedMap[K]) Keys() *hashset.Set
func (*OrderedMap[K]) Len ¶ added in v2.1.0
func (me *OrderedMap[K]) Len() int
func (*OrderedMap[K]) MarshalJSON ¶ added in v2.1.0
func (me *OrderedMap[K]) MarshalJSON() ([]byte, error)
func (*OrderedMap[K]) Put ¶ added in v2.1.1
func (me *OrderedMap[K]) Put(key string, value K)
func (*OrderedMap[K]) PutAll ¶ added in v2.1.1
func (me *OrderedMap[K]) PutAll(nameResolver func(v K) string, values []K)
func (*OrderedMap[K]) PutIfAbsent ¶ added in v2.1.2
func (me *OrderedMap[K]) PutIfAbsent(key string, value K) bool
func (*OrderedMap[K]) SortByKey ¶ added in v2.1.5
func (me *OrderedMap[K]) SortByKey(revert bool)
func (*OrderedMap[K]) UnmarshalJSON ¶ added in v2.1.0
func (me *OrderedMap[K]) UnmarshalJSON(bytes []byte) error
func (*OrderedMap[K]) Values ¶ added in v2.1.0
func (me *OrderedMap[K]) Values() []K
type RemoteFile ¶ added in v2.2.0
type RemoteFile = *RemoteFileT
func NewRemoteFile ¶ added in v2.2.0
func NewRemoteFile(url string, credentials Credentials, timeout time.Duration) (RemoteFile, error)
func NewRemoteFileP ¶ added in v2.2.0
func NewRemoteFileP(url string, credentials Credentials, timeout time.Duration) RemoteFile
func (RemoteFile) Credentials ¶ added in v2.2.0
func (me RemoteFile) Credentials() Credentials
func (RemoteFile) Download ¶ added in v2.2.0
func (me RemoteFile) Download() (Content, error)
func (RemoteFile) DownloadP ¶ added in v2.2.0
func (me RemoteFile) DownloadP() Content
func (RemoteFile) Name ¶ added in v2.2.0
func (me RemoteFile) Name() string
func (RemoteFile) Protocol ¶ added in v2.2.0
func (me RemoteFile) Protocol() string
remote protocol. May be used to explicitly tell what protocol to use (i.e. "http", "ftp", "etc").
func (RemoteFile) Timeout ¶ added in v2.2.0
func (me RemoteFile) Timeout() time.Duration
func (RemoteFile) URL ¶ added in v2.2.0
func (me RemoteFile) URL() *url.URL
type RemoteFileT ¶ added in v2.2.0
type RemoteFileT struct {
// contains filtered or unexported fields
}