Documentation ¶
Overview ¶
Package message contains implementations of types.Message.
Index ¶
- Variables
- func GetAllBytes(m types.Message) [][]byte
- func Lock(msg types.Message, part int) types.Message
- func SetAllMetadata(m types.Message, meta types.Metadata)
- func ToBytes(m types.Message) []byte
- type Part
- func (p *Part) Copy() types.Part
- func (p *Part) DeepCopy() types.Part
- func (p *Part) Get() []byte
- 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) LazyCondition(label string, cond types.Condition) bool
- 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 GetAllBytes ¶ added in v0.23.0
GetAllBytes returns a 2D byte slice representing the raw byte content of the parts of a message.
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 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.
func (*Type) LazyCondition ¶
LazyCondition resolves a particular condition on the message, if the condition has already been applied to this message the cached result is returned instead. When a message is altered in any way the conditions cache is cleared.
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. |