-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathprocessable.go
72 lines (56 loc) · 1.36 KB
/
processable.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package pluto
import (
"time"
"github.com/google/uuid"
)
type Processable interface {
SetBody(any)
GetBody() any
}
type RoutableProcessable interface {
Processable
GetProducer() Identifier
GetConsumer() Identifier
}
type OutComingProcessable struct {
Producer ExternalIdentifier `json:"producer"`
Consumer ExternalIdentifier `json:"consumer"`
ProducerCredential OutComingCredential `json:"producer_credential"`
Body any `json:"body"`
}
func (o *OutComingProcessable) GetProducer() Identifier {
return o.Producer
}
func (o *OutComingProcessable) GetConsumer() Identifier {
return o.Consumer
}
func (o *OutComingProcessable) SetBody(v any) {
o.Body = v
}
func (o *OutComingProcessable) GetBody() any {
return o.Body
}
type OutGoingProcessable struct {
Consumer ExternalIdentifier `json:"consumer"`
Body any `json:"body"`
}
func (o *OutGoingProcessable) GetConsumer() Identifier {
return o.Consumer
}
func (o *OutGoingProcessable) SetBody(v any) {
o.Body = v
}
func (o *OutGoingProcessable) GetBody() any {
return o.Body
}
type InternalProcessable struct {
ID uuid.UUID `json:"id"`
Body any `json:"body"`
CreatedAt time.Time `json:"created_at"`
}
func (o *InternalProcessable) SetBody(v any) {
o.Body = v
}
func (o *InternalProcessable) GetBody() any {
return o.Body
}