avyos.dev/pkg/ini

package ini

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

NewConfig

func NewConfig() *Config

Parse

func Parse(r io.Reader) (*Config, error)

ParseFile

func ParseFile(filepath string) (*Config, error)

Methods

Delete

func (c *Config) Delete(section, key string) bool

ForEachKey

func (c *Config) ForEachKey(section string, fn func(key, value string))

Get

func (c *Config) Get(section, key string) (string, bool)

Move

func (c *Config) Move(section, key string, newIndex int) bool

Set

func (c *Config) Set(section, key, value string)

Write

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

EntryBlank, EntryComment, EntrySection, EntryKeyValue

const (
	EntryBlank EntryType = iota
	EntryComment
	EntrySection
	EntryKeyValue
)

Section

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