Documentation
¶
Overview ¶
Package resumablestream reconnects resource-level SSE streams after retryable failures.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Child ¶
type Child[T any] interface { Next() bool Current() T Err() error LastEventID() string Close() error }
Child is one connection in a resumable stream.
type Open ¶
Open starts a child stream at the supplied event cursor. resume is true once the cursor came from a yielded event rather than the initial request.
type Stream ¶
type Stream[T any] struct { // contains filtered or unexported fields }
Stream reconnects child streams while retaining the latest yielded event cursor.
func New ¶
func New[T any](ctx context.Context, lastEventID string, open Open[T], terminal func(T) bool) *Stream[T]
New creates a resumable stream. Connections are opened lazily by Next.
func (*Stream[T]) Current ¶
func (s *Stream[T]) Current() T
Current returns the most recently yielded event.
func (*Stream[T]) LastEventID ¶
LastEventID returns the latest non-empty cursor from a yielded child event.