Created
June 3, 2022 07:33
-
-
Save AntonStoeckl/39a4c8e58f859b9a40945fab73581b6c to your computer and use it in GitHub Desktop.
Example for Blog Post "Hexagonal Architecture: Structuring a project and the influence of granularity V2
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
##### the coarse-grained version ##### | |
type ForStoringEvents interface { | |
CreateEventStream(streamID lib.StreamID, event lib.Event) error | |
AppendEventsToStream( | |
streamID lib.StreamID, | |
expectedRevision uint64, | |
recordedEvents ...lib.Event, | |
) error | |
ReadEventStream(streamID lib.StreamID) (lib.EventStream, error) | |
} | |
type ForReadingDeckSets interface { | |
Read() (game.DeckSet, error) | |
} | |
type ForReadingProjections interface { | |
ReadActivePlayersProjection() (game.ActivePlayersView, error) | |
ReadLeaderboardProjection() (game.LeaderboardView, error) | |
} | |
##### the fine-grained version ##### | |
type ForCreatingEventStreams interface { | |
Create(streamID lib.StreamID, event lib.Event) error | |
} | |
type ForAppendingEventsToStreams interface { | |
Append( | |
streamID lib.StreamID, | |
expectedRevision uint64, | |
recordedEvents ...lib.Event, | |
) error | |
} | |
type ForReadingEventStreams interface { | |
Read(streamID lib.StreamID) (lib.EventStream, error) | |
} | |
### | |
type ForReadingDeckSets interface { | |
Read() (game.DeckSet, error) | |
} | |
### | |
type ForReadingActivePlayersProjections interface { | |
Read() (game.ActivePlayersView, error) | |
} | |
type ForReadingLeaderboardProjections interface { | |
Read() (game.LeaderboardView, error) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment