stream

package
v0.0.102 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stream

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

Stream is a generic streaming reader for decoding JSON-encoded data from an HTTP response.

func NewStream

func NewStream[T any](response *http.Response, optFns ...func(o *StreamOptions)) *Stream[T]

NewStream creates a new instance of the Stream.

func (Stream[T]) Close

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

Close closes the underlying stream.

func (Stream[T]) Recv

func (s Stream[T]) Recv() (*T, error)

Recv reads and decodes the next value from the stream.

type StreamOptions

type StreamOptions struct {
	Delimeter []byte
}

StreamOptions contains options for configuring the Stream.

Jump to

Keyboard shortcuts

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