ssestream

package
v0.89.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: Apache-2.0 Imports: 6 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterDecoder

func RegisterDecoder(contentType string, decoder func(io.ReadCloser) Decoder)

Types

type Decoder

type Decoder interface {
	Event() Event
	Next() bool
	Close() error
	Err() error
}

func NewDecoder

func NewDecoder(res *http.Response) Decoder

type Event

type Event struct {
	Type string
	Data []byte
}

type Stream

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

func NewStream

func NewStream[T any](decoder Decoder, err error) *Stream[T]

func (*Stream[T]) Close

func (s *Stream[T]) Close() error

func (*Stream[T]) Current

func (s *Stream[T]) Current() T

func (*Stream[T]) Err

func (s *Stream[T]) Err() error

func (*Stream[T]) Next

func (s *Stream[T]) Next() bool

Next returns false if the stream has ended or an error occurred. Call Stream.Current() to get the current value. Call Stream.Err() to get the error.

	for stream.Next() {
		data := stream.Current()
	}

 	if stream.Err() != nil {
		...
 	}

Jump to

Keyboard shortcuts

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