avyos.dev/pkg/ini

package ini

Package Overview

No package-level documentation is provided.

Export GroupCount
Constants0
Variables0
Functions0
Types4

Types

Config

type Config struct {
	Entries  []*Entry
	Sections map[string]*Section
}

Functions

func NewConfig() *Config
func Parse(r io.Reader) (*Config, error)
func ParseFile(filepath string) (*Config, error)

Methods

func (c *Config) Delete(section, key string) bool
func (c *Config) ForEachKey(section string, fn func(key, value string))
func (c *Config) Get(section, key string) (string, bool)
func (c *Config) Move(section, key string, newIndex int) bool
func (c *Config) Set(section, key, value string)
func (c *Config) Write(w io.Writer) error

Entry

type Entry struct {
	Type      EntryType
	Section   string
	Key       string
	Value     string
	Raw       string
	Multiline bool
	Lines     []string
}

EntryType

type EntryType uint8

Constants

const (
	EntryBlank EntryType = iota
	EntryComment
	EntrySection
	EntryKeyValue
)

Section

type Section struct {
	Name    string
	Entries []*Entry
}