steps

package
v0.2.22 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 4 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingClientAPIKey = errors.Newf("missing client settings api key")
View Source
var ErrMissingClientSettings = errors.Newf("missing client settings")

Functions

This section is empty.

Types

type Step

type Step[T any, U any] interface {
	// Start gets called multiple times for the same Step, once per incoming value,
	// since StepResult is also the list monad (ie., supports multiple values)
	Start(ctx context.Context, input T) (*StepResult[U], error)
	Close(ctx context.Context) error
}

Step is the generalization of a lambda function, with cancellation and closing to allow it to own resources.

type StepResult added in v0.2.4

type StepResult[T any] struct {
	// contains filtered or unexported fields
}

func Bind added in v0.2.4

func Bind[T any, U any](
	ctx context.Context,
	m *StepResult[T],
	step Step[T, U],
) *StepResult[U]

Bind is the monadic bind operator for StepResult. It takes a step result, a step (which is just a lambda turned into a struct) iterates over the results in the StepResult, and starts the Step for each value.

func NewStepResult added in v0.2.4

func NewStepResult[T any](value <-chan helpers.Result[T]) *StepResult[T]

func Reject added in v0.2.4

func Reject[T any](err error) *StepResult[T]

func Resolve added in v0.2.4

func Resolve[T any](value T) *StepResult[T]

func ResolveNone added in v0.2.4

func ResolveNone[T any]() *StepResult[T]

func (*StepResult[T]) GetChannel added in v0.2.4

func (m *StepResult[T]) GetChannel() <-chan helpers.Result[T]

func (*StepResult[T]) Return added in v0.2.4

func (m *StepResult[T]) Return() []helpers.Result[T]

Directories

Path Synopsis
ai

Jump to

Keyboard shortcuts

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