Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrError = errors.New("") ErrLoadFailed = fmt.Errorf("%wloading failed", ErrError) ErrSaveFailed = fmt.Errorf("%wsaving failed", ErrError) ErrFileNotExist = fmt.Errorf("%wfile does not exist", ErrError) ErrEncodeFailed = fmt.Errorf("%wencoding failed", ErrError) ErrDecodeFailed = fmt.Errorf("%wdecoding failed", ErrError) )
Functions ¶
This section is empty.
Types ¶
type BaseFileConfig ¶
type BaseFileConfig struct { Dict // secure data encoding and decoding callback Encode func([]byte) ([]byte, error) Decode func([]byte) ([]byte, error) // contains filtered or unexported fields }
base configuration file handler
func NewBaseFileConfig ¶
func NewBaseFileConfig(filePath string, defaults Dict) *BaseFileConfig
func (*BaseFileConfig) Buffer ¶
func (fc *BaseFileConfig) Buffer() Dict
return handler to internal Dict object
func (*BaseFileConfig) Dump ¶
func (fc *BaseFileConfig) Dump() ([]byte, error)
return the contents of the config file
func (*BaseFileConfig) GetSecure ¶
func (fc *BaseFileConfig) GetSecure(key string, defval any) (any, error)
get secure value from config by key
func (*BaseFileConfig) Purge ¶
func (fc *BaseFileConfig) Purge() error
type BlobConfig ¶
type BlobConfig struct {
*BaseFileConfig
}
binary configuration file handler
func NewBlobConfig ¶
func NewBlobConfig(filePath string, defaults Dict) *BlobConfig
func (*BlobConfig) Load ¶
func (bc *BlobConfig) Load() error
load config buffer from file and merge with defaults
func (*BlobConfig) String ¶
func (bc *BlobConfig) String() string
type Dict ¶
Dict type with nested keys support
type FileConfig ¶
type JsonConfig ¶
type JsonConfig struct {
*BaseFileConfig
}
JSON configuration file handler
func NewJsonConfig ¶
func NewJsonConfig(filePath string, defaults Dict) *JsonConfig
func (*JsonConfig) Load ¶
func (jc *JsonConfig) Load() error
load config buffer from file and merge with defaults
func (*JsonConfig) String ¶
func (jc *JsonConfig) String() string
Click to show internal directories.
Click to hide internal directories.