-
Notifications
You must be signed in to change notification settings - Fork 92
/
command.go
44 lines (37 loc) · 931 Bytes
/
command.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
package eventhus
// Command contains the methods to retreive basic info about it
type Command interface {
GetType() string
GetAggregateID() string
GetAggregateType() string
IsValid() bool
GetVersion() int
}
// BaseCommand contains the basic info
// that all commands should have
type BaseCommand struct {
Type string
AggregateID string
AggregateType string
Version int
}
// GetAggregateID returns the command aggregate ID
func (b BaseCommand) GetAggregateID() string {
return b.AggregateID
}
// GetType returns the command type
func (b BaseCommand) GetType() string {
return b.Type
}
// GetAggregateType returns the command aggregate type
func (b BaseCommand) GetAggregateType() string {
return b.AggregateType
}
// IsValid checks validates the command
func (b BaseCommand) IsValid() bool {
return true
}
// GetVersion of the command
func (b BaseCommand) GetVersion() int {
return b.Version
}