Documentation
¶
Index ¶
- func GetExtraValues(conf *Section) [][2]any
- type Config
- func CloneConfig(src *Config) (*Config, error)
- func CloneConfigWithOptions(src *Config, opts Options) (*Config, error)
- func Load(path string) (*Config, error)
- func LoadFromMap(data map[string]any) (*Config, error)
- func LoadFromMapWithOptions(data map[string]any, opts Options) (*Config, error)
- func LoadLines(lines []string) (*Config, error)
- func LoadLinesWithOptions(lines []string, opts Options) (*Config, error)
- func LoadReader(r io.Reader) (*Config, error)
- func LoadReaderWithOptions(r io.Reader, opts Options) (*Config, error)
- func LoadWithOptions(path string, opts Options) (*Config, error)
- func (c *Config) HasSection(name string) bool
- func (c *Config) Reload() error
- func (c *Config) Reset()
- func (c *Config) Save(path string) error
- func (c *Config) Section(name string) *Section
- func (c *Config) Sections() []string
- func (c *Config) SetConfigspec(spec *Config)
- func (c *Config) Validate(v Validator, opts ...ValidateOptions) (any, error)
- func (c *Config) Write() ([]string, error)
- func (c *Config) WriteTo(w io.Writer) (int64, error)
- type ConfigErrorDetail
- type FlatError
- type InterpolationError
- type InterpolationLoopError
- type MissingInterpolationOption
- type Options
- type ParseErrorsError
- type ReloadError
- type Section
- func (s *Section) AsBool(key string) (bool, error)
- func (s *Section) AsFloat(key string) (float64, error)
- func (s *Section) AsInt(key string) (int, error)
- func (s *Section) AsList(key string) []string
- func (s *Section) Created() bool
- func (s *Section) DefaultValuesMap() map[string]any
- func (s *Section) DefaultsList() []string
- func (s *Section) Delete(key string) bool
- func (s *Section) Dict() map[string]any
- func (s *Section) ExtraValuesList() []string
- func (s *Section) Get(key string) (string, bool)
- func (s *Section) GetAny(key string) (any, bool)
- func (s *Section) GetRaw(key string) (string, bool)
- func (s *Section) GetValue(key string) (any, bool)
- func (s *Section) HasKey(key string) bool
- func (s *Section) Keys() []string
- func (s *Section) Merge(indict map[string]any)
- func (s *Section) Rename(oldkey, newkey string) error
- func (s *Section) RestoreDefault(key string) (any, error)
- func (s *Section) RestoreDefaults()
- func (s *Section) ScalarsList() []string
- func (s *Section) Sections() []string
- func (s *Section) Set(key, value string)
- func (s *Section) SetAny(key string, value any) error
- func (s *Section) Subsection(name string) *Section
- func (s *Section) Walk(fn func(*Section, string) (any, error), callOnSections, raiseErrors bool) (map[string]any, error)
- type SimpleVal
- type ValidateOptions
- type Validator
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetExtraValues ¶
GetExtraValues mirrors configobj.get_extra_values after validation.
Types ¶
type Config ¶
type Config struct {
BOM bool
// contains filtered or unexported fields
}
func CloneConfig ¶
func CloneConfigWithOptions ¶
func LoadFromMapWithOptions ¶
func LoadLinesWithOptions ¶
func (*Config) HasSection ¶
func (*Config) SetConfigspec ¶
func (*Config) Validate ¶
func (c *Config) Validate(v Validator, opts ...ValidateOptions) (any, error)
Validate checks configspec presence, using a minimal Validator interface. It returns: - true if everything passes - false if everything fails (only possible when missing-only failures) - map[string]any mirroring ConfigObj's nested result dict
type ConfigErrorDetail ¶
func (ConfigErrorDetail) Error ¶
func (d ConfigErrorDetail) Error() string
type FlatError ¶
FlattenErrors mirrors configobj.flatten_errors for results of Validate(). Each item is: (sectionsPath, keyOrNil, result).
func FlattenErrors ¶
type InterpolationError ¶
type InterpolationError struct {
// contains filtered or unexported fields
}
func (*InterpolationError) Error ¶
func (e *InterpolationError) Error() string
type InterpolationLoopError ¶
type InterpolationLoopError struct {
InterpolationError
// contains filtered or unexported fields
}
type MissingInterpolationOption ¶
type MissingInterpolationOption struct {
InterpolationError
// contains filtered or unexported fields
}
type ParseErrorsError ¶
type ParseErrorsError struct {
Errors []ConfigErrorDetail
}
func (*ParseErrorsError) Error ¶
func (e *ParseErrorsError) Error() string
type ReloadError ¶
type ReloadError struct{}
func (ReloadError) Error ¶
func (ReloadError) Error() string
type Section ¶
type Section struct {
// contains filtered or unexported fields
}
func (*Section) DefaultValuesMap ¶
func (*Section) DefaultsList ¶
func (*Section) ExtraValuesList ¶
func (*Section) GetValue ¶
GetValue mirrors Python's __getitem__, returning strings/lists with interpolation.
func (*Section) RestoreDefaults ¶
func (s *Section) RestoreDefaults()
func (*Section) ScalarsList ¶
func (*Section) SetAny ¶
SetAny mirrors Python's __setitem__: accepts scalars, lists, maps, and respects stringify rules.
func (*Section) Subsection ¶
type SimpleVal ¶
type SimpleVal struct{}
SimpleVal mirrors configobj.SimpleVal: presence-only validator.