config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNoKey          = utils.Error("Config key does not exist")
	ErrNotImplemented = utils.Error("Config method or type not implemented")
	ErrInvalidType    = utils.Error("Invalid destination type")
)

Variables

This section is empty.

Functions

func StrOrFile

func StrOrFile(value string) string

StrOrFile attempts to identify a valid file path from value; if value starts with "/" or "./" it will attempt to read the file contents and return it instead; if the file contains an extra \n it will be trimmed. If no file is found (either value does not start with "/" or "./", or file does not exist), value is returned.

Types

type ConfigProvider added in v0.6.0

type ConfigProvider interface {
	Get(dest interface{}) error
	GetKey(key string, dest interface{}) error
	GetStringKey(key string) (string, error)
	GetBoolKey(key string) (bool, error)
	GetIntKey(key string) (int, error)
	GetFloat64Key(key string) (float64, error)
	GetSliceKey(key, separator string) ([]string, error)
	GetConfigNode(key string) (ConfigProvider, error)
	KeyExists(key string) bool
	KeyListExists(keys []string) bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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