ssestream

package
v0.0.0-...-52a52df Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

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

Jump to

Keyboard shortcuts

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