forked from jen20/go-event-sourcing-sample
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from hallgren/projections
Projections
- Loading branch information
Showing
9 changed files
with
843 additions
and
75 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
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
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
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
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 memory | ||
|
||
import "github.com/hallgren/eventsourcing/core" | ||
|
||
type iterator struct { | ||
events []core.Event | ||
position int | ||
event core.Event | ||
} | ||
|
||
func (i *iterator) Next() bool { | ||
if len(i.events) <= i.position { | ||
return false | ||
} | ||
i.event = i.events[i.position] | ||
i.position++ | ||
return true | ||
} | ||
|
||
func (i *iterator) Value() (core.Event, error) { | ||
return i.event, nil | ||
} | ||
|
||
func (i *iterator) Close() { | ||
i.events = nil | ||
i.position = 0 | ||
} |
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
Oops, something went wrong.