eventstream

package
v1.44.174 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: Apache-2.0 Imports: 12 Imported by: 72

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeWithLogger added in v1.27.0

func DecodeWithLogger(logger aws.Logger) func(*Decoder)

DecodeWithLogger adds a logger to be used by the decoder when decoding stream events.

func EncodeHeaders added in v1.27.0

func EncodeHeaders(w io.Writer, headers Headers) error

EncodeHeaders writes the header values to the writer encoded in the event stream format. Returns an error if a header fails to encode.

func EncodeWithLogger added in v1.27.0

func EncodeWithLogger(logger aws.Logger) func(*Encoder)

EncodeWithLogger adds a logger to be used by the encode when decoding stream events.

Types

type BoolValue

type BoolValue bool

An BoolValue provides eventstream encoding, and representation of a Go bool value.

func (BoolValue) Get

func (v BoolValue) Get() interface{}

Get returns the underlying type

func (BoolValue) String

func (v BoolValue) String() string

type BytesValue

type BytesValue []byte

An BytesValue provides eventstream encoding, and representation of a Go byte slice.

func (BytesValue) Get

func (v BytesValue) Get() interface{}

Get returns the underlying value.

func (BytesValue) String

func (v BytesValue) String() string

type ChecksumError

type ChecksumError struct{}

ChecksumError provides the error for message checksum invalidation errors.

func (ChecksumError) Error

func (e ChecksumError) Error() string

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder provides decoding of an Event Stream messages.

func NewDecoder

func NewDecoder(r io.Reader, opts ...func(*Decoder)) *Decoder

NewDecoder initializes and returns a Decoder for decoding event stream messages from the reader provided.

func (*Decoder) Decode

func (d *Decoder) Decode(payloadBuf []byte) (m Message, err error)

Decode attempts to decode a single message from the event stream reader. Will return the event stream message, or error if Decode fails to read the message from the stream.

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

Encoder provides EventStream message encoding.

func NewEncoder

func NewEncoder(w io.Writer, opts ...func(*Encoder)) *Encoder

NewEncoder initializes and returns an Encoder to encode Event Stream messages to an io.Writer.

func (*Encoder) Encode

func (e *Encoder) Encode(msg Message) (err error)

Encode encodes a single EventStream message to the io.Writer the Encoder was created with. An error is returned if writing the message fails.

type Header struct {
	Name  string
	Value Value
}

Header is a single EventStream Key Value header pair.

type Headers

type Headers []Header

Headers are a collection of EventStream header values.

func (Headers) Clone added in v1.33.7

func (hs Headers) Clone() Headers

Clone returns a deep copy of the headers

func (*Headers) Del

func (hs *Headers) Del(name string)

Del deletes the value in the Headers if it exists.

func (Headers) Get

func (hs Headers) Get(name string) Value

Get returns the Value associated with the header. Nil is returned if the value does not exist.

func (*Headers) Set

func (hs *Headers) Set(name string, value Value)

Set associates the name with a value. If the header name already exists in the Headers the value will be replaced with the new one.

type Int16Value

type Int16Value int16

An Int16Value provides eventstream encoding, and representation of a Go int16 value.

func (Int16Value) Get

func (v Int16Value) Get() interface{}

Get returns the underlying value.

func (Int16Value) String

func (v Int16Value) String() string

type Int32Value

type Int32Value int32

An Int32Value provides eventstream encoding, and representation of a Go int32 value.

func (Int32Value) Get

func (v Int32Value) Get() interface{}

Get returns the underlying value.

func (Int32Value) String

func (v Int32Value) String() string

type Int64Value

type Int64Value int64

An Int64Value provides eventstream encoding, and representation of a Go int64 value.

func (Int64Value) Get

func (v Int64Value) Get() interface{}

Get returns the underlying value.

func (Int64Value) String

func (v Int64Value) String() string

type Int8Value

type Int8Value int8

An Int8Value provides eventstream encoding, and representation of a Go int8 value.

func (Int8Value) Get

func (v Int8Value) Get() interface{}

Get returns the underlying value.

func (Int8Value) String

func (v Int8Value) String() string

type LengthError

type LengthError struct {
	Part  string
	Want  int
	Have  int
	Value interface{}
}

LengthError provides the error for items being larger than a maximum length.

func (LengthError) Error

func (e LengthError) Error() string

type Message

type Message struct {
	Headers Headers
	Payload []byte
}

A Message provides the eventstream message representation.

func Decode added in v1.27.0

func Decode(reader io.Reader, payloadBuf []byte) (m Message, err error)

Decode attempts to decode a single message from the event stream reader. Will return the event stream message, or error if Decode fails to read the message from the reader.

func (Message) Clone added in v1.33.7

func (m Message) Clone() Message

Clone returns a deep copy of the message.

type StringValue

type StringValue string

An StringValue provides eventstream encoding, and representation of a Go string.

func (StringValue) Get

func (v StringValue) Get() interface{}

Get returns the underlying value.

func (StringValue) String

func (v StringValue) String() string

type TimestampValue

type TimestampValue time.Time

An TimestampValue provides eventstream encoding, and representation of a Go timestamp.

func (TimestampValue) Get

func (v TimestampValue) Get() interface{}

Get returns the underlying value.

func (TimestampValue) MarshalJSON added in v1.27.0

func (v TimestampValue) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (TimestampValue) String

func (v TimestampValue) String() string

type UUIDValue

type UUIDValue [16]byte

An UUIDValue provides eventstream encoding, and representation of a UUID value.

func (UUIDValue) Get

func (v UUIDValue) Get() interface{}

Get returns the underlying value.

func (UUIDValue) String

func (v UUIDValue) String() string

type Value

type Value interface {
	Get() interface{}
	String() string
	// contains filtered or unexported methods
}

Value represents the abstract header value.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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