Documentation ¶
Overview ¶
Package message contains implementations of types.Message.
Index ¶
- Variables
- func CopyJSON(root interface{}) (interface{}, error)
- func GetAllBytes(m types.Message) [][]byte
- func GetContext(p types.Part) context.Context
- func Lock(msg types.Message, part int) types.Message
- func MetaPartCopy(p types.Part) types.Part
- func SetAllMetadata(m types.Message, meta types.Metadata)
- func ToBytes(m types.Message) []byte
- func WithContext(ctx context.Context, p types.Part) types.Part
- type Part
- func (p *Part) Copy() types.Part
- func (p *Part) DeepCopy() types.Part
- func (p *Part) Get() []byte
- func (p *Part) IsEmpty() bool
- func (p *Part) JSON() (interface{}, error)
- func (p *Part) Metadata() types.Metadata
- func (p *Part) Set(data []byte) types.Part
- func (p *Part) SetJSON(jObj interface{}) error
- func (p *Part) SetMetadata(meta types.Metadata) types.Part
- type Type
- func (m *Type) Append(b ...types.Part) int
- func (m *Type) Copy() types.Message
- func (m *Type) CreatedAt() time.Time
- func (m *Type) DeepCopy() types.Message
- func (m *Type) Get(index int) types.Part
- func (m *Type) Iter(f func(i int, p types.Part) error) error
- func (m *Type) Len() int
- func (m *Type) SetAll(parts []types.Part)
Constants ¶
This section is empty.
Variables ¶
var ( ErrMessagePartNotExist = errors.New("target message part does not exist") ErrBadMessageBytes = errors.New("serialised message bytes were in unexpected format") ErrBlockCorrupted = errors.New("serialised messages block was in unexpected format") )
Errors returned by the message type.
Functions ¶
func CopyJSON ¶ added in v0.37.4
func CopyJSON(root interface{}) (interface{}, error)
CopyJSON recursively creates a deep copy of a JSON structure extracted from a message part.
func GetAllBytes ¶ added in v0.23.0
GetAllBytes returns a 2D byte slice representing the raw byte content of the parts of a message.
func GetContext ¶ added in v1.6.0
GetContext either returns a context attached to the message part, or context.Background() if one hasn't been previously attached.
func Lock ¶
Lock wraps a message into a read only type that restricts access to only a single message part, accessible either by index 0 or -1.
func MetaPartCopy ¶ added in v1.6.0
MetaPartCopy creates a new empty message part by copying any meta fields (metadata, context, etc) from a reference part.
func SetAllMetadata ¶ added in v0.23.0
SetAllMetadata sets the metadata of all message parts to match a provided metadata implementation.
Types ¶
type Part ¶ added in v0.23.0
type Part struct {
// contains filtered or unexported fields
}
Part is an implementation of types.Part, containing the contents and metadata of a message part.
func (*Part) JSON ¶ added in v0.23.0
JSON attempts to parse the message part as a JSON document and returns the result.
type Type ¶
type Type struct {
// contains filtered or unexported fields
}
Type is the standard implementation of types.Message, containing a multiple part message.
func (*Type) Copy ¶ added in v0.23.0
Copy creates a new shallow copy of the message. Parts can be re-arranged in the new copy and JSON parts can be get/set without impacting other message copies. However, it is still unsafe to edit the raw content of message parts.
func (*Type) DeepCopy ¶
DeepCopy creates a new deep copy of the message. This can be considered an entirely new object that is safe to use anywhere.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package mapper implements ways of splicing and mapping batches of messages so that their derivative parts can be processed individually and merged back into the original batch.
|
Package mapper implements ways of splicing and mapping batches of messages so that their derivative parts can be processed individually and merged back into the original batch. |
Package metadata contains implementations of types.Metadata.
|
Package metadata contains implementations of types.Metadata. |
Package tracing implements utility functions for recording opentracing events for messages.
|
Package tracing implements utility functions for recording opentracing events for messages. |