Documentation
¶
Index ¶
- Constants
- Variables
- func EpochStringToTime(s string) (time.Time, error)
- func IsTruthy(s string) bool
- func PanicHandler(handler func(err any))
- func SplitAny(s string, seps string) []string
- func TruncateStringWholeWords(s string, maxLength uint) string
- func TruthyValues() dsext.Set[string]
- func WithFile[T any](path string, f func(file *os.File) (T, error)) (T, error)
- func WithFileFS[T any](path string, fs fs.FS, f func(file fs.File) (T, error)) (T, error)
- func WithFileRoot[T any](path string, root *os.Root, f func(file *os.File) (T, error)) (T, error)
- type EnvVarHelper
Constants ¶
View Source
const DefaultEnvVarPrefix = "APP_"
Variables ¶
View Source
var ( ErrEmptyEpochString = errors.New("empty epoch string") ErrNilRoot = errors.New("root is nil") )
Functions ¶
func PanicHandler ¶
func PanicHandler(handler func(err any))
func SplitAny ¶ added in v0.1.2
SplitAny splits the string s around each instance of one of the Unicode code points in seps.
func TruthyValues ¶
func WithFile ¶ added in v0.1.2
WithFile opens the file specified by the path using os.Open and calls f with it. The file is closed after f returns.
func WithFileFS ¶ added in v0.1.2
WithFileFS opens the file in filesystem fs specified by the path and calls f with it. The file is closed after f returns.
Types ¶
type EnvVarHelper ¶
type EnvVarHelper string
func NewEnvVarHelper ¶
func NewEnvVarHelper(prefix string) EnvVarHelper
func (EnvVarHelper) Bool ¶
func (evh EnvVarHelper) Bool(key string, defaultValue bool) (bool, error)
func (EnvVarHelper) Int ¶
func (evh EnvVarHelper) Int(key string, defaultValue int64) (int64, error)
func (EnvVarHelper) PrefixVar ¶
func (evh EnvVarHelper) PrefixVar(s string) string
Click to show internal directories.
Click to hide internal directories.