Sha256: 1cf4e1d323cab3f872d8b4a2c9bf34e3f32416c995fe2e8454e795f2476c8fec

Contents?: true

Size: 1016 Bytes

Versions: 4

Compression:

Stored size: 1016 Bytes

Contents

# frozen_string_literal: true

module PgEventstore
  module Commands
    # @!visibility private
    class Read < AbstractCommand
      # @param stream [PgEventstore::Stream]
      # @param options [Hash] request options
      # @option options [String] :direction read direction - 'Forwards' or 'Backwards'
      # @option options [Integer, Symbol] :from_revision. **Use this option when stream name is a normal stream name**
      # @option options [Integer, Symbol] :from_position. **Use this option when reading from "all" stream**
      # @option options [Integer] :max_count
      # @option options [Boolean] :resolve_link_tos
      # @option options [Hash] :filter provide it to filter events
      # @return [Array<PgEventstore::Event>]
      # @raise [PgEventstore::StreamNotFoundError]
      def call(stream, options: {})
        stream = queries.find_stream(stream) || raise(StreamNotFoundError, stream) unless stream.all_stream?

        queries.stream_events(stream, options)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pg_eventstore-0.2.2 lib/pg_eventstore/commands/read.rb
pg_eventstore-0.2.1 lib/pg_eventstore/commands/read.rb
pg_eventstore-0.2.0 lib/pg_eventstore/commands/read.rb
pg_eventstore-0.1.0 lib/pg_eventstore/commands/read.rb