Documentation
¶
Index ¶
- Constants
- type ConfiguredParsers
- type Parser
- func (p *Parser) Delete(sectionType Section, sectionName string, attribute string, index ...int) error
- func (p *Parser) Get(sectionType Section, sectionName string, attribute string, ...) (common.ParserData, error)
- func (p *Parser) GetOne(sectionType Section, sectionName string, attribute string, index ...int) (common.ParserData, error)
- func (p *Parser) HasParser(sectionType Section, attribute string) bool
- func (p *Parser) Insert(sectionType Section, sectionName string, attribute string, ...) error
- func (p *Parser) LoadData(filename string) error
- func (p *Parser) ParseData(dat string) error
- func (p *Parser) ProcessLine(line string, parts, previousParts []string, comment string, ...) ConfiguredParsers
- func (p *Parser) Save(filename string) error
- func (p *Parser) SectionsCreate(sectionType Section, sectionName string) error
- func (p *Parser) SectionsDelete(sectionType Section, sectionName string) error
- func (p *Parser) SectionsGet(sectionType Section) ([]string, error)
- func (p *Parser) Set(sectionType Section, sectionName string, attribute string, ...) error
- func (p *Parser) String() string
- type ParserInterface
- type Parsers
- func (p *Parsers) Delete(attribute string, index ...int) error
- func (p *Parsers) Get(attribute string, createIfNotExist ...bool) (common.ParserData, error)
- func (p *Parsers) GetOne(attribute string, index ...int) (common.ParserData, error)
- func (p *Parsers) HasParser(attribute string) bool
- func (p *Parsers) Insert(attribute string, data common.ParserData, index ...int) error
- func (p *Parsers) Set(attribute string, data common.ParserData, index ...int) error
- type Section
Constants ¶
View Source
const ( CommentsSectionName = "data" GlobalSectionName = "data" DefaultSectionName = "data" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfiguredParsers ¶
type ConfiguredParsers struct {
State string
Active Parsers
Comments *Parsers
Defaults *Parsers
Global *Parsers
Frontend *Parsers
Backend *Parsers
Listen *Parsers
Resolver *Parsers
Userlist *Parsers
Peers *Parsers
Mailers *Parsers
Cache *Parsers
Program *Parsers
// contains filtered or unexported fields
}
type Parser ¶
type Parser struct {
Parsers map[Section]map[string]*Parsers
// contains filtered or unexported fields
}
Parser reads and writes configuration on given file
func (*Parser) Delete ¶
func (p *Parser) Delete(sectionType Section, sectionName string, attribute string, index ...int) error
Delete remove attribute on defined index, in case of single attributes, index is ignored
func (*Parser) Get ¶
func (p *Parser) Get(sectionType Section, sectionName string, attribute string, createIfNotExist ...bool) (common.ParserData, error)
Get get attribute from defaults section
func (*Parser) GetOne ¶
func (p *Parser) GetOne(sectionType Section, sectionName string, attribute string, index ...int) (common.ParserData, error)
GetOne get attribute from defaults section
func (*Parser) Insert ¶
func (p *Parser) Insert(sectionType Section, sectionName string, attribute string, data common.ParserData, index ...int) error
Insert put attribute on defined index, in case of single attributes, index is ignored
func (*Parser) ProcessLine ¶
func (p *Parser) ProcessLine(line string, parts, previousParts []string, comment string, config ConfiguredParsers) ConfiguredParsers
ProcessLine parses line plus determines if we need to change state
func (*Parser) SectionsCreate ¶
SectionsCreate creates one section of sectionType
func (*Parser) SectionsDelete ¶
SectionsDelete deletes one section of sectionType
func (*Parser) SectionsGet ¶
SectionsGet lists all sections of certain type
type ParserInterface ¶ added in v1.1.0
type ParserInterface interface {
Init()
Parse(line string, parts, previousParts []string, comment string) (changeState string, err error)
GetParserName() string
Get(createIfNotExist bool) (common.ParserData, error)
GetOne(index int) (common.ParserData, error)
Delete(index int) error
Insert(data common.ParserData, index int) error
Set(data common.ParserData, index int) error
Result() ([]common.ReturnResultLine, error)
}
type Parsers ¶ added in v1.1.0
type Parsers struct {
// contains filtered or unexported fields
}
type Section ¶
type Section string
const ( Comments Section = "#" Defaults Section = "defaults" Global Section = "global" Resolvers Section = "resolvers" UserList Section = "userlist" Peers Section = "peers" Mailers Section = "mailers" Frontends Section = "frontend" Backends Section = "backend" Listen Section = "listen" Cache Section = "cache" Program Section = "program" )
Directories
¶
| Path | Synopsis |
|---|---|
|
Code generated by go generate; DO NOT EDIT.
|
Code generated by go generate; DO NOT EDIT. |
|
extra
Code generated by go generate; DO NOT EDIT.
|
Code generated by go generate; DO NOT EDIT. |
|
filters
Code generated by go generate; DO NOT EDIT.
|
Code generated by go generate; DO NOT EDIT. |
|
http
Code generated by go generate; DO NOT EDIT.
|
Code generated by go generate; DO NOT EDIT. |
|
simple
Code generated by go generate; DO NOT EDIT.
|
Code generated by go generate; DO NOT EDIT. |
|
tcp
Code generated by go generate; DO NOT EDIT.
|
Code generated by go generate; DO NOT EDIT. |
Click to show internal directories.
Click to hide internal directories.
