Documentation
¶
Index ¶
- Variables
- type Config
- func (c *Config) Delete(section, key string) error
- func (c *Config) Empty() *Config
- func (c *Config) Environ(use []string) *Config
- func (c *Config) ExecDisable() *Config
- func (c *Config) ExecEnable() *Config
- func (c *Config) Exists(section, key string) bool
- func (c *Config) File(file string) error
- func (c *Config) Get(section, key string) (string, error)
- func (c *Config) Hash() ([]byte, error)
- func (c *Config) Keys(section string) []string
- func (c *Config) Load(r io.Reader) error
- func (c *Config) Map(conversions map[string]Conversion) map[string]any
- func (c *Config) Modified() bool
- func (c *Config) Reload(r io.Reader) error
- func (c *Config) Save(files ...string) error
- func (c *Config) Section(name string) *Data
- func (c *Config) Sections() []string
- func (c *Config) Set(section, key string, value any) error
- func (c *Config) Store(w io.Writer) error
- func (c *Config) Struct(x any, section string) any
- type Conversion
- type Data
- func (d *Data) Bind(key string) *bind.Target
- func (d *Data) Binds(key string) []*bind.Target
- func (d *Data) Bool(key string) bool
- func (d *Data) Bools(key string) []bool
- func (d *Data) Bytes(key string) []byte
- func (d *Data) CIDR(key string) netip.Prefix
- func (d *Data) CIDRs(key string) []netip.Prefix
- func (d *Data) Commands(key string) []string
- func (d *Data) Comments(key string) []string
- func (d *Data) Custom(key string, value any) error
- func (d *Data) Date(key string) time.Time
- func (d *Data) Dates(key string) []time.Time
- func (d *Data) Delete(key string) error
- func (d *Data) Duration(key string) time.Duration
- func (d *Data) Durations(key string) []time.Duration
- func (d *Data) Exec() *Data
- func (d *Data) Exists(key string) bool
- func (d *Data) Float(key string) float64
- func (d *Data) Floats(key string) []float64
- func (d *Data) Get(key string) (string, error)
- func (d *Data) IP(key string) netip.Addr
- func (d *Data) IPs(key string) []netip.Addr
- func (d *Data) Int(key string) int64
- func (d *Data) Ints(key string) []int64
- func (d *Data) Keys() []string
- func (d *Data) Link(key string) *url.URL
- func (d *Data) Links(key string) []*url.URL
- func (d *Data) Run(key string) (string, []int, error)
- func (d *Data) Set(key string, value any) error
- func (d *Data) String(key string) string
- func (d *Data) Strings(key string) []string
- type Filter
- type Kind
- type Query
- type Result
Constants ¶
This section is empty.
Variables ¶
var ( DefaultValueSize int = 5000 DefaultCommentSize int = 200 DefaultNameSize int = 80 // Loading of empty files fails on default. DefaultAllowEmpty bool // Execution is disabled (false) on default. // You can overwrite this on *Data type calls by prefixing Exec(). DefaultExec bool // DefaultExecTime is the timeout for every single command execution. // You can disable command execution entirely by setting it to 0. DefaultExecTime time.Duration = time.Second * 2 //Verbosity com.Level = com.Common Verbosity com.Level = com.ErrorsOnly // Format to use for type time.Time DateFormat string = "2006-01-02T15:04:05ZMST" )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config holds the data trees, settings and file information.
func New ¶
func New() *Config
New create a pointer to an empty Config filled by global default values.
func (*Config) ExecDisable ¶
ExecDisable disables command execution.
func (*Config) ExecEnable ¶
ExecEnable enables command execution.
func (*Config) Map ¶
func (c *Config) Map(conversions map[string]Conversion) map[string]any
Map returns the content of *Config in a map converting values to the types given in the conversions map.
func (*Config) Modified ¶
Modified returns a boolean to indicate if the *Config was altered since the initial Load/New/File call.
func (*Config) Reload ¶
Reload takes data from a Reader and replaces *Config content with the new data.
func (*Config) Save ¶
Save writes the Config to the file it was loaded from or if the optional string value files was defined it's written to each of those files. If you want write to multiple files and include the file it was loaded from, you have to specify it explicitly among files.
type Conversion ¶
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
Data is a part of the Config defined by the given *Config.Section(name) call that representing a section.
func (*Data) Binds ¶
Binds returns the key's value as []*bind.Target for that given section.
Structure: One per slice, separated by spaces.
func (*Data) Bools ¶
Bools returns the key's value as []bool for that given section.
Structure: One per slice, separated by spaces.
func (*Data) CIDRs ¶
CIDRs returns the key's value as []netip.Prefix for that given section.
Structure: One per slice, separated by spaces.
func (*Data) Date ¶
Date returns the key's value as time.Time for that given section. See DateFormat.
func (*Data) Dates ¶
Dates returns the key's value as []time.Time for that given section.
Structure: See Dateformat separated by spaces.
func (*Data) Durations ¶
Durations returns the key's value as []time.Duration for that given section.
Structure: One per slice, separated by spaces.
func (*Data) Floats ¶
Floats returns the key's value as []float64 for that given section.
Structure: One per slice, separated by spaces.
func (*Data) IPs ¶
IPs returns the key's value as []netip.Addr for that given section.
Structure: One per slice, separated by spaces.
func (*Data) Ints ¶
Ints returns the key's value as []int64 for that given section.
Structure: One per slice, separated by spaces.
func (*Data) Links ¶
Links returns the key's value as *url.URL for that given section.
Structure: One Link per line