mapreduce

package
v0.0.0-...-d843dc6 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter func(any) (bool, error)

type Interface

type Interface interface {
	From(producer Producer) Interface
	Map(mapper Mapper) Interface
	Filter(filters ...Filter) Interface
	Reduce(reducer Reducer) Interface
	Do() (any, error)
	Err() error
}

func New

func New(opts ...Option) Interface

func NewFromMapReducer

func NewFromMapReducer(mr MapReducer, opts ...Option) Interface

type MapReduceOption

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

type MapReducer

type MapReducer interface {
	From(w Writer) error
	Map(item any) (any, error)
	Reduce(r Reader) (any, error)
}

type Mapper

type Mapper func(item any) (any, error)

type Option

type Option func(*MapReduceOption)

func WithContext

func WithContext(ctx context.Context) Option

func WithWorkers

func WithWorkers(workers int) Option

type Producer

type Producer func(w Writer) error

type Reader

type Reader interface {
	Read() (any, bool)
}

type Reducer

type Reducer func(r Reader) (any, error)

type Writer

type Writer interface {
	Write(any)
}

Jump to

Keyboard shortcuts

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