foobara-redis-crud-driver 0.0.2 → 0.0.4

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: cf25e77a560d2155ab62beddc8978dd3be7a4e2d184778b481a5625b11975de9
4
- data.tar.gz: 9d4cce268a25c90f861fc65610e206132bf8bf4417b96afc29402876adda089e
3
+ metadata.gz: e8a81120a1e087040686a18fb873d84b701d578708b59cb14d6c842206f56d3e
4
+ data.tar.gz: 35ef909f9222826cc36bc73e585f91d54235b4ff10dae6cb3c6182c85982d96a
5
5
  SHA512:
6
- metadata.gz: 9497e3b3d2b1eeb114cf53e9ec5c74982d7b3697014d07611c4fea882d1ce57b285286be1bf289675ada22b2b3650cc8448e9689a16d0a9dd5518d9d345689ff
7
- data.tar.gz: 98f10f54a9b69b77673478e850eaa4745f6b86927a724648f8c8b61a56cf2697e499d8f30d4b28d06067bde5f67afbe72a10404efa5a3442eba2c4a104bc109f
6
+ metadata.gz: 60fa11bed5950a363f2a08bf3e789175c012b24614703cb82a70bde0ec63ab8f115323e79f6b4de93ad9b0f357220774ca6ca50d96f47b0b1928358587c7e4ef
7
+ data.tar.gz: 385faf75c6a4a8de419ab96eec05c995cd90acd96a649da7afdd5cfd7c683bc4138b35e39c1954fe9a48e28cfe073b68ba08df3cdfb9176b31f43efc3eeda02d
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.2
1
+ 3.4.1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [0.0.4] - 2025-01-07
2
+
3
+ - Bump Ruby to 3.4.1
4
+
5
+ ## [0.0.3] - 2024-11-30
6
+
7
+ - Make use of default crud driver methods
8
+
1
9
  ## [0.0.2] - 2024-11-22
2
10
 
3
11
  - Make sure JSON is available
@@ -38,22 +38,6 @@ module Foobara
38
38
  end
39
39
  end
40
40
 
41
- # We don't make use of Redis transaction feature here because they are do not really work
42
- # like database transactions which is what this feature is based on. We might want to use database transactions
43
- # in some sort of flush feature though.
44
- def open_transaction
45
- # Should we have some kind of fake transaction object that raises errors when used after rolledback/closed?
46
- Object.new
47
- end
48
-
49
- def close_transaction(_raw_tx)
50
- end
51
-
52
- def rollback_transaction(_raw_tx)
53
- # nothing to do... except maybe enter a state where we don't flush anything else
54
- # but can just rely on higher-up plumbing for that
55
- end
56
-
57
41
  class Table < Persistence::EntityAttributesCrudDriver::Table
58
42
  def initialize(...)
59
43
  super
@@ -67,30 +51,10 @@ module Foobara
67
51
  end
68
52
  end
69
53
 
70
- def prefix
71
- crud_driver.prefix
72
- end
73
-
74
54
  def get_id
75
55
  redis.incr(sequence_key)
76
56
  end
77
57
 
78
- def sequence_key
79
- @sequence_key ||= "#{entity_key_prefix}$sequence"
80
- end
81
-
82
- def primary_keys_index_key
83
- @primary_keys_index_key ||= "#{entity_key_prefix}$all"
84
- end
85
-
86
- def entity_key_prefix
87
- @entity_key_prefix ||= [*prefix, table_name].join(":")
88
- end
89
-
90
- def record_key_prefix(record_id)
91
- "#{entity_key_prefix}:#{record_id}"
92
- end
93
-
94
58
  def all
95
59
  Enumerator.new do |yielder|
96
60
  batches_of_primary_keys.each do |batch|
@@ -119,6 +83,7 @@ module Foobara
119
83
  end
120
84
  end
121
85
 
86
+ # TODO: move this up to base class as a default
122
87
  def find!(record_id)
123
88
  attributes = find(record_id)
124
89
 
@@ -198,6 +163,26 @@ module Foobara
198
163
 
199
164
  private
200
165
 
166
+ def prefix
167
+ crud_driver.prefix
168
+ end
169
+
170
+ def sequence_key
171
+ @sequence_key ||= "#{entity_key_prefix}$sequence"
172
+ end
173
+
174
+ def primary_keys_index_key
175
+ @primary_keys_index_key ||= "#{entity_key_prefix}$all"
176
+ end
177
+
178
+ def entity_key_prefix
179
+ @entity_key_prefix ||= [*prefix, table_name].join(":")
180
+ end
181
+
182
+ def record_key_prefix(record_id)
183
+ "#{entity_key_prefix}:#{record_id}"
184
+ end
185
+
201
186
  def redis
202
187
  raw_connection
203
188
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara-redis-crud-driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-11-23 00:00:00.000000000 Z
10
+ date: 2025-01-07 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: foobara
@@ -60,7 +59,6 @@ metadata:
60
59
  source_code_uri: https://github.com/foobara/redis-crud-driver
61
60
  changelog_uri: https://github.com/foobara/redis-crud-driver/blob/main/CHANGELOG.md
62
61
  rubygems_mfa_required: 'true'
63
- post_install_message:
64
62
  rdoc_options: []
65
63
  require_paths:
66
64
  - lib
@@ -69,15 +67,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
69
67
  requirements:
70
68
  - - ">="
71
69
  - !ruby/object:Gem::Version
72
- version: 3.2.2
70
+ version: 3.4.0
73
71
  required_rubygems_version: !ruby/object:Gem::Requirement
74
72
  requirements:
75
73
  - - ">="
76
74
  - !ruby/object:Gem::Version
77
75
  version: '0'
78
76
  requirements: []
79
- rubygems_version: 3.5.23
80
- signing_key:
77
+ rubygems_version: 3.6.2
81
78
  specification_version: 4
82
79
  summary: Provides support for entity CRUD in Redis for Foobara
83
80
  test_files: []