Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseTypeAndDataVersion ¶
func ParseTypeAndDataVersion(data interface{}) (Type, DataVersion, error)
ParseTypeAndDataVersion returns the message type and data version for a given data The type a hyphen separated string The data should be a struct whose name is like (all those results in the same type): MyMessageV1 -> "my-message", 1 myMessageV1 -> "my-message", 1 MYMessageV1 -> "my-message", 1
Types ¶
type DataVersion ¶
type DataVersion int
DataVersion is the type used to represent messages data version
type Message ¶
type Message struct { SchemaVersion SchemaVersion ID string `json:"Id"` Source Source Type Type CreatedAt string DataVersion DataVersion Data json.RawMessage }
Message is the default event structure
func New ¶
New creates a new message with auto discovering of message type and version The type name of the data param must be in the format <type>V<version>, like nsuReceivedV3 The data must be json marshable
func (Message) MarshalZerologObject ¶
MarshalZerologObject implements the zerolog marshaler so it can be logged using: log.With().EmbedObject(stakeholder).Msg("Some message")
type SchemaVersion ¶
type SchemaVersion int
SchemaVersion is the type used to represent mesages schema version
const ( // SchemaVersion3 is the only schema version available right now. // All messages are produced with this as default. SchemaVersion3 SchemaVersion = 3 )