Documentation ¶
Overview ¶
Package ini implements parsing of the AWS shared config file.
Example: sections, err := ini.OpenFile("/path/to/file") if err != nil { panic(err) } profile := "foo" section, ok := sections.GetSection(profile) if !ok { fmt.Printf("section %q could not be found", profile) }
Index ¶
- Constants
- type Section
- func (t Section) Bool(k string) (bool, bool)
- func (t Section) Float64(k string) (float64, bool)
- func (t Section) Has(k string) bool
- func (t Section) Int(k string) (int64, bool)
- func (t Section) List() []string
- func (t Section) Map(k string) map[string]string
- func (t Section) String(k string) string
- func (t Section) UpdateSourceFile(property string, filepath string)
- func (t Section) UpdateValue(k string, v Value) error
- func (t Section) ValueType(k string) (ValueType, bool)
- type Sections
- type UnableToReadFile
- type Value
- type ValueType
Constants ¶
const ( NoneType = ValueType(iota) StringType QuotedStringType )
ValueType enums
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Section ¶
type Section struct { // Name is the Section profile name Name string // Errors is the list of errors Errors []error // Logs is the list of logs Logs []string // SourceFile is the INI Source file from where this section // was retrieved. They key is the property, value is the // source file the property was retrieved from. SourceFile map[string]string // contains filtered or unexported fields }
Section contains a name and values. This represent a sectioned entry in a configuration file.
func NewSection ¶
NewSection returns an initialize section for the name
func (Section) UpdateSourceFile ¶
UpdateSourceFile updates source file for a property to provided filepath.
func (Section) UpdateValue ¶
UpdateValue updates value for a provided key with provided value
type Sections ¶
type Sections struct {
// contains filtered or unexported fields
}
Sections is a map of Section structures that represent a configuration.
func (Sections) DeleteSection ¶
DeleteSection deletes a section entry/value for provided section name./
func (Sections) GetSection ¶
GetSection will return section p. If section p does not exist, false will be returned in the second parameter.
func (Sections) HasSection ¶
HasSection denotes if Sections consist of a section with provided name.
type UnableToReadFile ¶
type UnableToReadFile struct {
Err error
}
UnableToReadFile is an error indicating that a ini file could not be read
func (*UnableToReadFile) Error ¶
func (e *UnableToReadFile) Error() string
Error returns an error message and the underlying error message if present
func (*UnableToReadFile) Unwrap ¶
func (e *UnableToReadFile) Unwrap() error
Unwrap returns the underlying error
type Value ¶
type Value struct { Type ValueType // contains filtered or unexported fields }
Value is a union container
func NewStringValue ¶
NewStringValue returns a Value type generated using a string input.
func (Value) FloatValue ¶
FloatValue returns a float value