unary

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterFunc

func FilterFunc(f interface{}) (api.UnFunc, error)

FilterFunc returns a unary function (api.UnFunc) which applies the user-defined filtering to apply predicates that filters out data items from being included in the downstream. The provided user-defined function must be of type:

func(T) (bool, error) - where T is the type of incoming data item, bool is the value of the predicate

When the user-defined function returns false, the current processed data item will not be placed in the downstream processing.

func FlatMapFunc

func FlatMapFunc(f interface{}) (api.UnFunc, error)

FlatMapFunc returns an unary function which applies a user-defined function which takes incoming comsite items and deconstruct them into individual items which can then be re-streamed. The type for the user-defined function is:

func (T) (R, error) - where R is the original item, R is a slice of decostructed items

The slice returned should be restreamed by placing each item onto the stream for downstream processing. Besides slices, arrays, maps, and sets are also accepted.

func MapFunc

func MapFunc(f interface{}) (api.UnFunc, error)

MapFunc returns an unary function which applies the user-defined function which maps, one-to-one, the incomfing value to a new value. The user-defined function must be of type:

func(T) (R, error) - where T is the incoming item, R is the type of the returned mapped item

func ProcessFunc

func ProcessFunc(f interface{}) (api.UnFunc, error)

ProcessFunc returns a unary function which applies the specified user-defined function that processes data items from upstream and returns a result value. The provided function must be of type:

func(T) (R, error)
where T is the type of incoming item
R the type of returned processed item

Types

type UnaryOperator

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

UnaryOp is an executor node that can execute a unary operation (i.e. transformation, etc)

func New

func New(ctx context.Context) *UnaryOperator

NewUnary creates *UnaryOperator value

func (*UnaryOperator) Exec

func (o *UnaryOperator) Exec(drain chan<- error)

Exec is the entry point for the executor

func (*UnaryOperator) GetOutput

func (o *UnaryOperator) GetOutput() <-chan interface{}

GetOutput returns the output channel for the executor node

func (*UnaryOperator) SetConcurrency

func (o *UnaryOperator) SetConcurrency(concurr int)

SetConcurrency sets the concurrency level for the operation

func (*UnaryOperator) SetInput

func (o *UnaryOperator) SetInput(in <-chan interface{})

SetInput sets the input channel for the executor node

func (*UnaryOperator) SetOperation

func (o *UnaryOperator) SetOperation(op api.UnOperation)

SetOperation sets the executor operation

Jump to

Keyboard shortcuts

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