dbee-active_record 1.0.0.pre.alpha.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/dbee/providers/active_record_provider/expression_builder/constraint_maker.rb +3 -3
- data/lib/dbee/providers/active_record_provider/expression_builder/where_maker.rb +3 -3
- data/lib/dbee/providers/active_record_provider/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f8eb6678bbafccb2a6ce4e2da8d1d4e20758d48b024cfc2d674d18f1a2d34af
|
4
|
+
data.tar.gz: '08695bc7492ff8f47295847b21d460c92b7e6c6e31a2fe182007b8ab17e96805'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 827ee13a0fde7265e59a5266af403c48f42e6968e8378489a345b7e296f250437d1ef48f1beeae6ce28df64a8034b1edeb8edc362e84483f9f89a2c2caa2e75f
|
7
|
+
data.tar.gz: 9b6276c489a11863cdbe669cc7d8510ab330382a3ec0796495d16c908f159d7921ba60b46c57710c5e581cd66858d22354a598fa9245507aa568d80a9b577f8f
|
data/CHANGELOG.md
CHANGED
@@ -17,7 +17,7 @@ module Dbee
|
|
17
17
|
on ? on.and(arel_column.eq(value)) : arel_column.eq(value)
|
18
18
|
end
|
19
19
|
|
20
|
-
|
20
|
+
CONSTRAINT_RESOLVERS = {
|
21
21
|
Model::Constraints::Reference => lambda do |constraint, on, table, previous_table|
|
22
22
|
name = constraint.name
|
23
23
|
parent = constraint.parent
|
@@ -32,11 +32,11 @@ module Dbee
|
|
32
32
|
end
|
33
33
|
}.freeze
|
34
34
|
|
35
|
-
private_constant :
|
35
|
+
private_constant :CONSTRAINT_RESOLVERS
|
36
36
|
|
37
37
|
def make(constraints, table, previous_table)
|
38
38
|
constraints.inject(nil) do |memo, constraint|
|
39
|
-
method =
|
39
|
+
method = CONSTRAINT_RESOLVERS[constraint.class]
|
40
40
|
|
41
41
|
raise ArgumentError, "constraint unhandled: #{constraint.class.name}" unless method
|
42
42
|
|
@@ -13,7 +13,7 @@ module Dbee
|
|
13
13
|
class ExpressionBuilder
|
14
14
|
# Derives Arel#where predicates.
|
15
15
|
class WhereMaker
|
16
|
-
|
16
|
+
FILTER_EVALUATORS = {
|
17
17
|
Query::Filters::Contains => ->(column, val) { column.matches("%#{val}%") },
|
18
18
|
Query::Filters::Equals => ->(column, val) { column.eq(val) },
|
19
19
|
Query::Filters::GreaterThan => ->(column, val) { column.gt(val) },
|
@@ -26,11 +26,11 @@ module Dbee
|
|
26
26
|
Query::Filters::StartsWith => ->(column, val) { column.matches("#{val}%") }
|
27
27
|
}.freeze
|
28
28
|
|
29
|
-
private_constant :
|
29
|
+
private_constant :FILTER_EVALUATORS
|
30
30
|
|
31
31
|
def make(filter, arel_column)
|
32
32
|
predicates = normalize(filter.value).map do |coerced_value|
|
33
|
-
method =
|
33
|
+
method = FILTER_EVALUATORS[filter.class]
|
34
34
|
|
35
35
|
raise ArgumentError, "cannot compile filter: #{filter}" unless method
|
36
36
|
|
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: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Ruggio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -231,9 +231,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
231
231
|
version: 2.4.6
|
232
232
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
|
-
- - "
|
234
|
+
- - ">="
|
235
235
|
- !ruby/object:Gem::Version
|
236
|
-
version:
|
236
|
+
version: '0'
|
237
237
|
requirements: []
|
238
238
|
rubygems_version: 3.0.3
|
239
239
|
signing_key:
|