querier 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/querier.rb +9 -4
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f15f96f79aea614fe9eec3fa44a8ed7c6f51009c4bdb6ee18316aef6577b41f9
|
4
|
+
data.tar.gz: e4d5d7abe1357c899a4f6e45fa407a3fedc831779aa5af1b999dd51917986cb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0baf3ced087fa4a9a5c1525fa0b8ae4076290a8d8af8d9be5257d83c610becf469fba2624e73ea3689d78a20cf28df811830c67bfba89198b8e148c421e4e33c
|
7
|
+
data.tar.gz: eeae2b170e2268b7569f8aaa531de5e7a49a702ad99746c32c8269c2cc0679ecd4e5d054c9a189e00ab1270faa1d3762c76efcc761c1a5c0510d8a0ecd41acbe
|
data/lib/querier.rb
CHANGED
@@ -12,7 +12,7 @@ class Querier
|
|
12
12
|
def execute
|
13
13
|
@query_execution_count += 1
|
14
14
|
@execution_cached_result = ActiveRecord::Base.connection.select_all(fill_query_params(query_template: @query_template, query_params: @query_params))
|
15
|
-
@execution_cached_result.map! {|record| record.symbolize_keys!}
|
15
|
+
@execution_cached_result = execution_cached_result.map! { |record| record.symbolize_keys! }
|
16
16
|
end
|
17
17
|
|
18
18
|
def cached_result format: :hash
|
@@ -58,7 +58,7 @@ class Querier
|
|
58
58
|
dataset.map {|record| OpenStruct.new(record.symbolize_keys!)}
|
59
59
|
end
|
60
60
|
|
61
|
-
def get_param_value raw_query_param
|
61
|
+
def get_param_value raw_query_param:, quotefy_param: true
|
62
62
|
# where's String#quote when we need it?
|
63
63
|
raw_query_param.class.eql?(String) && quotefy_param ? "'#{raw_query_param.to_s}'" : raw_query_param.to_s
|
64
64
|
end
|
@@ -69,8 +69,13 @@ class Querier
|
|
69
69
|
query_params.each do |query_param|
|
70
70
|
query_param_name = query_param[PARAM_NAME_INDEX].to_s
|
71
71
|
|
72
|
-
query.gsub!
|
73
|
-
|
72
|
+
query.gsub!(/\${#{query_param_name}}/,
|
73
|
+
get_param_value(raw_query_param: query_param[PARAM_VALUE_INDEX],
|
74
|
+
quotefy_param: true))
|
75
|
+
|
76
|
+
query.gsub!(/\${#{query_param_name}\/no_quote}/,
|
77
|
+
get_param_value(raw_query_param: query_param[PARAM_VALUE_INDEX],
|
78
|
+
quotefy_param: false))
|
74
79
|
end
|
75
80
|
|
76
81
|
query
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: querier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gedean Dias
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Active Record queries with variable number of params
|
14
14
|
email: gedean.dias@gmail.com
|
@@ -22,7 +22,7 @@ homepage: https://github.com/gedean/querier
|
|
22
22
|
licenses:
|
23
23
|
- MIT
|
24
24
|
metadata: {}
|
25
|
-
post_install_message:
|
25
|
+
post_install_message:
|
26
26
|
rdoc_options: []
|
27
27
|
require_paths:
|
28
28
|
- lib
|
@@ -30,16 +30,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: 2.7.0
|
34
34
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
35
|
requirements:
|
36
36
|
- - ">="
|
37
37
|
- !ruby/object:Gem::Version
|
38
38
|
version: '0'
|
39
39
|
requirements: []
|
40
|
-
|
41
|
-
|
42
|
-
signing_key:
|
40
|
+
rubygems_version: 3.2.3
|
41
|
+
signing_key:
|
43
42
|
specification_version: 4
|
44
43
|
summary: Active Record Querier
|
45
44
|
test_files: []
|