-
Notifications
You must be signed in to change notification settings - Fork 0
/
message.go
53 lines (43 loc) · 877 Bytes
/
message.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package box
import (
"encoding/json"
"time"
)
func NewMessage(id string, _type string, createdAt time.Time, payload, metadata json.RawMessage) Message {
return &message{
id: id,
_type: _type,
createdAt: createdAt,
payload: payload,
metadata: metadata,
}
}
type message struct {
id string
_type string
createdAt time.Time
registeredAt time.Time
payload json.RawMessage
metadata json.RawMessage
}
func (m *message) Offset() int {
return 0
}
func (m *message) ID() string {
return m.id
}
func (m *message) Type() string {
return m._type
}
func (m *message) CreatedAt() time.Time {
return m.createdAt
}
func (m *message) RegisteredAt() time.Time {
return m.createdAt
}
func (m *message) Payload() json.RawMessage {
return m.payload
}
func (m *message) Metadata() json.RawMessage {
return m.metadata
}