{"modulePath":"github.com/get-eventually/go-eventually/core","version":"v0.2.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package test\n\nPackage test contains some type implementations of core interfaces that are meant to be used in test code only, not in production code.\n\n## Types\n\n```go\ntype InMemoryEventStore struct {\n\t// contains filtered or unexported fields\n}\n```\nInMemoryEventStore is an in-memory event.Store implementation.\n\n```go\nfunc NewInMemoryEventStore() *InMemoryEventStore\n```\nNewInMemoryEventStore creates a new empty test.InMemoryEventStore instance.\n\n```go\nfunc (es *InMemoryEventStore) Append(\n\t_ context.Context,\n\tid event.StreamID,\n\texpected version.Check,\n\tevents ...event.Envelope,\n) (version.Version, error)\n```\nAppend inserts the specified Domain Events into the Event Stream specified by the current instance, returning the new version of the Event Stream.\n\n\\`version.CheckExact\\` can be specified to enable an Optimistic Concurrency check on append, by using the expected version of the Event Stream prior to appending the new Events.\n\nAlternatively, \\`version.Any\\` can be used if no Optimistic Concurrency check should be carried out.\n\nAn instance of \\`version.ConflictError\\` will be returned if the optimistic locking version check fails against the current version of the Event Stream.\n\n```go\nfunc (es *InMemoryEventStore) Stream(\n\tctx context.Context,\n\teventStream event.StreamWrite,\n\tid event.StreamID,\n\tselector version.Selector,\n) error\n```\nStream streams committed events in the Event Store onto the provided EventStream, from the specified Global Sequence Number in \\`from\\`, based on the provided stream.Target.\n\nNote: this call is synchronous, and will return when all the Events have been successfully written to the provided EventStream, or when the context has been canceled.\n\nThis method fails only when the context is canceled.\n\n```go\ntype TrackingEventStore struct {\n\tevent.Appender\n\t// contains filtered or unexported fields\n}\n```\nTrackingEventStore is an Event Store wrapper to track the Events committed to the inner Event Store.\n\nUseful for tests assertion.\n\n```go\nfunc NewTrackingEventStore(appender event.Appender) *TrackingEventStore\n```\nNewTrackingEventStore wraps an Event Store to capture events that get appended to it.\n\n```go\nfunc (es *TrackingEventStore) Append(\n\tctx context.Context,\n\tid event.StreamID,\n\texpected version.Check,\n\tevents ...event.Envelope,\n) (version.Version, error)\n```\nAppend forwards the call to the wrapped Event Store instance and, if the operation concludes successfully, records these events internally.\n\nThe recorded events can be accessed by calling Recorded().\n\n```go\nfunc (es *TrackingEventStore) Recorded() []event.Persisted\n```\nRecorded returns the list of Events that have been appended to the Event Store.\n\nPlease note: these events do not record the Sequence Number assigned by the Event Store. Usually you should not need it in test assertions, since the order of Events in the returned slice always follows the global order of the Event Stream (or the Event Store).\n\n","path":"github.com/get-eventually/go-eventually/core/test","name":"test","synopsis":"Package test contains some type implementations of core interfaces that are meant to be used in test code only, not in production code.","isRedistributable":true}
