event_store 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
-
2
+ gem 'sequel-vertica', git: 'git@github.com:nexiahome/sequel-vertica.git'
3
3
  # Specify your gem's dependencies in event_store_gem.gemspec
4
4
  gemspec
@@ -40,6 +40,10 @@ module EventStore
40
40
  events.limit(max).where{ version >= version_number.to_i }.all
41
41
  end
42
42
 
43
+ def event_stream
44
+ events.all.map {|e| e[:serialized_event] = EventStore.unescape_bytea(e[:serialized_event]); e}
45
+ end
46
+
43
47
  def last_event
44
48
  snapshot.last
45
49
  end
@@ -44,7 +44,7 @@ module EventStore
44
44
  end
45
45
 
46
46
  def raw_event_stream
47
- @aggregate.events.all
47
+ @aggregate.event_stream
48
48
  end
49
49
 
50
50
  def raw_event_stream_from version_number, max=nil
@@ -81,7 +81,7 @@ module EventStore
81
81
 
82
82
  def translate_event(event_hash)
83
83
  occurred_at = TimeHacker.translate_occurred_at_from_local_to_gmt(event_hash[:occurred_at])
84
- SerializedEvent.new event_hash[:fully_qualified_name], EventStore.unescape_bytea(event_hash[:serialized_event]), event_hash[:version], occurred_at
84
+ SerializedEvent.new event_hash[:fully_qualified_name], event_hash[:serialized_event], event_hash[:version], occurred_at
85
85
  end
86
86
  end
87
87
  end
@@ -1,3 +1,3 @@
1
1
  module EventStore
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
data/lib/event_store.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'sequel'
2
- require 'sequel_core'
2
+ require 'sequel/core'
3
3
  require 'vertica'
4
4
  require 'sequel-vertica'
5
5
  require 'redis'
@@ -92,12 +92,12 @@ module EventStore
92
92
  end
93
93
 
94
94
  def self.escape_bytea(binary_string)
95
- @adapter == 'vertica' ? binary_string : EventStore.db.literal(binary_string.to_sequel_blob)
95
+ @adapter == 'vertica' ? binary_string.unpack('H*').join : EventStore.db.literal(binary_string.to_sequel_blob)
96
96
  end
97
97
 
98
98
  def self.unescape_bytea(binary_string)
99
99
  if @adapter == 'vertica'
100
- binary_string
100
+ [binary_string].pack("H*")
101
101
  else
102
102
  unescaped = Sequel::Postgres::Adapter.unescape_bytea(binary_string)
103
103
  unescaped[0] == "'" && unescaped[-1] == "'" ? unescaped[1...-1] : unescaped #postgres adds an extra set of quotes when you insert it, Redis does not. Therefore we need to pull off the extra quotes if they are there
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-04-06 00:00:00.000000000 Z
13
+ date: 2014-04-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -308,3 +308,4 @@ test_files:
308
308
  - spec/event_store/snapshot_spec.rb
309
309
  - spec/event_store/vertica guy notes.txt
310
310
  - spec/spec_helper.rb
311
+ has_rdoc: