pluck: github.com/schollz/pluck/pluck Index | Files | Directories

package pluck

import "github.com/schollz/pluck/pluck"

Index

Package Files

plucker.go

type Config Uses

type Config struct {
    Activators  []string // must be found in order, before capturing commences
    Permanent   int      // number of activators that stay permanently (counted from left to right)
    Deactivator string   // restarts capturing
    Finisher    string   // finishes capturing this pluck
    Limit       int      // specifies the number of times capturing can occur
    Name        string   // the key in the returned map, after completion
    Sanitize    bool
    Maximum     int // maximum number of characters for a capture
}

Config specifies parameters for plucking

type Plucker Uses

type Plucker struct {
    // contains filtered or unexported fields
}

Plucker stores the result and the types of things to pluck

func New Uses

func New() (*Plucker, error)

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) Add Uses

func (p *Plucker) Add(c Config)

Add adds a unit to pluck with specified parameters

func (*Plucker) Configuration Uses

func (p *Plucker) Configuration() (c []Config)

Configuration returns an array of the current Config for each plucker.

func (*Plucker) Load Uses

func (p *Plucker) Load(f string) (err error)

Load will load a YAML configuration file of untis to pluck with specified parameters

func (*Plucker) LoadFromString Uses

func (p *Plucker) LoadFromString(tomlString string) (err error)

LoadFromString will load a YAML configuration file of untis to pluck with specified parameters

func (*Plucker) Pluck Uses

func (p *Plucker) Pluck(r *bufio.Reader) (err error)

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 Uses

func (p *Plucker) PluckFile(f string, stream ...bool) (err error)

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 Uses

func (p *Plucker) PluckStream(r *bufio.Reader) (err error)

PluckStream takes a buffered reader stream and streams one byte at a time and processes all pluckers serially and simultaneously.

func (*Plucker) PluckString Uses

func (p *Plucker) PluckString(s string, stream ...bool) (err error)

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 Uses

func (p *Plucker) PluckURL(url string, stream ...bool) (err error)

PluckURL takes a URL as input and uses the specified parameters and generates a map (p.result) with the finished results

func (*Plucker) Result Uses

func (p *Plucker) Result() map[string]interface{}

Result returns the raw result

func (*Plucker) ResultJSON Uses

func (p *Plucker) ResultJSON(indent ...bool) string

ResultJSON returns the result, formatted as JSON. If their are no results, it returns an empty string.

func (*Plucker) Verbose Uses

func (p *Plucker) Verbose(makeVerbose bool)

Verbose toggles debug mode

Directories

PathSynopsis
striphtml

Package pluck imports 15 packages (graph) and is imported by 3 packages. Updated 2018-06-17. Refresh now. Tools for package owners.