message

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: MIT Imports: 8 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithDecoderErr

func WithDecoderErr(err error) error

Types

type DecoderErr

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

type Headers

type Headers map[string]interface{}

func (Headers) RegisterReturn

func (m Headers) RegisterReturn()

func (Headers) ReturnsCount

func (m Headers) ReturnsCount() int

type Marshaller

type Marshaller interface {
	// Unmarshal decodes received bytes into original type that must be registered in scheme
	Unmarshal(b []byte) (Object, error)
	// Marshal encodes a type and automatically adds needed metadata to resulting bytes
	Marshal(obj Object) ([]byte, error)
}

func NewJsonMarshaller

func NewJsonMarshaller(knownTypes scheme.KnownTypesRegistry) Marshaller

type MsgOption

type MsgOption func(attr *opts)

func WithHeaders

func WithHeaders(headers Headers) MsgOption

func WithTraceID

func WithTraceID(traceID string) MsgOption

type Object

type Object interface {
	scheme.Object
}

type ObjectMeta

type ObjectMeta struct {
	scheme.TypeMeta
}

type OutcomingMessage

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

func FromReceivedMsg

func FromReceivedMsg(received *ReceivedMessage) *OutcomingMessage

func NewOutcomingMessage

func NewOutcomingMessage(payload Object, passedOptions ...MsgOption) *OutcomingMessage

NewOutcomingMessage accepts only structs as payload. If you want to pass scalar data type - wrap it in a struct.

func (OutcomingMessage) Headers

func (m OutcomingMessage) Headers() Headers

func (OutcomingMessage) Payload

func (m OutcomingMessage) Payload() Object

func (OutcomingMessage) UID

func (m OutcomingMessage) UID() string

type ReceivedMessage

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

func NewReceivedMessage

func NewReceivedMessage(uid string, payload Object, headers Headers, receivedAt time.Time, origin string) *ReceivedMessage

func (ReceivedMessage) Headers

func (m ReceivedMessage) Headers() Headers

func (ReceivedMessage) Origin

func (m ReceivedMessage) Origin() string

func (ReceivedMessage) Payload

func (m ReceivedMessage) Payload() Object

func (ReceivedMessage) ReceivedAt

func (m ReceivedMessage) ReceivedAt() time.Time

func (ReceivedMessage) TraceID

func (m ReceivedMessage) TraceID() string

func (ReceivedMessage) UID

func (m ReceivedMessage) UID() string

type Unstructured

type Unstructured struct {
	// Object is a JSON compatible map with string, float, int, bool, []interface{}, or
	// map[string]interface{}
	// children.
	Object map[string]interface{}
}

func (*Unstructured) GetUID

func (u *Unstructured) GetUID() string

func (*Unstructured) GroupKind

func (u *Unstructured) GroupKind() scheme.GroupKind

func (*Unstructured) SetGroupKind

func (u *Unstructured) SetGroupKind(gk *scheme.GroupKind)

func (*Unstructured) UnmarshalJSON

func (u *Unstructured) UnmarshalJSON(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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