# README
INI
Package ini provides INI file read and write functionality in Go.
Features
- Load from multiple data sources(file,
[]byte
,io.Reader
andio.ReadCloser
) with overwrites. - Read with recursion values.
- Read with parent-child sections.
- Read with auto-increment key names.
- Read with multiple-line values.
- Read with tons of helper methods.
- Read and convert values to Go types.
- Read and WRITE comments of sections and keys.
- Manipulate sections, keys and comments with ease.
- Keep sections and keys in order as you parse and save.
Installation
The minimum requirement of Go is 1.13.
$ go get gopkg.in/ini.v1
Please add -u
flag to update in the future.
Getting Help
License
This project is under Apache v2 License. See the LICENSE file for the full license text.
# Functions
Empty returns an empty file object.
InsensitiveLoad has exactly same functionality as Load function except it forces all section and key names to be lowercased.
IsErrDelimiterNotFound returns true if the given error is an instance of ErrDelimiterNotFound.
IsErrEmptyKeyName returns true if the given error is an instance of ErrEmptyKeyName.
Load loads and parses from INI data sources.
LoadSources allows caller to apply customized options for loading from data source(s).
LooseLoad has exactly same functionality as Load function except it ignores nonexistent files instead of returning error.
MapTo maps data sources to given struct.
MapToWithMapper maps data sources to given struct with name mapper.
ReflectFrom reflects data sources from given struct.
ReflectFromWithMapper reflects data sources from given struct with name mapper.
ShadowLoad has exactly same functionality as Load function except it allows have shadow keys.
StrictMapTo maps data sources to given struct in strict mode, which returns all possible error including value parsing error.
StrictMapToWithMapper maps data sources to given struct with name mapper in strict mode, which returns all possible error including value parsing error.
# Variables
Deprecated: AllCapsUnderscore converts to format ALL_CAPS_UNDERSCORE.
Deprecated: Use "DefaultSection" instead.
DefaultFormatLeft places custom spaces on the left when PrettyFormat and PrettyEqual are both disabled.
DefaultFormatRight places custom spaces on the right when PrettyFormat and PrettyEqual are both disabled.
DefaultHeader explicitly writes default section header.
DefaultSection is the name of default section.
LineBreak is the delimiter to determine or compose a new line.
PrettyEqual places spaces around "=" sign even when PrettyFormat is false.
PrettyFormat indicates whether to align "=" sign with spaces to produce pretty output or reduce all possible spaces for compact format.
PrettySection indicates whether to put a line between sections.
SnackCase converts to format SNACK_CASE.
TitleUnderscore converts to format title_underscore.
# Structs
ErrDelimiterNotFound indicates the error type of no delimiter is found which there should be one.
ErrEmptyKeyName indicates the error type of no key name is found which there should be one.
File represents a combination of one or more INI files in memory.
Key represents a key under a section.
LoadOptions contains all customized options used for load data source(s).
Section represents a config section.
# Interfaces
StructReflector is the interface implemented by struct types that can extract themselves into INI objects.
# Type aliases
DebugFunc is the type of function called to log parse events.
NameMapper represents a ini tag name mapper.
ValueMapper represents a mapping function for values, e.g.