sandthorn_driver_sequel 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f630fef93caacf9055995199725d6914bf803e1
|
4
|
+
data.tar.gz: 27417b647ae625f040cb18eeacd3c73bec62cfc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 172cd39b85fbcb2427fe89b43365baae9794087301bce3f8386e3980a3723764c5fc69eb47f8864f03af4a4d5f5c1ec6315843765b5e45d52f8d708a2fc32bfd
|
7
|
+
data.tar.gz: 8e47be2e0bda11b58190fa0e405cb4f4c65488ea87d8ab7712f6e55996880069a9c5beefe2c27abb5ca3929fbf078b27ec87d384a11a01673dfb4c67b2fedc86
|
@@ -32,7 +32,8 @@ module SandthornDriverSequel
|
|
32
32
|
error_message = "#{aggregate_type} with id #{aggregate_id}: expected event with version #{current_aggregate_version}, but got #{event[:aggregate_version]}"
|
33
33
|
raise SandthornDriverSequel::Errors::ConcurrencyError.new(error_message)
|
34
34
|
end
|
35
|
-
|
35
|
+
blob = event[:event_data].nil? ? nil : Sequel.blob(event[:event_data])
|
36
|
+
to_insert = {aggregate_table_id: pk_id, aggregate_version: event[:aggregate_version], event_name: event[:event_name], event_data: blob, timestamp: timestamp}
|
36
37
|
db[events_table_name].insert(to_insert)
|
37
38
|
end
|
38
39
|
db[aggregates_table_name].where(id: pk_id).update(aggregate_version: current_aggregate_version)
|
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency "autotest-standalone"
|
31
31
|
spec.add_development_dependency "uuidtools"
|
32
32
|
spec.add_development_dependency "ruby-beautify"
|
33
|
+
spec.add_development_dependency "msgpack"
|
33
34
|
|
34
35
|
spec.add_runtime_dependency "sequel"
|
35
36
|
spec.add_runtime_dependency "pg"
|
data/spec/saving_events_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'msgpack'
|
2
3
|
|
3
4
|
module SandthornDriverSequel
|
4
5
|
describe EventStore do
|
@@ -67,5 +68,20 @@ module SandthornDriverSequel
|
|
67
68
|
ids.any? { |e| e == aggregate_id_3 }.should be_true
|
68
69
|
end
|
69
70
|
end
|
71
|
+
context "when saving events that are serilized with msgpack" do
|
72
|
+
let(:test_data) { {name: "test", hash: {t: 123}} }
|
73
|
+
let(:test_events) do
|
74
|
+
e = []
|
75
|
+
data = MessagePack.pack(test_data, symbolize_keys: true)
|
76
|
+
e << {aggregate_version: 1, event_name: "new", event_args: nil, event_data: data}
|
77
|
+
end
|
78
|
+
let(:aggregate_id_1) {"c0456e26-e29a-4f67-92fa-130b3a31a39a"}
|
79
|
+
it "should save and get events that are serilized with msgpack" do
|
80
|
+
event_store.save_events test_events, 0, aggregate_id_1, String
|
81
|
+
events = event_store.get_aggregate aggregate_id_1, String
|
82
|
+
expect(MessagePack.unpack(events.first[:event_data], symbolize_keys: true)).to eql test_data
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
70
86
|
end
|
71
87
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sandthorn_driver_sequel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lars Krantz
|
@@ -165,6 +165,20 @@ dependencies:
|
|
165
165
|
- - ">="
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '0'
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
name: msgpack
|
170
|
+
requirement: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
type: :development
|
176
|
+
prerelease: false
|
177
|
+
version_requirements: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - ">="
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
168
182
|
- !ruby/object:Gem::Dependency
|
169
183
|
name: sequel
|
170
184
|
requirement: !ruby/object:Gem::Requirement
|
@@ -218,7 +232,6 @@ files:
|
|
218
232
|
- lib/sandthorn_driver_sequel/version.rb
|
219
233
|
- sandthorn_driver_sequel.gemspec
|
220
234
|
- spec/asking_for_aggregates_to_snapshot_spec.rb
|
221
|
-
- spec/db/event_store.sqlite3
|
222
235
|
- spec/driver_interface_spec.rb
|
223
236
|
- spec/event_store_with_context_spec.rb
|
224
237
|
- spec/get_events_spec.rb
|
@@ -252,7 +265,6 @@ specification_version: 4
|
|
252
265
|
summary: sequel driver for sandthorn
|
253
266
|
test_files:
|
254
267
|
- spec/asking_for_aggregates_to_snapshot_spec.rb
|
255
|
-
- spec/db/event_store.sqlite3
|
256
268
|
- spec/driver_interface_spec.rb
|
257
269
|
- spec/event_store_with_context_spec.rb
|
258
270
|
- spec/get_events_spec.rb
|
data/spec/db/event_store.sqlite3
DELETED
Binary file
|