rails_event_store_active_record 0.6.7 → 0.6.8
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: 0cec1f2b02acf358bf64453d63885163942ad521
|
4
|
+
data.tar.gz: e278d30e2f9ad0f2610ba25257fda6d02aa1fb02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4b2034109c8199e5da08aa8e8ce132393252b21112a3d72eb492d7ea5a1b70b15d6979edad285f729d42110d5ac1bec30041b7aa2c261e3d409761dae5107a6
|
7
|
+
data.tar.gz: a2b8a035bdcbdcf30c0ad81a08c56856ecbf74a363eeee5c257ff916effb36cb210c6399681a76f19c5d3e8a632dce86113fe96d2cb2eb98dc05d15b4278e0c5
|
data/CHANGELOG.md
CHANGED
data/Makefile
CHANGED
@@ -10,7 +10,7 @@ test: ## Run tests
|
|
10
10
|
|
11
11
|
mutate: test ## Run mutation tests
|
12
12
|
@echo "Running mutation tests - only 100% free mutation will be accepted"
|
13
|
-
@bundle exec mutant --include lib --require ruby_event_store --use rspec "RailsEventStoreActiveRecord*"
|
13
|
+
@bundle exec mutant --include lib --require ruby_event_store --use rspec "RailsEventStoreActiveRecord*"
|
14
14
|
|
15
15
|
.PHONY: help
|
16
16
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module RailsEventStoreActiveRecord
|
2
2
|
class EventRepository
|
3
|
-
def initialize(adapter:
|
3
|
+
def initialize(adapter: Event)
|
4
4
|
@adapter = adapter
|
5
5
|
end
|
6
6
|
attr_reader :adapter
|
7
7
|
|
8
8
|
def create(event, stream_name)
|
9
|
-
data = event.to_h.merge!(stream: stream_name, event_type: event.class
|
9
|
+
data = event.to_h.merge!(stream: stream_name, event_type: event.class)
|
10
10
|
adapter.create(data)
|
11
11
|
event
|
12
12
|
end
|
@@ -14,7 +14,6 @@ module RailsEventStoreActiveRecord
|
|
14
14
|
def delete_stream(stream_name)
|
15
15
|
condition = {stream: stream_name}
|
16
16
|
adapter.destroy_all condition
|
17
|
-
nil
|
18
17
|
end
|
19
18
|
|
20
19
|
def has_event?(event_id)
|
@@ -25,18 +24,14 @@ module RailsEventStoreActiveRecord
|
|
25
24
|
build_event_entity(adapter.where(stream: stream_name).last)
|
26
25
|
end
|
27
26
|
|
28
|
-
def get_all_events
|
29
|
-
adapter.order('id ASC').order('stream').all.map(&method(:build_event_entity))
|
30
|
-
end
|
31
|
-
|
32
27
|
def read_events_forward(stream_name, start_event_id, count)
|
33
28
|
stream = adapter.where(stream: stream_name)
|
34
29
|
unless start_event_id.equal?(:head)
|
35
30
|
starting_event = adapter.find_by(event_id: start_event_id)
|
36
|
-
stream = stream.where('id > ?', starting_event
|
31
|
+
stream = stream.where('id > ?', starting_event)
|
37
32
|
end
|
38
33
|
|
39
|
-
stream.
|
34
|
+
stream.limit(count)
|
40
35
|
.map(&method(:build_event_entity))
|
41
36
|
end
|
42
37
|
|
@@ -44,7 +39,7 @@ module RailsEventStoreActiveRecord
|
|
44
39
|
stream = adapter.where(stream: stream_name)
|
45
40
|
unless start_event_id.equal?(:head)
|
46
41
|
starting_event = adapter.find_by(event_id: start_event_id)
|
47
|
-
stream = stream.where('id < ?', starting_event
|
42
|
+
stream = stream.where('id < ?', starting_event)
|
48
43
|
end
|
49
44
|
|
50
45
|
stream.order('id DESC').limit(count)
|
@@ -52,7 +47,7 @@ module RailsEventStoreActiveRecord
|
|
52
47
|
end
|
53
48
|
|
54
49
|
def read_stream_events_forward(stream_name)
|
55
|
-
adapter.where(stream: stream_name)
|
50
|
+
adapter.where(stream: stream_name)
|
56
51
|
.map(&method(:build_event_entity))
|
57
52
|
end
|
58
53
|
|
@@ -65,10 +60,10 @@ module RailsEventStoreActiveRecord
|
|
65
60
|
stream = adapter
|
66
61
|
unless start_event_id.equal?(:head)
|
67
62
|
starting_event = adapter.find_by(event_id: start_event_id)
|
68
|
-
stream = stream.where('id > ?', starting_event
|
63
|
+
stream = stream.where('id > ?', starting_event)
|
69
64
|
end
|
70
65
|
|
71
|
-
stream.
|
66
|
+
stream.limit(count)
|
72
67
|
.map(&method(:build_event_entity))
|
73
68
|
end
|
74
69
|
|
@@ -76,7 +71,7 @@ module RailsEventStoreActiveRecord
|
|
76
71
|
stream = adapter
|
77
72
|
unless start_event_id.equal?(:head)
|
78
73
|
starting_event = adapter.find_by(event_id: start_event_id)
|
79
|
-
stream = stream.where('id < ?', starting_event
|
74
|
+
stream = stream.where('id < ?', starting_event)
|
80
75
|
end
|
81
76
|
|
82
77
|
stream.order('id DESC').limit(count)
|
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_development_dependency 'rails', '~> 4.2'
|
27
27
|
spec.add_development_dependency 'sqlite3'
|
28
28
|
|
29
|
-
spec.add_dependency 'ruby_event_store', '~> 0.12.
|
29
|
+
spec.add_dependency 'ruby_event_store', '~> 0.12.1'
|
30
30
|
spec.add_dependency 'activesupport', '>= 3.0'
|
31
31
|
spec.add_dependency 'activemodel', '>= 3.0'
|
32
32
|
spec.add_development_dependency 'mutant-rspec', '~> 0.8'
|
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.6.
|
4
|
+
version: 0.6.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arkency
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.12.
|
103
|
+
version: 0.12.1
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.12.
|
110
|
+
version: 0.12.1
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: activesupport
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|