Sha256: df2b83bc02da1d807739904e71f0647fe9347105794a2bc971559bd767157038

Contents?: true

Size: 750 Bytes

Versions: 8

Compression:

Stored size: 750 Bytes

Contents

module Euston
  module EventStore
    module Persistence
      module Mongodb
        module MongoSnapshot
          extend ::ActiveSupport::Concern

          class << self
            def from_hash(hash)
              return nil if hash.nil?

              id = hash['_id']

              Euston::EventStore::Snapshot.new id['stream_id'], id['stream_revision'], hash['payload']
            end
          end

          def to_hash
            {
              :_id => { :stream_id => stream_id, :stream_revision => stream_revision },
              :payload => payload.recursive_stringify_symbol_values!
            }
          end
        end
      end
    end

    class Snapshot
      include Persistence::Mongodb::MongoSnapshot
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
euston-eventstore-1.0.4-java lib/euston-eventstore/persistence/mongodb/mongo_snapshot.rb
euston-eventstore-1.0.4 lib/euston-eventstore/persistence/mongodb/mongo_snapshot.rb
euston-eventstore-1.0.3-java lib/euston-eventstore/persistence/mongodb/mongo_snapshot.rb
euston-eventstore-1.0.3 lib/euston-eventstore/persistence/mongodb/mongo_snapshot.rb
euston-eventstore-1.0.2-java lib/euston-eventstore/persistence/mongodb/mongo_snapshot.rb
euston-eventstore-1.0.2 lib/euston-eventstore/persistence/mongodb/mongo_snapshot.rb
euston-eventstore-1.0.1 lib/euston-eventstore/persistence/mongodb/mongo_snapshot.rb
euston-eventstore-1.0.0 lib/euston-eventstore/persistence/mongodb/mongo_snapshot.rb