pipeline

package
v0.0.0-...-6a20a75 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2019 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// ErrUndefinedMethod means method undefined
	ErrUndefinedMethod = "undefined method: %s"
	// ErrWrongArgNumber means wrong args number
	ErrWrongArgNumber = "method %s expects %d parameters, but %d received"
	// ErrAlreadyExists means processor already exists
	ErrAlreadyExists = "processor regist failed: %s already exists"
)
View Source
const (
	// InvokePlaceholder is used for its own replacement.
	// When InvokePlaceholder appears in args, it will be replaced by the string of its own node.
	InvokePlaceholder = string(26) + "{$}" + string(26)
)

Variables

This section is empty.

Functions

func InvokeProcessor

func InvokeProcessor(node selector.Selection, name string, args []string) (selector.Selection, error)

InvokeProcessor is used to invoke a Processor.

func Process

func Process(selection selector.Selection, pipes Pipelines) (node selector.Selection, err error)

Process performs the entire pipeline process for selection

func RegistProcessor

func RegistProcessor(name string, callee Callee, argsCount int) error

RegistProcessor is used to register a Processor with the registry.

Types

type Callee

type Callee func(selector.Selection, []string) (selector.Selection, error)

Callee defines the function body of Processor.

type Pipeline

type Pipeline struct {
	Name string
	Args []string
}

Pipeline structure is the calling unit in pipeline.

type Pipelines

type Pipelines []*Pipeline

Pipelines defines the entire pipeline process of a selection.

type Processor

type Processor struct {
	// Func is the function ontology.
	Func Callee
	// ArgsCount is the number of function parameters.
	ArgsCount int
}

Processor is the function call unit of pipeline.

Jump to

Keyboard shortcuts

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