Help us shape the future of Go! Take the 2026 Go Developer Survey

pipe

package
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 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 Pipe

type Pipe[Payload, Value any] struct {
	Sender              Sender[Payload, Value]
	Receiver            Receiver[Payload, Value]
	OnReceiveCompletion func()
	OnSendCompletion    func()
}

func New

func New[Payload, Value any](req Request[Payload]) *Pipe[Payload, Value]

func NewWithFunction

func NewWithFunction[Payload, Value any](f func(context.Context) (Value, error)) (*Pipe[Payload, Value], func())

type Receiver

type Receiver[Payload, Value any] interface {
	Receive() bool
	Cancel()
	Status() Status[Value]
	Request() Payload
}

type Request

type Request[Payload any] struct {
	Payload  Payload
	Canceled bool
}

type Sender

type Sender[Payload, Value any] interface {
	Request() Request[Payload]
	Update(v Value)
	Finalize(v Value, err error)
	Status() Status[Value]
}

type Status

type Status[Value any] struct {
	Canceled  bool
	Completed bool
	Err       error
	Value     Value
}

Jump to

Keyboard shortcuts

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