Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewwebber committed Jan 20, 2019
1 parent 3b4a45c commit f93db1f
Show file tree
Hide file tree
Showing 22 changed files with 598 additions and 1,619 deletions.
14 changes: 11 additions & 3 deletions couchbase/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/andrewwebber/cqrs"

"github.com/couchbaselabs/go-couchbase"
couchbase "github.com/couchbaselabs/go-couchbase"
)

type cbVersionedEvent struct {
Expand Down Expand Up @@ -156,7 +156,7 @@ func (r *EventStreamRepository) AllIntegrationEventsEverPublished() ([]cqrs.Vers
var result []cqrs.VersionedEvent
for i := 0; i < counter; i++ {
key := fmt.Sprintf("integration::%d", i)
events, err := r.Get(key)
events, err := r.Get(key, 0)
if err != nil {
return nil, err
}
Expand All @@ -171,8 +171,16 @@ func (r *EventStreamRepository) AllIntegrationEventsEverPublished() ([]cqrs.Vers
return result, nil
}

func (r *EventStreamRepository) GetSnapshot(id string) (cqrs.EventSourced, error) {
return nil, nil
}

func (r *EventStreamRepository) SaveSnapshot(eventsourced cqrs.EventSourced) error {
return nil
}

// Get retrieves events assoicated with an event sourced object by ID
func (r *EventStreamRepository) Get(id string) ([]cqrs.VersionedEvent, error) {
func (r *EventStreamRepository) Get(id string, fromVersion int) ([]cqrs.VersionedEvent, error) {
var version int
cbKey := fmt.Sprintf("%s:%s", r.cbPrefix, id)
if error := r.bucket.Get(cbKey, &version); error != nil {
Expand Down
18 changes: 0 additions & 18 deletions example/doc.go

This file was deleted.

Loading

0 comments on commit f93db1f

Please sign in to comment.