NAME

EventStore::Tiny::EventStream

REFERENCE

EventStore::Tiny::Stream implements the following attributes and methods.

events

my $event17 = $stream->events->[16];

Internal list representation (arrayref) of all events of this stream.

add_event

$stream->add_event($event);

Adds an event to the stream.

size

my $event_count = $stream->size;

Returns the number of events in this stream.

first_timestamp

my $start_ts = $stream->first_timestamp;

Returns the timestamp of the first event of this stream.

last_timestamp

my $end_ts = $stream->last_timestamp;

Returns the timestamp of the last event of this stream.

apply_to

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.

substream

my $filtered = $stream->substream(sub ($event) {
    return we_want($event);
});

Creates a substream using a given filter. All events the given subref returns true for are selected for this substream.

before

my $pre_stream = $stream->before($timestamp);

Returns a substream with all events before or at the same time of a given timestamp.

after

my $post_stream = $stream->after($timestamp);

Returns a substream with all events after a given timestamp.

SEE ALSO

EventStore::Tiny

COPYRIGHT AND LICENSE

Copyright (c) 2018-2021 Mirko Westermeier (mail: mirko@westermeier.de)

Released under the MIT License (see LICENSE.txt for details).