collect

package
v0.37.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: GPL-2.0, GPL-3.0 Imports: 10 Imported by: 0

README

collect - Data Aggregator

Arguments

The collect middleware aggregates the results of several pipes into a map, optionally saving them to a file.

values Argument

The values argument is an array of pipeline references, whose items are called children. The calling pipe is called the parent.

Each child will be executed and its result is stored in a map whose key is the child's identifier. The resulting map will either be saved to a file or comprises the parent's output.

private:
    collect:
        values:
            - some-pipe:
                shell:
                    run: "echo \"test1\""
            - some-other-pipe:
                shell:
                    run: "echo \"test2\""

results in the following parent output:

some-pipe: test1
some-other-pipe: test2
nested Argument

The nested argument is an optional boolean that will cause the output of the children to be included as a sub-map - as opposed to a string.

private:
    collect:
        values:
            - key:
                collect:
                    values:
                        - sub-key:
                            shell:
                                run: "echo \"test1\""

results in the following parent output:

key:
    sub-key: test1
file Argument

The file argument is an optional file path relative to the current working directory to which the parent's output will be redirected, if provided.

Documentation

Overview

Package collect provides a middleware for gathering values into a map and saving them to disk

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Middleware

type Middleware struct {
	WorkingDir string
	// contains filtered or unexported fields
}

Middleware is a directory navigator

func NewMiddleware

func NewMiddleware() Middleware

NewMiddleware creates a new Middleware instance

func (Middleware) Apply

func (collectMiddleware Middleware) Apply(
	run *pipeline.Run,
	next func(*pipeline.Run),
	executionContext *middleware.ExecutionContext,
)

Apply is where the middleware's logic resides

It adapts the run based on its slice of the run's arguments. It may also trigger side effects such as executing shell commands or full runs of other pipelines. When done, this function should call next in order to continue unwinding the stack.

func (Middleware) String

func (Middleware) String() string

String is a human-readable description

Jump to

Keyboard shortcuts

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