Documentation ¶
Overview ¶
Package message contains implementations of types.Message.
Index ¶
- Variables
- func CloneGeneric(root interface{}) (interface{}, error)
- func Lock(msg types.Message, part int) types.Message
- type Type
- func (m *Type) Append(b ...[]byte) int
- func (m *Type) Bytes() []byte
- func (m *Type) CreatedAt() time.Time
- func (m *Type) DeepCopy() types.Message
- func (m *Type) DeleteMetadata(key string)
- func (m *Type) Get(index int) []byte
- func (m *Type) GetAll() [][]byte
- func (m *Type) GetJSON(part int) (interface{}, error)
- func (m *Type) GetMetadata(key string) string
- func (m *Type) Iter(f func(i int, b []byte) error) error
- func (m *Type) IterMetadata(f func(k, v string) error) error
- func (m *Type) LazyCondition(label string, cond types.Condition) bool
- func (m *Type) Len() int
- func (m *Type) Set(index int, b []byte)
- func (m *Type) SetAll(p [][]byte)
- func (m *Type) SetJSON(part int, jObj interface{}) error
- func (m *Type) SetMetadata(key, value string)
- func (m *Type) ShallowCopy() types.Message
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 CloneGeneric ¶ added in v0.21.2
func CloneGeneric(root interface{}) (interface{}, error)
CloneGeneric is a utility function that recursively copies a generic structure usually resulting from a JSON parse.
Types ¶
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) 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) DeleteMetadata ¶
DeleteMetadata removes a metadata key from the message.
func (*Type) GetAll ¶
GetAll returns all message parts as a 2D byte slice, the contents of this slice should NOT be modified.
func (*Type) GetMetadata ¶
GetMetadata returns a metadata field from its key.
func (*Type) IterMetadata ¶
IterMetadata iterates each metadata key/value pair, calling f for each pair.
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.
func (*Type) SetJSON ¶
SetJSON attempts to marshal an object into a JSON string and sets a message part to the result.
func (*Type) SetMetadata ¶
SetMetadata sets the value of a metadata key.
func (*Type) ShallowCopy ¶
ShallowCopy 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 content of parts.
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. |