Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultMinVersionDeadline = 10 * time.Second
DefaultMinVersionDeadline is the deadline to use when creating a min version context that waits.
Functions ¶
func MinVersionFromContext ¶ added in v0.8.0
MinVersionFromContext returns the min version from the context.
func NewContextWithMinVersion ¶ added in v0.8.0
NewContextWithMinVersion returns the context with min version set.
Types ¶
type Repo ¶
type Repo struct {
eh.ReadWriteRepo
}
Repo is a middleware that adds version checking to a read repository.
func Repository ¶
Repository returns a parent ReadRepo if there is one.
func (*Repo) Find ¶
Find implements the Find method of the eventhorizon.ReadModel interface. If the context contains a min version set by WithMinVersion it will only return an item if its version is at least min version. If a timeout or deadline is set on the context it will repetedly try to get the item until either the version matches or the deadline is reached.