Sha256: 394b0f684266955e828fa3a72c45fff8bccfc582b22b3c993f4f3581b92ab06c

Contents?: true

Size: 702 Bytes

Versions: 19

Compression:

Stored size: 702 Bytes

Contents

# frozen_string_literal: true

module PgEventstore
  module Commands
    module EventModifiers
      # Defines how to transform regular event before appending it to the stream
      # @!visibility private
      class PrepareRegularEvent
        # @param event [PgEventstore::Event]
        # @param revision [Integer]
        # @return [PgEventstore::Event]
        def call(event, revision)
          event.class.new(
            id: event.id, data: event.data, metadata: event.metadata, type: event.type, stream_revision: revision
          ).tap do |e|
            %i[link_id link_partition_id stream_revision].each { |attr| e.readonly!(attr) }
          end
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
pg_eventstore-1.7.0 lib/pg_eventstore/commands/event_modifiers/prepare_regular_event.rb
pg_eventstore-1.6.0 lib/pg_eventstore/commands/event_modifiers/prepare_regular_event.rb
pg_eventstore-1.5.0 lib/pg_eventstore/commands/event_modifiers/prepare_regular_event.rb
pg_eventstore-1.4.0 lib/pg_eventstore/commands/event_modifiers/prepare_regular_event.rb
pg_eventstore-1.3.4 lib/pg_eventstore/commands/event_modifiers/prepare_regular_event.rb
pg_eventstore-1.3.3 lib/pg_eventstore/commands/event_modifiers/prepare_regular_event.rb
pg_eventstore-1.3.2 lib/pg_eventstore/commands/event_modifiers/prepare_regular_event.rb
pg_eventstore-1.3.1 lib/pg_eventstore/commands/event_modifiers/prepare_regular_event.rb
pg_eventstore-1.3.0 lib/pg_eventstore/commands/event_modifiers/prepare_regular_event.rb
pg_eventstore-1.2.0 lib/pg_eventstore/commands/event_modifiers/prepare_regular_event.rb
pg_eventstore-1.1.5 lib/pg_eventstore/commands/event_modifiers/prepare_regular_event.rb
pg_eventstore-1.1.4 lib/pg_eventstore/commands/event_modifiers/prepare_regular_event.rb
pg_eventstore-1.1.3 lib/pg_eventstore/commands/event_modifiers/prepare_regular_event.rb
pg_eventstore-1.1.2 lib/pg_eventstore/commands/event_modifiers/prepare_regular_event.rb
pg_eventstore-1.1.1 lib/pg_eventstore/commands/event_modifiers/prepare_regular_event.rb
pg_eventstore-1.1.0 lib/pg_eventstore/commands/event_modifiers/prepare_regular_event.rb
pg_eventstore-1.0.4 lib/pg_eventstore/commands/event_modifiers/prepare_regular_event.rb
pg_eventstore-1.0.0.rc2 lib/pg_eventstore/commands/event_modifiers/prepare_regular_event.rb
pg_eventstore-1.0.0.rc1 lib/pg_eventstore/commands/event_modifiers/prepare_regular_event.rb