Documentation ¶
Index ¶
- type Attributes
- type Message
- func (msg *Message) AttrExists(key string) (bool, string)
- func (msg *Message) ExportJSON() (string, error)
- func (msg *Message) GetAttribute(key string) (string, error)
- func (msg *Message) GetDecoded() string
- func (msg *Message) InsertAttribute(key string, value string) error
- func (msg *Message) RemoveAttribute(key string) error
- func (msg Message) Size() int64
- func (msg *Message) UpdateAttribute(key string, value string) error
- type MsgIDs
- type MsgList
- type PushMsg
- type RecList
- type RecMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attributes ¶
Attributes representation as key/value
func (Attributes) MarshalJSON ¶
func (attr Attributes) MarshalJSON() ([]byte, error)
MarshalJSON generates json string for Attributes type
type Message ¶
type Message struct { ID string `json:"messageId,omitempty"` Attr Attributes `json:"attributes,omitempty"` // used to hold attribute key/value store Data string `json:"data"` // base64 encoded data payload PubTime string `json:"publishTime,omitempty"` // publish timedate of message }
Message struct used to hold message information
func LoadMsgJSON ¶
LoadMsgJSON creates a new Message from a json string represenatation
func (*Message) AttrExists ¶
AttrExists checks if an attribute exists based on key. Returns also a boolean if the attribute exists
func (*Message) ExportJSON ¶
ExportJSON exports whole Message Structure as a json string
func (*Message) GetAttribute ¶
GetAttribute takes a key and return attribute value if exists (based on key)
func (*Message) GetDecoded ¶
GetDecoded returns the base64 payload in it's original form
func (*Message) InsertAttribute ¶
InsertAttribute takes a key/value item and appends it in Message's attributes
func (*Message) RemoveAttribute ¶
RemoveAttribute takes a key and removes attribute if exists (based on key)
type MsgIDs ¶
type MsgIDs struct {
IDs []string `json:"messageIds"`
}
MsgIDs utility struct
func (*MsgIDs) ExportJSON ¶
ExportJSON exports whole msgId Structure as a json string
type MsgList ¶
type MsgList struct {
Msgs []Message `json:"messages"`
}
MsgList is used to hold a list of messages
func LoadMsgListJSON ¶
LoadMsgListJSON creates a MsgList from a json definition
func (*MsgList) ExportJSON ¶
ExportJSON exports whole MsgList as a json string
type PushMsg ¶
PushMsg contains structure for push messages
func (*PushMsg) ExportJSON ¶
ExportJSON exports whole Message Structure as a json string
type RecList ¶
type RecList struct {
RecMsgs []RecMsg `json:"receivedMessages"`
}
RecList holds the array of the receivedMessages - subscription related
func (*RecList) ExportJSON ¶
ExportJSON exports whole msgId Structure as a json string