EventStore::Tiny::EventStream
EventStore::Tiny::Stream implements the following attributes and methods.
my $event17 = $stream->events->[16];
Internal list representation (arrayref) of all events of this stream.
$stream->add_event($event);
Adds an event to the stream.
my $event_count = $stream->size;
Returns the number of events in this stream.
my $start_ts = $stream->first_timestamp;
Returns the timestamp of the first event of this stream.
my $end_ts = $stream->last_timestamp;
Returns the timestamp of the last event of this stream.
my $state = $stream->apply_to(\%state);
Applies the whole stream (all events one after another) to a given state (by default an empty hash). The state is changed by side-effect but is also returned.
my $filtered = $stream->substream(sub { my $event = shift; return we_want($event); });
Creates a substream using a given filter. All events the given subref returns true for are selected for this substream.
my $pre_stream = $stream->before($timestamp);
Returns a substream with all events before or at the same time of a given timestamp.
my $post_stream = $stream->after($timestamp);
Returns a substream with all events after a given timestamp.
EventStore::Tiny
Copyright (c) 2018 Mirko Westermeier (mail: mirko@westermeier.de)
Released under the MIT License (see LICENSE.txt for details).
To install EventStore::Tiny, copy and paste the appropriate command in to your terminal.
cpanm
cpanm EventStore::Tiny
CPAN shell
perl -MCPAN -e shell install EventStore::Tiny
For more information on module installation, please visit the detailed CPAN module installation guide.