Documentation ¶
Index ¶
- Constants
- Variables
- type NewStepFunc
- type Step
- type StepFactory
- type StepMetadata
- type StepResult
- type StepResultImpl
- func NewStepResult[T any](value <-chan helpers.Result[T], options ...StepResultOption[T]) *StepResultImpl[T]
- func Reject[T any](err error, options ...StepResultOption[T]) *StepResultImpl[T]
- func Resolve[T any](value T, options ...StepResultOption[T]) *StepResultImpl[T]
- func ResolveNone[T any](options ...StepResultOption[T]) *StepResultImpl[T]
- type StepResultOption
Constants ¶
View Source
const MetadataSettingsSlug = "settings"
Variables ¶
View Source
var ErrMissingClientAPIKey = errors.New("missing client settings api key")
View Source
var ErrMissingClientSettings = errors.New("missing client settings")
Functions ¶
This section is empty.
Types ¶
type NewStepFunc ¶ added in v0.4.1
func (NewStepFunc[T, U]) NewStep ¶ added in v0.4.1
func (f NewStepFunc[T, U]) NewStep() (Step[T, U], error)
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) AddPublishedTopic(publisher message.Publisher, topic string) error }
Step is the generalization of a lambda function, with cancellation and closing to allow it to own resources.
type StepMetadata ¶ added in v0.4.1
type StepMetadata struct { StepID uuid.UUID `json:"step_id"` Type string `json:"type"` InputType string `json:"input_type"` OutputType string `json:"output_type"` Metadata map[string]interface{} `json:"meta"` }
func (StepMetadata) MarshalZerologObject ¶ added in v0.4.13
func (sm StepMetadata) MarshalZerologObject(e *zerolog.Event)
func (*StepMetadata) ToMap ¶ added in v0.4.1
func (sm *StepMetadata) ToMap() map[string]interface{}
type StepResult ¶ added in v0.2.4
type StepResult[T any] interface { Return() []helpers.Result[T] GetChannel() <-chan helpers.Result[T] // Cancel can't fail Cancel() GetMetadata() *StepMetadata }
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.
type StepResultImpl ¶ added in v0.2.24
type StepResultImpl[T any] struct { // contains filtered or unexported fields }
func NewStepResult ¶ added in v0.2.4
func NewStepResult[T any]( value <-chan helpers.Result[T], options ...StepResultOption[T], ) *StepResultImpl[T]
func Reject ¶ added in v0.2.4
func Reject[T any](err error, options ...StepResultOption[T]) *StepResultImpl[T]
func Resolve ¶ added in v0.2.4
func Resolve[T any](value T, options ...StepResultOption[T]) *StepResultImpl[T]
func ResolveNone ¶ added in v0.2.4
func ResolveNone[T any](options ...StepResultOption[T]) *StepResultImpl[T]
func (*StepResultImpl[T]) Cancel ¶ added in v0.4.1
func (m *StepResultImpl[T]) Cancel()
func (*StepResultImpl[T]) GetChannel ¶ added in v0.2.24
func (m *StepResultImpl[T]) GetChannel() <-chan helpers.Result[T]
func (*StepResultImpl[T]) GetMetadata ¶ added in v0.4.1
func (m *StepResultImpl[T]) GetMetadata() *StepMetadata
func (*StepResultImpl[T]) Return ¶ added in v0.2.24
func (m *StepResultImpl[T]) Return() []helpers.Result[T]
type StepResultOption ¶ added in v0.4.1
type StepResultOption[T any] func(*StepResultImpl[T])
func WithCancel ¶ added in v0.4.1
func WithCancel[T any](cancel func()) StepResultOption[T]
func WithMetadata ¶ added in v0.4.1
func WithMetadata[T any](metadata *StepMetadata) StepResultOption[T]
func WithMetadataFunc ¶ added in v0.4.1
func WithMetadataFunc[T any](metadataFunc func() *StepMetadata) StepResultOption[T]
Click to show internal directories.
Click to hide internal directories.