switchman 3.5.20 → 3.5.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/switchman/active_record/calculations.rb +39 -0
- data/lib/switchman/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1aea9491a7cf89144f7952499f7194d6a5e975959298300c308e7ff7d5d23137
|
4
|
+
data.tar.gz: 62d4da92da4c56faa42681cfeed6f41d41a0dd004ded08501093036167d7f0c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b53e691f7bb0f31814133f17d0344538e193e13559bb5ffc2c9355dd5cadab146341f750d0588daf0c38b33c1a65be866ef3064f0162365050c0a875a48bf4ea
|
7
|
+
data.tar.gz: 43eec8da243a69a386e3873208ac1d7d511ac703c44fce3c4bbb0c8efc000d59aafc9b9112c2874de8aaf698c5c4590bda5af48345d35d669422a794c93386f8
|
@@ -106,6 +106,45 @@ module Switchman
|
|
106
106
|
compact_grouped_calculation_rows(rows, opts)
|
107
107
|
end
|
108
108
|
|
109
|
+
if ::Rails.version >= "7.1"
|
110
|
+
def ids
|
111
|
+
return super unless klass.sharded_primary_key?
|
112
|
+
|
113
|
+
if loaded?
|
114
|
+
result = records.map do |record|
|
115
|
+
Shard.relative_id_for(record._read_attribute(primary_key),
|
116
|
+
record.shard,
|
117
|
+
Shard.current(klass.connection_class_for_self))
|
118
|
+
end
|
119
|
+
return @async ? Promise::Complete.new(result) : result
|
120
|
+
end
|
121
|
+
|
122
|
+
if has_include?(primary_key)
|
123
|
+
relation = apply_join_dependency.group(primary_key)
|
124
|
+
return relation.ids
|
125
|
+
end
|
126
|
+
|
127
|
+
columns = arel_columns([primary_key])
|
128
|
+
base_shard = Shard.current(klass.connection_class_for_self)
|
129
|
+
activate do |r|
|
130
|
+
relation = r.spawn
|
131
|
+
relation.select_values = columns
|
132
|
+
|
133
|
+
result = if relation.where_clause.contradiction?
|
134
|
+
ActiveRecord::Result.empty
|
135
|
+
else
|
136
|
+
skip_query_cache_if_necessary do
|
137
|
+
klass.connection.select_all(relation, "#{klass.name} Ids", async: @async)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
result.then do |res|
|
142
|
+
type_cast_pluck_values(res, columns).map { |id| Shard.relative_id_for(id, Shard.current, base_shard) }
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
109
148
|
private
|
110
149
|
|
111
150
|
def type_cast_calculated_value_switchman(value, column_name, operation)
|
data/lib/switchman/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: switchman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Cutrer
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-02-
|
13
|
+
date: 2024-02-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|