snapshot of https://github.com/ThreeDotsLabs/watermill.git (master, 2026-09-15; blobs > 131072B omitted)
Some checks failed
master / ci (push) Failing after 0s
Some checks failed
master / ci (push) Failing after 0s
This commit is contained in:
18
message/metadata.go
Normal file
18
message/metadata.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package message
|
||||
|
||||
// Metadata is sent with every message to provide extra context without unmarshaling the message payload.
|
||||
type Metadata map[string]string
|
||||
|
||||
// Get returns the metadata value for the given key. If the key is not found, an empty string is returned.
|
||||
func (m Metadata) Get(key string) string {
|
||||
if v, ok := m[key]; ok {
|
||||
return v
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// Set sets the metadata key to value.
|
||||
func (m Metadata) Set(key, value string) {
|
||||
m[key] = value
|
||||
}
|
||||
Reference in New Issue
Block a user