ruby_event_store-active_record 2.12.1 → 2.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruby_event_store/active_record/batch_enumerator.rb +2 -2
- data/lib/ruby_event_store/active_record/event_repository_reader.rb +1 -1
- data/lib/ruby_event_store/active_record/generators/database_adapter.rb +11 -12
- data/lib/ruby_event_store/active_record/generators/foreign_key_on_event_id_migration_generator.rb +0 -4
- data/lib/ruby_event_store/active_record/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 844a72fb4397a85af4951552a503d02f3f46fee88add52b3d4da559da0a578e1
|
4
|
+
data.tar.gz: c09cd8f7af18e4b3a276c09efa2a31f4e3ee5e62d29394f7022ab83ab7763ae5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 523f386852a08972217416c04335113e99f8c9bbe167100aed3035bc39e866f83d4cafb59d270ef314fbe974f2e1f23090479407eabe6bb44cf39382e0e953a8
|
7
|
+
data.tar.gz: a1974be5b9e5fe233e9dc27f23e98b4140bc51dced795a61f1cfc714d3af959c6fc6a5da40fd6c5cd508f408fa5a24b2840e7e06a435807c981cd2887ba9133c
|
@@ -17,8 +17,8 @@ module RubyEventStore
|
|
17
17
|
batch_limit = [batch_size, total_limit - batch_offset].min
|
18
18
|
results, offset_id = reader.call(offset_id, batch_limit)
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
yield results if results.any?
|
21
|
+
break if results.size < batch_size
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -96,7 +96,7 @@ module RubyEventStore
|
|
96
96
|
stream = stream.where(newer_than_or_equal_condition(spec)) if spec.newer_than_or_equal
|
97
97
|
stream.order(id: order(spec))
|
98
98
|
else
|
99
|
-
stream = @stream_klass.
|
99
|
+
stream = @stream_klass.includes(:event).where(stream: spec.stream.name)
|
100
100
|
stream = stream.where(event_id: spec.with_ids) if spec.with_ids?
|
101
101
|
stream = stream.joins(:event).where(@event_klass.table_name => { event_type: spec.with_types }) if spec.with_types?
|
102
102
|
stream = stream.joins(:event).order(as_at(spec)) if spec.time_sort_by_as_at?
|
@@ -6,13 +6,13 @@ module RubyEventStore
|
|
6
6
|
InvalidDataTypeForAdapter = Class.new(StandardError)
|
7
7
|
|
8
8
|
class DatabaseAdapter
|
9
|
-
|
9
|
+
NONE = Object.new.freeze
|
10
10
|
|
11
11
|
class PostgreSQL < self
|
12
12
|
SUPPORTED_DATA_TYPES = %w[binary json jsonb].freeze
|
13
13
|
|
14
|
-
def
|
15
|
-
|
14
|
+
def adapter_name
|
15
|
+
"postgresql"
|
16
16
|
end
|
17
17
|
|
18
18
|
def template_directory
|
@@ -23,8 +23,8 @@ module RubyEventStore
|
|
23
23
|
class MySQL < self
|
24
24
|
SUPPORTED_DATA_TYPES = %w[binary json].freeze
|
25
25
|
|
26
|
-
def
|
27
|
-
|
26
|
+
def adapter_name
|
27
|
+
"mysql2"
|
28
28
|
end
|
29
29
|
|
30
30
|
def template_directory
|
@@ -35,21 +35,20 @@ module RubyEventStore
|
|
35
35
|
class SQLite < self
|
36
36
|
SUPPORTED_DATA_TYPES = %w[binary].freeze
|
37
37
|
|
38
|
-
def
|
39
|
-
|
38
|
+
def adapter_name
|
39
|
+
"sqlite"
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
def initialize(
|
43
|
+
def initialize(data_type = NONE)
|
44
44
|
raise UnsupportedAdapter if instance_of?(DatabaseAdapter)
|
45
45
|
|
46
46
|
validate_data_type!(data_type)
|
47
47
|
|
48
|
-
@adapter_name = adapter_name
|
49
48
|
@data_type = data_type
|
50
49
|
end
|
51
50
|
|
52
|
-
attr_reader :
|
51
|
+
attr_reader :data_type
|
53
52
|
|
54
53
|
def supported_data_types
|
55
54
|
self.class::SUPPORTED_DATA_TYPES
|
@@ -68,7 +67,7 @@ module RubyEventStore
|
|
68
67
|
def template_directory
|
69
68
|
end
|
70
69
|
|
71
|
-
def self.from_string(adapter_name, data_type =
|
70
|
+
def self.from_string(adapter_name, data_type = NONE)
|
72
71
|
raise NoMethodError unless eql?(DatabaseAdapter)
|
73
72
|
|
74
73
|
case adapter_name.to_s.downcase
|
@@ -86,7 +85,7 @@ module RubyEventStore
|
|
86
85
|
private
|
87
86
|
|
88
87
|
def validate_data_type!(data_type)
|
89
|
-
if !data_type.eql?(
|
88
|
+
if !data_type.eql?(NONE) && !supported_data_types.include?(data_type)
|
90
89
|
raise InvalidDataTypeForAdapter,
|
91
90
|
"#{class_name} doesn't support #{data_type.inspect}. Supported types are: #{supported_data_types.join(", ")}."
|
92
91
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_event_store-active_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arkency
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-07 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: 2.
|
19
|
+
version: 2.13.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: 2.
|
26
|
+
version: 2.13.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activerecord
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|