dbee 2.1.0.pre.alpha → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -15
- data/CHANGELOG.md +1 -1
- data/dbee.gemspec +1 -1
- data/lib/dbee/query.rb +24 -8
- data/lib/dbee/query/field.rb +4 -0
- data/lib/dbee/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8881fb69d8398471e0857f9b8e01a1452aaf6688a3a30aa38868b8254549e9c
|
4
|
+
data.tar.gz: ca28fbd217d3a8c7daa2c41e5d9ea7d24173ab1b57c48467c9700c5b4871c01e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1cdd0b920c5ee6c02829eebe6e9d2851401eb996f2573f8524eba027de10102e9c706de9468cfeec503ec2ecf28cce525f2511ef0952c9204bf49462bd262be
|
7
|
+
data.tar.gz: 6e6e2d772a318b8cc8960300b45ecb830bbde5973e567295eddff15f287ebf453e09df30de1d686d8a0ee157d590d4af0d48cd71e87012cc1d0606d952c2cac6
|
data/.rubocop.yml
CHANGED
@@ -1,15 +1,10 @@
|
|
1
1
|
AllCops:
|
2
2
|
TargetRubyVersion: 2.5
|
3
|
+
NewCops: enable
|
3
4
|
|
4
5
|
Layout/LineLength:
|
5
6
|
Max: 100
|
6
7
|
|
7
|
-
Lint/RaiseException:
|
8
|
-
Enabled: True
|
9
|
-
|
10
|
-
Lint/StructNewOverride:
|
11
|
-
Enabled: True
|
12
|
-
|
13
8
|
Metrics/AbcSize:
|
14
9
|
Max: 16
|
15
10
|
|
@@ -27,12 +22,3 @@ Metrics/ClassLength:
|
|
27
22
|
|
28
23
|
Metrics/MethodLength:
|
29
24
|
Max: 25
|
30
|
-
|
31
|
-
Style/HashEachMethods:
|
32
|
-
Enabled: True
|
33
|
-
|
34
|
-
Style/HashTransformKeys:
|
35
|
-
Enabled: True
|
36
|
-
|
37
|
-
Style/HashTransformValues:
|
38
|
-
Enabled: True
|
data/CHANGELOG.md
CHANGED
data/dbee.gemspec
CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
|
|
36
36
|
s.add_development_dependency('pry', '~>0')
|
37
37
|
s.add_development_dependency('rake', '~> 13')
|
38
38
|
s.add_development_dependency('rspec')
|
39
|
-
s.add_development_dependency('rubocop', '~>0.
|
39
|
+
s.add_development_dependency('rubocop', '~>0.88.0')
|
40
40
|
s.add_development_dependency('simplecov', '~>0.17.0')
|
41
41
|
s.add_development_dependency('simplecov-console', '~>0.7.0')
|
42
42
|
end
|
data/lib/dbee/query.rb
CHANGED
@@ -23,13 +23,24 @@ module Dbee
|
|
23
23
|
|
24
24
|
class NoFieldsError < StandardError; end
|
25
25
|
|
26
|
-
attr_reader :fields,
|
26
|
+
attr_reader :fields,
|
27
|
+
:filters,
|
28
|
+
:groupers,
|
29
|
+
:limit,
|
30
|
+
:sorters
|
27
31
|
|
28
|
-
def_delegator :fields,
|
29
|
-
def_delegator :filters,
|
30
|
-
def_delegator :sorters,
|
32
|
+
def_delegator :fields, :sort, :sorted_fields
|
33
|
+
def_delegator :filters, :sort, :sorted_filters
|
34
|
+
def_delegator :sorters, :sort, :sorted_sorters
|
35
|
+
def_delegator :groupers, :sort, :sorted_groupers
|
31
36
|
|
32
|
-
def initialize(
|
37
|
+
def initialize(
|
38
|
+
fields:,
|
39
|
+
filters: [],
|
40
|
+
groupers: [],
|
41
|
+
limit: nil,
|
42
|
+
sorters: []
|
43
|
+
)
|
33
44
|
@fields = Field.array(fields)
|
34
45
|
|
35
46
|
# If no fields were passed into a query then we will have no data to return.
|
@@ -38,6 +49,7 @@ module Dbee
|
|
38
49
|
raise NoFieldsError if @fields.empty?
|
39
50
|
|
40
51
|
@filters = Filters.array(filters).uniq
|
52
|
+
@groupers = Array(groupers).map { |k| KeyPath.get(k) }.uniq
|
41
53
|
@limit = limit.to_s.empty? ? nil : limit.to_i
|
42
54
|
@sorters = Sorters.array(sorters).uniq
|
43
55
|
|
@@ -46,10 +58,10 @@ module Dbee
|
|
46
58
|
|
47
59
|
def ==(other)
|
48
60
|
other.instance_of?(self.class) &&
|
61
|
+
other.limit == limit &&
|
49
62
|
other.sorted_fields == sorted_fields &&
|
50
63
|
other.sorted_filters == sorted_filters &&
|
51
|
-
other.sorted_sorters == sorted_sorters
|
52
|
-
other.limit == limit
|
64
|
+
other.sorted_sorters == sorted_sorters
|
53
65
|
end
|
54
66
|
alias eql? ==
|
55
67
|
|
@@ -60,7 +72,11 @@ module Dbee
|
|
60
72
|
private
|
61
73
|
|
62
74
|
def key_paths
|
63
|
-
(
|
75
|
+
(
|
76
|
+
fields.flat_map(&:key_paths) +
|
77
|
+
filters.map(&:key_path) +
|
78
|
+
sorters.map(&:key_path)
|
79
|
+
)
|
64
80
|
end
|
65
81
|
end
|
66
82
|
end
|
data/lib/dbee/query/field.rb
CHANGED
data/lib/dbee/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Ruggio
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: acts_as_hashable
|
@@ -106,14 +106,14 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 0.
|
109
|
+
version: 0.88.0
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: 0.
|
116
|
+
version: 0.88.0
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
118
|
name: simplecov
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -244,9 +244,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
244
244
|
version: '2.5'
|
245
245
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
246
246
|
requirements:
|
247
|
-
- - "
|
247
|
+
- - ">="
|
248
248
|
- !ruby/object:Gem::Version
|
249
|
-
version:
|
249
|
+
version: '0'
|
250
250
|
requirements: []
|
251
251
|
rubygems_version: 3.0.3
|
252
252
|
signing_key:
|