custom

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package custom implements an user defined function

Index

Constants

This section is empty.

Variables

View Source
var ErrNilFunction = errors.New("nil UserFunction passed to Worker")

ErrNilFunction a nil UserFunction is provided via FunctionOptions

Functions

This section is empty.

Types

type Function

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

Function allow users to create custom Workers just with a function

func NewFunction

func NewFunction(opts FunctionOptions) *Function

NewFunction create a Function object with goven options

func (*Function) Process

func (f *Function) Process(ctx context.Context, args selina.ProcessArgs) error

Process implements selina.Worker interface

type FunctionOptions

type FunctionOptions struct {
	Func UserFunction
}

FunctionOptions customize a Function Worker

func (FunctionOptions) Check added in v0.8.0

func (o FunctionOptions) Check() error

Check if a combination of options is valid

type UserFunction

type UserFunction func(input []byte) ([]byte, error)

UserFunction define an user custom modification is safe to return input to avoid allocations if an error is returned Process is aborted a filter can be implemented returning (nil,nil)

Jump to

Keyboard shortcuts

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