configutils

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetKeyToTransformMap

func GetKeyToTransformMap(value any) map[string]TransformTarget

func WatchFile

func WatchFile(path string, f *file.File, loadFunc func())

Types

type Config

type Config struct {
	Layer    *koanf.Koanf
	LoadFunc func()
}

func New

func New() *Config

func (Config) ApplyTransformFuncs

func (config Config) ApplyTransformFuncs(structSchema any, path string, funcs map[string]func(string, any) (string, any))

func (*Config) Delete

func (config *Config) Delete(path string) error

func (*Config) Load

func (config *Config) Load(data map[string]any, path string) error

func (*Config) LoadDir

func (config *Config) LoadDir(path string, dir string, ext string, parser koanf.Parser) error

func (*Config) LoadEnv

func (config *Config) LoadEnv() (koanf.Provider, error)

func (*Config) LoadFile

func (config *Config) LoadFile(path string, parser koanf.Parser) (koanf.Provider, error)

func (*Config) MergeLayers

func (config *Config) MergeLayers(layers ...*koanf.Koanf)

func (*Config) NormalizeEnv

func (config *Config) NormalizeEnv(key string, value string) (string, any)

func (*Config) OnLoad

func (config *Config) OnLoad(onLoad func())

func (*Config) TemplateConfig

func (config *Config) TemplateConfig()

type TransformTarget

type TransformTarget struct {
	Key            string
	Transform      string
	ChildTransform string
	Value          any
}

Jump to

Keyboard shortcuts

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