-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created new files for process events handling and event storage. The process events include timestamp and stream id and an interface for handling them. In addition, a new interface for event storage has been introduced.
- Loading branch information
1 parent
ded06ba
commit 7c2af80
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package events | ||
|
||
import ( | ||
"github.com/PiotrFerenc/mash2/internal/types" | ||
"github.com/google/uuid" | ||
"time" | ||
) | ||
|
||
type Event struct { | ||
CreatedAt time.Time | ||
StreamId uuid.UUID | ||
} | ||
|
||
type ProcessEvent interface { | ||
ProcessEvent() *Event | ||
} | ||
|
||
type ProcessCreated struct { | ||
Process types.Process | ||
} | ||
|
||
func (p ProcessCreated) ProcessEvent() *Event { | ||
return &Event{ | ||
CreatedAt: time.Now(), | ||
StreamId: p.Process.Id, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package repositories | ||
|
||
import "github.com/PiotrFerenc/mash2/internal/events" | ||
|
||
type EventStore interface { | ||
AddEvent(event events.Event) error | ||
} |