seeker

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2022 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commander

type Commander struct {
	Command string `json:"command"`
	// contains filtered or unexported fields
}

Commander runs shell commands.

func (Commander) Run

func (c Commander) Run() (result interface{}, err error)

type Copier

type Copier struct {
	SourceDir string    `json:"source_directory"`
	Filter    string    `json:"filter"`
	DestDir   string    `json:"destination_directory"`
	From      time.Time `json:"from"`
	To        time.Time `json:"to"`
}

Copier copies files to temp dir based on a filter.

func (Copier) Run

func (c Copier) Run() (result interface{}, err error)

Run satisfies the Runner interface and copies the filtered source files to the destination.

type HTTPer

type HTTPer struct {
	Path   string            `json:"path"`
	Client *client.APIClient `json:"client"`
}

HTTPer hits APIs.

func (HTTPer) Run

func (h HTTPer) Run() (interface{}, error)

type Runner

type Runner interface {
	Run() (interface{}, error)
}

Runner runs things to get information.

type Seeker

type Seeker struct {
	Runner     Runner      `json:"runner"`
	Identifier string      `json:"-"`
	Result     interface{} `json:"result"`
	ErrString  string      `json:"error"` // this simplifies json marshaling
	Error      error       `json:"-"`
}

Seeker seeks information via its Runner then stores the results.

func Exclude

func Exclude(excludes []string, seekers []*Seeker) ([]*Seeker, error)

Exclude takes a slice of matcher strings and a slice of seekers. If any of the seeker identifiers match the exclude according to filepath.Match() then it will not be present in the returned seeker slice. NOTE(mkcp): This is precisely identical to Select() except we flip the match check. Maybe we can perform both rounds

of filtering in one pass one rather than iterating over all the seekers several times. Not likely to be a huge speed
increase though... we're not even remotely bottlenecked on seeker filtering.

func NewCommander

func NewCommander(command string, format string) *Seeker

NewCommander provides a Seeker for running shell commands.

func NewCopier

func NewCopier(path, destDir string, from, to time.Time) *Seeker

NewCopier provides a Seeker for copying files to temp dir based on a filter.

func NewHTTPer

func NewHTTPer(client *client.APIClient, path string) *Seeker

func NewSheller

func NewSheller(command string) *Seeker

NewSheller provides a Seeker for running shell commands.

func Select

func Select(selects []string, seekers []*Seeker) ([]*Seeker, error)

Select takes a slice of matcher strings and a slice of seekers. The only seekers returned will be those matching the given select strings according to filepath.Match()

func (*Seeker) Run

func (s *Seeker) Run() (result interface{}, err error)

type Sheller

type Sheller struct {
	Command string `json:"command"`
	Shell   string `json:"shell"`
}

Sheller runs shell commands in a real unix shell.

func (*Sheller) Run

func (s *Sheller) Run() (result interface{}, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL