Versions in this module Expand all Collapse all v0 v0.2.0 Jan 29, 2020 Changes in this version + func Downcase(values []string) (result []string) + func FilterByWildcard(patterns interface{}, list interface{}, ignore_case bool) (result []string) + func FormatParameter(section string, id string, parameter string) string + func FormatSection(section string, id string) string + func Match(pattern string, text string) *[]string + func MatchWildcard(patterns interface{}, list interface{}, ignore_case bool) bool + func NormalizeLine(ctx *ParseContext, text string) (string, bool) + func ReplaceVariables(ctx *ParseContext, text string, definitions map[string]string) (newtext string, unreplaced []string) + func SplitColon(ctx *ParseContext, text string) (string, string) + func SplitDefine(ctx *ParseContext, text string) (name string, value string, isDefine bool) + func SplitEqual(ctx *ParseContext, text string) (string, string) + func SplitSection(ctx *ParseContext, text string) (name string, id string, isSection bool) + func SplitSpace(ctx *ParseContext, text string) (string, string) + func SplitSpaceOrEqual(ctx *ParseContext, text string) (string, string) + func SplitTag(tag string) (section string, sid string, param string) + func SplitUndefine(ctx *ParseContext, text string) (name string, isUndefine bool) + func Tokenize(text string) (tokens []string) + func Unique(list []string) (result []string) + func Upcase(values []string) (result []string) + type Config struct + BadNames *regexp.Regexp + Custom map[string]interface{} + DefineSplitter DefineSplitterFunc + File string + GoodNames *regexp.Regexp + Hash string + Inherit interface{} + KeyValSplitter KeyValSplitterFunc + Normalizer NormalizerFunc + PreferFirstValue bool + RawSections map[string]interface{} + Replacer ReplacerFunc + Schema *Config + SectionList []Section + SectionSplitter SectionSplitterFunc + UndefineSplitter UndefineSplitterFunc + ValidationErrors []string + Warnings []string + func Load(file string) (c *Config, err error) + func New() *Config + func Parse(text string, file string) (c *Config) + func (c *Config) AbsolutePath(f string) string + func (c *Config) All(tag string) *Values + func (c *Config) CanInherit(tag string) bool + func (c *Config) Dump(with_source bool) + func (c *Config) ErrMissing(section string) error + func (c *Config) Error(v interface{}, args ...interface{}) error + func (c *Config) First(tag string) (v *Value) + func (c *Config) FirstOrDefault(tag string, defval *Value) (v *Value) + func (c *Config) Get(tag string) *Values + func (c *Config) IsSet(tag string) bool + func (c *Config) Last(tag string) (v *Value) + func (c *Config) LastOrDefault(tag string, defval *Value) (v *Value) + func (c *Config) Load(file string) (err error) + func (c *Config) One(tag string) *Value + func (c *Config) OneOrDefault(tag string, defval *Value) *Value + func (c *Config) Parameter(section string, id string, parameter string) *Parameter + func (c *Config) Parse(text string, file string) + func (c *Config) Section(section string, id string) *Section + func (c *Config) SectionIds(section string) (result []string) + func (c *Config) SectionNames() (result []string) + func (c *Config) Sections() *[]Section + func (c *Config) SetSchema(config *Config) error + func (c *Config) String(tag string) string + func (c *Config) Strings(tag string) (result []string) + func (c *Config) Tokens(tag string, downcase bool) (tokens []string) + func (c *Config) UniqueTokens(tag string, downcase bool) (tokens []string) + func (c *Config) Validate() error + type DefineSplitterFunc func(*ParseContext, string) (string, string, bool) + type KeyValSplitterFunc func(*ParseContext, string) (string, string) + type NormalizerFunc func(*ParseContext, string) (string, bool) + type Parameter struct + Name string + Section *Section + Source Source + ValueList Values + func (p *Parameter) Dump(with_source bool) + func (p *Parameter) Tag() string + func (p Parameter) FindValues() *Values + func (p Parameter) First() (v *Value) + func (p Parameter) FirstOrDefault(defval *Value) (v *Value) + func (p Parameter) Float32() (float32, bool) + func (p Parameter) Float32OrDefault(defval float32) float32 + func (p Parameter) Float64() (float64, bool) + func (p Parameter) Float64OrDefault(defval float64) float64 + func (p Parameter) Floats32() []float32 + func (p Parameter) Floats64() []float64 + func (p Parameter) IP() net.IP + func (p Parameter) IP4() net.IP + func (p Parameter) IP4s() (result []net.IP) + func (p Parameter) IP6() net.IP + func (p Parameter) IP6s() (result []net.IP) + func (p Parameter) IPs() (result []net.IP) + func (p Parameter) Int() (int, bool) + func (p Parameter) Int32() (int32, bool) + func (p Parameter) Int32OrDefault(defval int32) int32 + func (p Parameter) Int64() (int64, bool) + func (p Parameter) Int64OrDefault(defval int64) int64 + func (p Parameter) IntOrDefault(defval int) int + func (p Parameter) Interpreted() []string + func (p Parameter) Ints() []int + func (p Parameter) Ints32() []int32 + func (p Parameter) Ints64() []int64 + func (p Parameter) IsOff() bool + func (p Parameter) IsOn() bool + func (p Parameter) Last() (v *Value) + func (p Parameter) LastOrDefault(defval *Value) (v *Value) + func (p Parameter) NonEmptyStringOrDefault(defval string) string + func (p Parameter) Raw() []string + func (p Parameter) String() string + func (p Parameter) StringOrDefault(defval string) string + func (p Parameter) Strings() []string + func (p Parameter) Tokens(downcase bool) (tokens []string) + func (p Parameter) Unique(ignorecase bool) (result Values) + func (p Parameter) UniqueTokens(downcase bool) (tokens []string) + func (p Parameter) Values() *Values + type ParseContext struct + Config *Config + LineNumber int + TextFile *textfile.File + type ReplacerFunc func(*ParseContext, string, map[string]string) (string, []string) + type Section struct + Config *Config + ID string + Lines []string + Name string + ParameterList []Parameter + ParameterSeq []*Parameter + Source Source + func (s *Section) Dump(with_source bool) + func (s *Section) ErrID(p string) error + func (s *Section) ErrMissing(p string) error + func (s *Section) Error(v interface{}, args ...interface{}) error + func (s *Section) FindParameter(parameter string) *Parameter + func (s *Section) IsInherited(parameter string) bool + func (s *Section) IsSet(parameter string) bool + func (s *Section) Need(parameters ...string) error + func (s *Section) Parameter(parameter string) *Parameter + func (s *Section) ParameterNames() (result []string) + func (s *Section) Parameters() *[]Parameter + func (s *Section) Tag() string + func (s Section) First(parameter string) (v *Value) + func (s Section) FirstOrDefault(parameter string, defval *Value) (v *Value) + func (s Section) Float32(parameter string) (float32, bool) + func (s Section) Float32OrDefault(parameter string, defval float32) float32 + func (s Section) Float64(parameter string) (float64, bool) + func (s Section) Float64OrDefault(parameter string, defval float64) float64 + func (s Section) Floats32(parameter string) (result []float32) + func (s Section) Floats64(parameter string) (result []float64) + func (s Section) IP(parameter string) net.IP + func (s Section) IP4(parameter string) net.IP + func (s Section) IP4s(parameter string) (result []net.IP) + func (s Section) IP6(parameter string) net.IP + func (s Section) IP6s(parameter string) (result []net.IP) + func (s Section) IPs(parameter string) (result []net.IP) + func (s Section) Int(parameter string) (int, bool) + func (s Section) Int32(parameter string) (int32, bool) + func (s Section) Int32OrDefault(parameter string, defval int32) int32 + func (s Section) Int64(parameter string) (int64, bool) + func (s Section) Int64OrDefault(parameter string, defval int64) int64 + func (s Section) IntOrDefault(parameter string, defval int) int + func (s Section) Interpreted(parameter string) []string + func (s Section) Ints(parameter string) (result []int) + func (s Section) Ints32(parameter string) (result []int32) + func (s Section) Ints64(parameter string) (result []int64) + func (s Section) IsOff(parameter string) bool + func (s Section) IsOn(parameter string) bool + func (s Section) Last(parameter string) (v *Value) + func (s Section) LastOrDefault(parameter string, defval *Value) (v *Value) + func (s Section) NeedString(parameter string) (string, error) + func (s Section) NeedValue(parameter string) (*Value, error) + func (s Section) NeedValues(parameter string) (*Values, error) + func (s Section) NonEmptyStringOrDefault(parameter string, defval string) string + func (s Section) Raw(parameter string) []string + func (s Section) String(parameter string) string + func (s Section) StringOrDefault(parameter string, defval string) string + func (s Section) Strings(parameter string) (result []string) + func (s Section) Tokens(parameter string, downcase bool) (tokens []string) + func (s Section) Unique(parameter string, ignorecase bool) (result Values) + func (s Section) UniqueTokens(parameter string, downcase bool) (tokens []string) + func (s Section) Value(parameter string) (v *Value) + func (s Section) Values(parameter string) (result *Values) + type SectionSplitterFunc func(*ParseContext, string) (string, string, bool) + type Source interface + Text func() string + type Tags map[string][]string + func ParseTags(words []string) Tags + func (t Tags) AnyOf(keys ...string) bool + func (t Tags) First(k string) string + func (t Tags) Has(k string) bool + func (t Tags) HasOneValue(k string) bool + func (t Tags) HasValue(k string) bool + func (t Tags) Last(k string) string + func (t Tags) One(k string) string + type UndefineSplitterFunc func(*ParseContext, string) (string, bool) + type Value struct + Data string + Parameter *Parameter + Source textfile.LineSource + func (v *Value) Any() bool + func (v *Value) Empty() bool + func (v *Value) StringWithTags() (string, Tags, error) + func (v *Value) Tags() (Tags, error) + func (v Value) AbsolutePath(p string) (result string, err error) + func (v Value) ErrEmpty() error + func (v Value) ErrInvalid() error + func (v Value) Error(i interface{}, args ...interface{}) error + func (v Value) Float() (float64, bool) + func (v Value) Float32() (float32, bool) + func (v Value) Float64() (float64, bool) + func (v Value) IP() net.IP + func (v Value) IP4() net.IP + func (v Value) IP6() net.IP + func (v Value) Int() (int, bool) + func (v Value) Int32() (int32, bool) + func (v Value) Int64() (int64, bool) + func (v Value) Interpreted() string + func (v Value) IsOff() bool + func (v Value) IsOn() bool + func (v Value) Path() string + func (v Value) PathFor(relpath string) string + func (v Value) Raw() string + func (v Value) RelativePath(p string) string + func (v Value) String() string + func (v Value) StringOrDefault(def string) string + func (v Value) Tokens(downcase bool) (tokens []string) + func (v Value) UniqueTokens(downcase bool) (tokens []string) + type Values []Value + func (vals Values) First() (v *Value) + func (vals Values) FirstOrDefault(defval *Value) (v *Value) + func (vals Values) Float32() (float32, bool) + func (vals Values) Float32OrDefault(defval float32) (result float32) + func (vals Values) Float64() (float64, bool) + func (vals Values) Float64OrDefault(defval float64) (result float64) + func (vals Values) Floats32() (result []float32) + func (vals Values) Floats64() (result []float64) + func (vals Values) IP() net.IP + func (vals Values) IP4() net.IP + func (vals Values) IP4OrDefault(defval net.IP) (result net.IP) + func (vals Values) IP4s() (result []net.IP) + func (vals Values) IP6() net.IP + func (vals Values) IP6OrDefault(defval net.IP) (result net.IP) + func (vals Values) IP6s() (result []net.IP) + func (vals Values) IPOrDefault(defval net.IP) (result net.IP) + func (vals Values) IPs() (result []net.IP) + func (vals Values) Int() (int, bool) + func (vals Values) Int32() (int32, bool) + func (vals Values) Int32OrDefault(defval int32) (result int32) + func (vals Values) Int64() (int64, bool) + func (vals Values) Int64OrDefault(defval int64) (result int64) + func (vals Values) IntOrDefault(defval int) (result int) + func (vals Values) Interpreted() (result []string) + func (vals Values) Ints() (result []int) + func (vals Values) Ints32() (result []int32) + func (vals Values) Ints64() (result []int64) + func (vals Values) IsOff() bool + func (vals Values) IsOn() bool + func (vals Values) Last() (v *Value) + func (vals Values) LastOrDefault(defval *Value) (v *Value) + func (vals Values) NonEmptyStringOrDefault(defval string) (result string) + func (vals Values) Raw() (result []string) + func (vals Values) String() string + func (vals Values) StringOrDefault(defval string) string + func (vals Values) Strings() (result []string) + func (vals Values) Tokens(downcase bool) (tokens []string) + func (vals Values) Unique(ignorecase bool) (result Values) + func (vals Values) UniqueTokens(downcase bool) (tokens []string)