rails_event_store_active_record 0.36.0 → 0.37.0
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0ab57886513b2d851e3f1a3dd245d5a5b56b6f6bc904093d168808b2edd4113
|
4
|
+
data.tar.gz: 0ccd5a20a64dd73e25c5c1f0fc304649b2b0f57601c768db59e7dc4c47e626bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c9d699980582f08680bf71b824b0bfcc9d9c37c9c3ab7aea32a98bebec34d51725dea3f931bef04392ebf801b70d0ddf8d361b20fca7e8a7782a18c7e474d57
|
7
|
+
data.tar.gz: 9ce0d3dc5d62dabc6443c91e187b0467c112ff3c389e19b6158f3e51b7d507acdddcaa81b54e3cd79476681eb52b9c87d3f3f750d499c401b90dc291e967d335
|
@@ -11,17 +11,18 @@ module RailsEventStoreActiveRecord
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def append_to_stream(events, stream, expected_version)
|
14
|
-
add_to_stream(
|
14
|
+
add_to_stream(Array(events), stream, expected_version, true) do |event|
|
15
15
|
build_event_record(event).save!
|
16
16
|
event.event_id
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
def link_to_stream(event_ids, stream, expected_version)
|
21
|
-
|
21
|
+
event_ids = Array(event_ids)
|
22
|
+
(event_ids - Event.where(id: event_ids).pluck(:id)).each do |id|
|
22
23
|
raise RubyEventStore::EventNotFound.new(id)
|
23
24
|
end
|
24
|
-
add_to_stream(
|
25
|
+
add_to_stream(event_ids, stream, expected_version, nil) do |event_id|
|
25
26
|
event_id
|
26
27
|
end
|
27
28
|
end
|
@@ -121,11 +122,6 @@ module RailsEventStoreActiveRecord
|
|
121
122
|
)
|
122
123
|
end
|
123
124
|
|
124
|
-
def normalize_to_array(events)
|
125
|
-
return events if events.is_a?(Enumerable)
|
126
|
-
[events]
|
127
|
-
end
|
128
|
-
|
129
125
|
def verify_correct_schema_present
|
130
126
|
CorrectSchemaVerifier.new.verify
|
131
127
|
end
|
@@ -44,6 +44,7 @@ module RailsEventStoreActiveRecord
|
|
44
44
|
stream = stream.order(position: order(spec)) unless spec.stream.global?
|
45
45
|
stream = stream.limit(spec.limit) if spec.limit?
|
46
46
|
stream = stream.where(start_condition(spec)) unless spec.head?
|
47
|
+
stream = stream.where(stop_condition(spec)) if spec.stop
|
47
48
|
stream = stream.order(id: order(spec))
|
48
49
|
stream
|
49
50
|
end
|
@@ -59,6 +60,13 @@ module RailsEventStoreActiveRecord
|
|
59
60
|
[condition, event_record]
|
60
61
|
end
|
61
62
|
|
63
|
+
def stop_condition(specification)
|
64
|
+
event_record =
|
65
|
+
EventInStream.find_by!(event_id: specification.stop, stream: normalize_stream_name(specification))
|
66
|
+
condition = specification.forward? ? 'event_store_events_in_streams.id < ?' : 'event_store_events_in_streams.id > ?'
|
67
|
+
[condition, event_record]
|
68
|
+
end
|
69
|
+
|
62
70
|
def order(spec)
|
63
71
|
spec.forward? ? 'ASC' : 'DESC'
|
64
72
|
end
|
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
26
|
spec.require_paths = ['lib']
|
27
27
|
|
28
|
-
spec.add_dependency 'ruby_event_store', '= 0.
|
28
|
+
spec.add_dependency 'ruby_event_store', '= 0.37.0'
|
29
29
|
spec.add_dependency 'activesupport', '>= 3.0'
|
30
30
|
spec.add_dependency 'activemodel', '>= 3.0'
|
31
31
|
spec.add_dependency 'activerecord-import', '~> 0.21'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_event_store_active_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.37.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arkency
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby_event_store
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.37.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.37.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,7 +120,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
- !ruby/object:Gem::Version
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
|
-
|
123
|
+
rubyforge_project:
|
124
|
+
rubygems_version: 2.7.6
|
124
125
|
signing_key:
|
125
126
|
specification_version: 4
|
126
127
|
summary: Active Record events repository for Rails Event Store
|