Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileHandler ¶
type FileHandler struct {
// contains filtered or unexported fields
}
FileHandler implements ConfigHandler using local files. It supports JSON, YAML, and TOML formats.
func New ¶
func New(opts ...Option) (*FileHandler, error)
New creates a new FileHandler with the given options.
func (*FileHandler) Load ¶
func (h *FileHandler) Load(data any) error
Load reads the config file into data.
func (*FileHandler) Save ¶
func (h *FileHandler) Save(data any) error
Save writes data to the config file.
type FileIO ¶
type FileIO interface {
Write(data any, file string) error
Read(data any, file string) error
GetExtension() string
}
FileIO is the interface for reading and writing config data to files.
func BuildFileIO ¶
BuildFileIO returns a FileIO implementation for the resolved file type.
type Json ¶
type Json struct {
// contains filtered or unexported fields
}
func (*Json) GetExtension ¶
type Option ¶
type Option func(f *Optional)
Option is a functional option for configuring a FileHandler.
type Toml ¶
type Toml struct {
// contains filtered or unexported fields
}
func (*Toml) GetExtension ¶
Click to show internal directories.
Click to hide internal directories.