Documentation
¶
Index ¶
- type Buffer
- type JsonConfig
- func (cfg JsonConfig) EnableBackup(bakpath string)
- func (cfg JsonConfig) GetSecure(key string, defval any) (any, error)
- func (cfg JsonConfig) InitAES128(secret string) error
- func (cfg JsonConfig) InitAES256(secret string) error
- func (cfg JsonConfig) IsBackupExist() bool
- func (cfg JsonConfig) IsExist() bool
- func (cfg JsonConfig) Load() error
- func (cfg JsonConfig) Purge() error
- func (cfg JsonConfig) Reset()
- func (cfg JsonConfig) Save() error
- func (cfg JsonConfig) SetSecure(key string, val any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JsonConfig ¶
type JsonConfig struct {
// contains filtered or unexported fields
}
json file config
func NewJsonConfig ¶
func NewJsonConfig(filepath string, defaults map[string]any) *JsonConfig
create new json config file handler
func (JsonConfig) EnableBackup ¶ added in v0.3.1
func (cfg JsonConfig) EnableBackup(bakpath string)
enable config file backup support
func (JsonConfig) InitAES128 ¶ added in v0.3.2
func (JsonConfig) InitAES256 ¶ added in v0.3.2
func (JsonConfig) IsBackupExist ¶ added in v0.3.1
func (cfg JsonConfig) IsBackupExist() bool
check backup config file exist on disk, if backup support enabled.
func (JsonConfig) IsExist ¶ added in v0.3.1
func (cfg JsonConfig) IsExist() bool
check config file exist on disk
func (JsonConfig) Load ¶
func (cfg JsonConfig) Load() error
read raw bytes content of config file, if error: then check and read the backup file if backup support enabled.
func (JsonConfig) Purge ¶ added in v0.3.1
func (cfg JsonConfig) Purge() error
delete config and backup files from disk and reset local buffer
Click to show internal directories.
Click to hide internal directories.