ruby_event_store-active_record 2.8.0 → 2.9.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0104d3bbcbf407a2c08ab36e92eae47e0b77051ea1e86f88d9d0f3af8a6ad34d
4
- data.tar.gz: 0f3f118e8f685735c6f50f1ab2c9d389f539ca3695507192136f4d279c8fec57
3
+ metadata.gz: b42559ca51848ea6e388b9cfe5a73c9058691a4a2281000c6ba0da5f3899a40e
4
+ data.tar.gz: 17440ba2550814acb3bc4d0a9522570783ab21306c318dac218b85d98065f1e2
5
5
  SHA512:
6
- metadata.gz: 042f8d47fe357e87f643a1748f76b675f2ec098a7e105037b998f71e3192d28d801d6f67fd09c4e6902240f7841d882a2aaea58d0570cb87f5fcc9b35458e6c2
7
- data.tar.gz: 48bbdf33832cbec83891c5466483e284029042a87b6809913ee5f2c89ae980a5006bf1285ba69c6f25bb8686f820a00542160ff49ca22a478634a5b83127a08b
6
+ metadata.gz: 2870b19f168fd7730a9e3a1ab4cdfe7ec8d4c1ff3b9bda2d6f9a2f4a769a9e4c54f4fe85149525c1b4d5ee950151f01276fb17a079c1f1fd09753008dc80b3f7
7
+ data.tar.gz: 5c72abb8e403fb1e2a2f387943c04de84992ce7e6517feb0a457e949ef0c9b74eb3d6aabd60f2e7e15d85772b925e6a6e8c5e2ea5a65f66606460f881680a4d1
@@ -163,20 +163,28 @@ module RubyEventStore
163
163
  )
164
164
  end
165
165
 
166
+ def time_comparison_field(specification)
167
+ if specification.time_sort_by_as_of?
168
+ "COALESCE(#{@event_klass.table_name}.valid_at, #{@event_klass.table_name}.created_at)"
169
+ else
170
+ "#{@event_klass.table_name}.created_at"
171
+ end
172
+ end
173
+
166
174
  def older_than_condition(specification)
167
- ["#{@event_klass.table_name}.created_at < ?", specification.older_than]
175
+ ["#{time_comparison_field(specification)} < ?", specification.older_than]
168
176
  end
169
177
 
170
178
  def older_than_or_equal_condition(specification)
171
- ["#{@event_klass.table_name}.created_at <= ?", specification.older_than_or_equal]
179
+ ["#{time_comparison_field(specification)} <= ?", specification.older_than_or_equal]
172
180
  end
173
181
 
174
182
  def newer_than_condition(specification)
175
- ["#{@event_klass.table_name}.created_at > ?", specification.newer_than]
183
+ ["#{time_comparison_field(specification)} > ?", specification.newer_than]
176
184
  end
177
185
 
178
186
  def newer_than_or_equal_condition(specification)
179
- ["#{@event_klass.table_name}.created_at >= ?", specification.newer_than_or_equal]
187
+ ["#{time_comparison_field(specification)} >= ?", specification.newer_than_or_equal]
180
188
  end
181
189
 
182
190
  def order(spec)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RubyEventStore
4
4
  module ActiveRecord
5
- VERSION = "2.8.0"
5
+ VERSION = "2.9.0"
6
6
  end
7
7
  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.8.0
4
+ version: 2.9.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-01-13 00:00:00.000000000 Z
11
+ date: 2023-01-24 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.8.0
19
+ version: 2.9.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.8.0
26
+ version: 2.9.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement