Skip to content

Commit 80858c9

Browse files
committed
add: NewEvent
1 parent f867258 commit 80858c9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

event.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ type Event struct {
2121
body []byte
2222
}
2323

24+
// NewEvent returns a new Event with the given headers and body.
25+
func NewEvent(headers map[string]string, body []byte) Event {
26+
return Event{
27+
headers: headers,
28+
body: body,
29+
}
30+
}
31+
2432
// Get returns the value associated with the given key from the Event's headers.
2533
func (e Event) Get(key string) string {
2634
return e.headers[key]

0 commit comments

Comments
 (0)