switchman 3.5.20 → 3.5.22
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: fa5da3b192752676ea8513c8fd05d72e347b10979b7b47ada9cdf008941fc2ac
|
4
|
+
data.tar.gz: 1da3c8eba9d967ca1a3edd550ecc7dd8bb1dea6193be3a752a65e95dc0beb54d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ba322eda93832f04595bb93f52153c61db3df1848404d80daf83e4b77b070f45c2d84cc2b6a5ba90c68cd5fbe26745f7ff2932b1a510ad15559f8234dab9bd2
|
7
|
+
data.tar.gz: 2453c5bccf84d20766340fe60512aec89547d27287832806964688c630f2af5d90070932c49e215f4a6ce209dfb701b1afa181ea1abe4fb8a009c03b55dea88e
|
@@ -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.22
|
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
|