Documentation ¶
Index ¶
- type Config
- type Plucker
- func (p *Plucker) Add(c Config)
- func (p *Plucker) Configuration() (c []Config)
- func (p *Plucker) Load(files ...string) (err error)
- func (p *Plucker) Pluck(r *bufio.Reader) (err error)
- func (p *Plucker) PluckFile(f string, stream ...bool) (err error)
- func (p *Plucker) PluckStream(r *bufio.Reader) (err error)
- func (p *Plucker) PluckString(s string, stream ...bool) (err error)
- func (p *Plucker) PluckURL(url string, stream ...bool) (err error)
- func (p *Plucker) Result() map[string]interface{}
- func (p *Plucker) ResultJSON(indent ...bool) string
- func (p *Plucker) Verbose(makeVerbose bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Activators []string `json:"activators" yaml:"activators" toml:"activators"` // must be found in order, before capturing commences Permanent int `json:"permanent" yaml:"permanent" toml:"permanent"` // number of activators that stay permanently (counted from left to right) Deactivator string `json:"deactivator" yaml:"deactivator" toml:"deactivator"` // restarts capturing Finisher string `json:"finisher" yaml:"finisher" toml:"finisher"` // finishes capturing this pluck Limit int `json:"limit" yaml:"limit" toml:"limit"` // specifies the number of times capturing can occur Name string `json:"name" yaml:"name" toml:"name"` // the key in the returned map, after completion Sanitize bool `json:"sanitize" yaml:"sanitize" toml:"sanitize"` Maximum int `json:"maximum" yaml:"maximum" toml:"maximum"` // maximum number of characters for a capture }
Config specifies parameters for plucking
type Plucker ¶
type Plucker struct {
// contains filtered or unexported fields
}
Plucker stores the result and the types of things to pluck
func New ¶
New returns a new plucker which can later have items added to it or can load a config file and then can be used to parse.
func (*Plucker) Configuration ¶
Configuration returns an array of the current Config for each plucker.
func (*Plucker) Load ¶
Load will load a YAML configuration file of untis to pluck with specified parameters
func (*Plucker) Pluck ¶
Pluck takes a buffered reader stream and extracts the text from it. This spawns a thread for each plucker and copies the entire buffer to memory, so that each plucker works in parallel.
func (*Plucker) PluckFile ¶
PluckFile takes a file as input and uses the specified parameters and generates a map (p.result) with the finished results. The streaming can be enabled by setting it to true.
func (*Plucker) PluckStream ¶
PluckStream takes a buffered reader stream and streams one byte at a time and processes all pluckers serially and simultaneously.
func (*Plucker) PluckString ¶
PluckString takes a string as input and uses the specified parameters and generates a map (p.result) with the finished results. The streaming can be enabled by setting it to true.
func (*Plucker) PluckURL ¶
PluckURL takes a URL as input and uses the specified parameters and generates a map (p.result) with the finished results
func (*Plucker) ResultJSON ¶
ResultJSON returns the result, formatted as JSON. If their are no results, it returns an empty string.