ahoy_matey 5.2.0 → 5.2.1
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/ahoy/query_methods.rb +11 -11
- data/lib/ahoy/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ebbbd60be1beec66d70d5fee4922f013e61a9add9b9da33ec709fa8ca166cf7
|
4
|
+
data.tar.gz: '0969a3b0711ccc95e140017fc81480c2636a819b113b5a09337f72ff19b2fb09'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ef517cd3e3eb8b612ae54aef6b9051d1533acc0562303e03e8656b04b703425b55b0d4b6b0811c4f420c46ad6f34e6c01d2fc2dd802438f5dbbee36f82b4118
|
7
|
+
data.tar.gz: 228810c7e621654f88a21f864fd1400f0226fd9efb0d1902ffc98f997c9263daad675f656c59de2e28f5f641f2f70ed99e7814d071062610309a19f8724f4bc9
|
data/CHANGELOG.md
CHANGED
data/lib/ahoy/query_methods.rb
CHANGED
@@ -10,13 +10,13 @@ module Ahoy
|
|
10
10
|
def where_props(properties)
|
11
11
|
return all if properties.empty?
|
12
12
|
|
13
|
-
adapter_name = respond_to?(:
|
13
|
+
adapter_name = respond_to?(:connection_db_config) ? connection_db_config.adapter.to_s : "mongoid"
|
14
14
|
case adapter_name
|
15
15
|
when "mongoid"
|
16
16
|
where(properties.to_h { |k, v| ["properties.#{k}", v] })
|
17
|
-
when /mysql|trilogy/
|
17
|
+
when /mysql|trilogy/i
|
18
18
|
where("JSON_CONTAINS(properties, ?, '$') = 1", properties.to_json)
|
19
|
-
when /
|
19
|
+
when /postg/i
|
20
20
|
case columns_hash["properties"].type
|
21
21
|
when :hstore
|
22
22
|
properties.inject(all) do |relation, (k, v)|
|
@@ -31,7 +31,7 @@ module Ahoy
|
|
31
31
|
else
|
32
32
|
where("properties::jsonb @> ?", properties.to_json)
|
33
33
|
end
|
34
|
-
when /sqlite/
|
34
|
+
when /sqlite/i
|
35
35
|
properties.inject(all) do |relation, (k, v)|
|
36
36
|
if v.nil?
|
37
37
|
relation.where("JSON_EXTRACT(properties, ?) IS NULL", "$.#{k}")
|
@@ -50,16 +50,16 @@ module Ahoy
|
|
50
50
|
props.flatten!
|
51
51
|
|
52
52
|
relation = all
|
53
|
-
adapter_name = respond_to?(:
|
53
|
+
adapter_name = respond_to?(:connection_db_config) ? connection_db_config.adapter.to_s : "mongoid"
|
54
54
|
case adapter_name
|
55
55
|
when "mongoid"
|
56
56
|
raise "Adapter not supported: #{adapter_name}"
|
57
|
-
when /mysql|trilogy/
|
57
|
+
when /mysql|trilogy/i
|
58
58
|
props.each do |prop|
|
59
|
-
quoted_prop =
|
59
|
+
quoted_prop = connection_pool.with_connection { |c| c.quote("$.#{prop}") }
|
60
60
|
relation = relation.group("JSON_UNQUOTE(JSON_EXTRACT(properties, #{quoted_prop}))")
|
61
61
|
end
|
62
|
-
when /
|
62
|
+
when /postg/i
|
63
63
|
# convert to jsonb to fix
|
64
64
|
# could not identify an equality operator for type json
|
65
65
|
# and for text columns
|
@@ -67,12 +67,12 @@ module Ahoy
|
|
67
67
|
cast = [:jsonb, :hstore].include?(column_type) ? "" : "::jsonb"
|
68
68
|
|
69
69
|
props.each do |prop|
|
70
|
-
quoted_prop =
|
70
|
+
quoted_prop = connection_pool.with_connection { |c| c.quote(prop) }
|
71
71
|
relation = relation.group("properties#{cast} -> #{quoted_prop}")
|
72
72
|
end
|
73
|
-
when /sqlite/
|
73
|
+
when /sqlite/i
|
74
74
|
props.each do |prop|
|
75
|
-
quoted_prop =
|
75
|
+
quoted_prop = connection_pool.with_connection { |c| c.quote("$.#{prop}") }
|
76
76
|
relation = relation.group("JSON_EXTRACT(properties, #{quoted_prop})")
|
77
77
|
end
|
78
78
|
else
|
data/lib/ahoy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ahoy_matey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.2.
|
4
|
+
version: 5.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: '0'
|
114
114
|
requirements: []
|
115
|
-
rubygems_version: 3.5.
|
115
|
+
rubygems_version: 3.5.16
|
116
116
|
signing_key:
|
117
117
|
specification_version: 4
|
118
118
|
summary: Simple, powerful, first-party analytics for Rails
|