dbee-active_record 2.0.3 → 2.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f50827b6f31ffb9749796b4532b8a48f704c522be4e0011b7e9a58ed716dd26
|
4
|
+
data.tar.gz: e9469a99514bfdfbe03da6cdcda339aef1b12b2d829a82d7e2278a22b006f0b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7162ee879530dd36b2078a347b6fade9a5e5ce8e79f47709b33b11cb308303195cbafb3e6096a1529ddb7b7c23da6a19caccdc61356f29dd14b48b4e077cc041
|
7
|
+
data.tar.gz: 6d19989ed13fd0e2d7a88b3341309cf517aede0f4924c8f76f1325685a099b4b20985774adb445b0bb3487c9d91568500a86c767237618f57194e2806ee0fa93
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
# 2.0.
|
1
|
+
# 2.0.4 (February 13th, 2020)
|
2
|
+
|
3
|
+
* use Arel#in for Equal filters when there is more than one value
|
4
|
+
* use Arel#not_in for NotEqual filters when there are is than one value
|
5
|
+
|
6
|
+
# 2.0.3 (January 7th, 2020)
|
2
7
|
|
3
8
|
* Added/tested support for Dbee 2.0.3
|
4
9
|
* Added support for Ruby 2.6.5
|
@@ -31,6 +31,24 @@ module Dbee
|
|
31
31
|
private_constant :FILTER_EVALUATORS
|
32
32
|
|
33
33
|
def make(filter, arel_column)
|
34
|
+
values = normalize(filter.value)
|
35
|
+
|
36
|
+
if filter.is_a?(Query::Filters::Equals) && values.length > 1
|
37
|
+
arel_column.in(values)
|
38
|
+
elsif filter.is_a?(Query::Filters::NotEquals) && values.length > 1
|
39
|
+
arel_column.not_in(values)
|
40
|
+
else
|
41
|
+
use_or(filter, arel_column)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def normalize(value)
|
48
|
+
value ? Array(value).flatten : [nil]
|
49
|
+
end
|
50
|
+
|
51
|
+
def use_or(filter, arel_column)
|
34
52
|
predicates = normalize(filter.value).map do |coerced_value|
|
35
53
|
method = FILTER_EVALUATORS[filter.class]
|
36
54
|
|
@@ -43,12 +61,6 @@ module Dbee
|
|
43
61
|
memo.or(predicate)
|
44
62
|
end
|
45
63
|
end
|
46
|
-
|
47
|
-
private
|
48
|
-
|
49
|
-
def normalize(value)
|
50
|
-
value ? Array(value).flatten : [nil]
|
51
|
-
end
|
52
64
|
end
|
53
65
|
end
|
54
66
|
end
|
@@ -45,6 +45,10 @@ query:
|
|
45
45
|
- 'Netflix'
|
46
46
|
- 'Hulu'
|
47
47
|
key_path: name
|
48
|
+
- type: not_equals
|
49
|
+
value:
|
50
|
+
- 'YouTube Super Video'
|
51
|
+
key_path: name
|
48
52
|
- type: not_contain
|
49
53
|
value:
|
50
54
|
- 'tfli'
|
@@ -59,67 +63,71 @@ sqlite_readable: |+
|
|
59
63
|
SELECT "theaters"."id" AS 'ID #',
|
60
64
|
"theaters"."name" AS 'name'
|
61
65
|
FROM "theaters" "theaters"
|
62
|
-
WHERE
|
66
|
+
WHERE "theaters"."name" IN ('AMC', 'Regal') AND
|
63
67
|
"theaters"."name" LIKE 'A%' AND
|
64
68
|
"theaters"."name" LIKE '%m%' AND
|
65
69
|
"theaters"."active" = 'false' AND
|
66
|
-
|
67
|
-
|
70
|
+
"theaters"."active" IN ('t', 'f', NULL) AND
|
71
|
+
"theaters"."inspected" IN ('f', 't', NULL) AND
|
68
72
|
"theaters"."created_at" <= '2019-03-04' AND
|
69
73
|
"theaters"."created_at" < '2018-03-04' AND
|
70
74
|
"theaters"."created_at" >= '2001-03-04' AND
|
71
75
|
"theaters"."created_at" > '2002-03-04' AND
|
72
|
-
|
76
|
+
"theaters"."name" NOT IN ('Netflix', 'Hulu') AND
|
77
|
+
"theaters"."name" != 'YouTube Super Video' AND
|
73
78
|
("theaters"."name" NOT LIKE '%tfli%' OR "theaters"."name" NOT LIKE '%ul%') AND
|
74
79
|
("theaters"."name" NOT LIKE 'netf%' OR "theaters"."name" NOT LIKE 'hu%')
|
75
80
|
sqlite_not_readable: |+
|
76
81
|
SELECT "t0"."id" AS 'c0',
|
77
82
|
"t0"."name" AS 'c1'
|
78
83
|
FROM "theaters" "t0"
|
79
|
-
WHERE
|
84
|
+
WHERE "t0"."name" IN ('AMC', 'Regal') AND
|
80
85
|
"t0"."name" LIKE 'A%' AND
|
81
86
|
"t0"."name" LIKE '%m%' AND
|
82
87
|
"t0"."active" = 'false' AND
|
83
|
-
|
84
|
-
|
88
|
+
"t0"."active" IN ('t', 'f', NULL) AND
|
89
|
+
"t0"."inspected" IN ('f', 't', NULL) AND
|
85
90
|
"t0"."created_at" <= '2019-03-04' AND
|
86
91
|
"t0"."created_at" < '2018-03-04' AND
|
87
92
|
"t0"."created_at" >= '2001-03-04' AND
|
88
93
|
"t0"."created_at" > '2002-03-04' AND
|
89
|
-
|
94
|
+
"t0"."name" NOT IN ('Netflix', 'Hulu') AND
|
95
|
+
"t0"."name" != 'YouTube Super Video' AND
|
90
96
|
("t0"."name" NOT LIKE '%tfli%' OR "t0"."name" NOT LIKE '%ul%') AND
|
91
97
|
("t0"."name" NOT LIKE 'netf%' OR "t0"."name" NOT LIKE 'hu%')
|
92
98
|
mysql_readable: |+
|
93
99
|
SELECT `theaters`.`id` AS 'ID #',
|
94
100
|
`theaters`.`name` AS 'name'
|
95
101
|
FROM `theaters` `theaters`
|
96
|
-
WHERE
|
102
|
+
WHERE `theaters`.`name` IN ('AMC', 'Regal') AND
|
97
103
|
`theaters`.`name` LIKE 'A%' AND
|
98
104
|
`theaters`.`name` LIKE '%m%' AND
|
99
105
|
`theaters`.`active` = 'false' AND
|
100
|
-
|
101
|
-
|
106
|
+
`theaters`.`active` IN (TRUE, FALSE, NULL) AND
|
107
|
+
`theaters`.`inspected` IN (FALSE, TRUE, NULL) AND
|
102
108
|
`theaters`.`created_at` <= '2019-03-04' AND
|
103
109
|
`theaters`.`created_at` < '2018-03-04' AND
|
104
110
|
`theaters`.`created_at` >= '2001-03-04' AND
|
105
111
|
`theaters`.`created_at` > '2002-03-04' AND
|
106
|
-
|
112
|
+
`theaters`.`name` NOT IN ('Netflix', 'Hulu') AND
|
113
|
+
`theaters`.`name` != 'YouTube Super Video' AND
|
107
114
|
(`theaters`.`name` NOT LIKE '%tfli%' OR `theaters`.`name` NOT LIKE '%ul%') AND
|
108
115
|
(`theaters`.`name` NOT LIKE 'netf%' OR `theaters`.`name` NOT LIKE 'hu%')
|
109
116
|
mysql_not_readable: |+
|
110
117
|
SELECT `t0`.`id` AS 'c0',
|
111
118
|
`t0`.`name` AS 'c1'
|
112
119
|
FROM `theaters` `t0`
|
113
|
-
WHERE
|
120
|
+
WHERE `t0`.`name` IN ('AMC', 'Regal') AND
|
114
121
|
`t0`.`name` LIKE 'A%' AND
|
115
122
|
`t0`.`name` LIKE '%m%' AND
|
116
123
|
`t0`.`active` = 'false' AND
|
117
|
-
|
118
|
-
|
124
|
+
`t0`.`active` IN (TRUE, FALSE, NULL) AND
|
125
|
+
`t0`.`inspected` IN (FALSE, TRUE, NULL) AND
|
119
126
|
`t0`.`created_at` <= '2019-03-04' AND
|
120
127
|
`t0`.`created_at` < '2018-03-04' AND
|
121
128
|
`t0`.`created_at` >= '2001-03-04' AND
|
122
129
|
`t0`.`created_at` > '2002-03-04' AND
|
123
|
-
|
130
|
+
`t0`.`name` NOT IN ('Netflix', 'Hulu') AND
|
131
|
+
`t0`.`name` != 'YouTube Super Video' AND
|
124
132
|
(`t0`.`name` NOT LIKE '%tfli%' OR `t0`.`name` NOT LIKE '%ul%') AND
|
125
133
|
(`t0`.`name` NOT LIKE 'netf%' OR `t0`.`name` NOT LIKE 'hu%')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbee-active_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Ruggio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|