where_row 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rspec +3 -0
- data/Appraisals +17 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +66 -0
- data/LICENSE.txt +21 -0
- data/README.md +97 -0
- data/Rakefile +6 -0
- data/lib/where_row/active_record/base.rb +9 -0
- data/lib/where_row/active_record/relation.rb +11 -0
- data/lib/where_row/active_record.rb +1 -0
- data/lib/where_row/query_builder.rb +128 -0
- data/lib/where_row/query_builder_fascade.rb +122 -0
- data/lib/where_row/version.rb +3 -0
- data/lib/where_row.rb +11 -0
- data/where_row.gemspec +33 -0
- metadata +163 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a268067ae2cd7fad7fd98ea9045e77177da3cf2d947e4afeb8fae3c1ecb67faa
|
4
|
+
data.tar.gz: 2766f2ef380e2c8ce905c5e66afdf566dc844c8f1e593ecfe59781a9e378123e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e13710f2b6f696b0d4d159f66f1f8aa14b52394b69383b0e1a4569c8e2705157e40f02f1f56822df3d04ebed9bb01afd160587d0c5f084acc31d2a2ac4c586ee
|
7
|
+
data.tar.gz: bb7c6db0fc15cce4947768add34dd18fb86c1d7f76fc00d530296a269a10ac33297f3e5b61d2cc966fbbd67569794cb43e927169ad896eb0ba4ca7973fb0797c
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Appraisals
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
appraise "active_record_52" do
|
4
|
+
gem "activerecord", "~> 5.2.0", require: "active_record"
|
5
|
+
end
|
6
|
+
|
7
|
+
appraise "active_record_60" do
|
8
|
+
gem "activerecord", "~> 6.0.0", require: "active_record"
|
9
|
+
end
|
10
|
+
|
11
|
+
appraise "active_record_61" do
|
12
|
+
gem "activerecord", "~> 6.1.0", require: "active_record"
|
13
|
+
end
|
14
|
+
|
15
|
+
appraise "active_record_70" do
|
16
|
+
gem "activerecord", "~> 7.0.0", require: "active_record"
|
17
|
+
end
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
where_row (0.1.0)
|
5
|
+
activerecord (>= 5.2, < 7.1)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activemodel (6.1.7.3)
|
11
|
+
activesupport (= 6.1.7.3)
|
12
|
+
activerecord (6.1.7.3)
|
13
|
+
activemodel (= 6.1.7.3)
|
14
|
+
activesupport (= 6.1.7.3)
|
15
|
+
activesupport (6.1.7.3)
|
16
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
+
i18n (>= 1.6, < 2)
|
18
|
+
minitest (>= 5.1)
|
19
|
+
tzinfo (~> 2.0)
|
20
|
+
zeitwerk (~> 2.3)
|
21
|
+
appraisal (2.4.1)
|
22
|
+
bundler
|
23
|
+
rake
|
24
|
+
thor (>= 0.14.0)
|
25
|
+
concurrent-ruby (1.2.2)
|
26
|
+
diff-lcs (1.5.0)
|
27
|
+
i18n (1.14.0)
|
28
|
+
concurrent-ruby (~> 1.0)
|
29
|
+
mini_portile2 (2.8.2)
|
30
|
+
minitest (5.15.0)
|
31
|
+
rake (10.5.0)
|
32
|
+
rspec (3.12.0)
|
33
|
+
rspec-core (~> 3.12.0)
|
34
|
+
rspec-expectations (~> 3.12.0)
|
35
|
+
rspec-mocks (~> 3.12.0)
|
36
|
+
rspec-core (3.12.2)
|
37
|
+
rspec-support (~> 3.12.0)
|
38
|
+
rspec-expectations (3.12.3)
|
39
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
+
rspec-support (~> 3.12.0)
|
41
|
+
rspec-mocks (3.12.5)
|
42
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
+
rspec-support (~> 3.12.0)
|
44
|
+
rspec-support (3.12.0)
|
45
|
+
sqlite3 (1.6.3)
|
46
|
+
mini_portile2 (~> 2.8.0)
|
47
|
+
thor (1.2.1)
|
48
|
+
tzinfo (2.0.6)
|
49
|
+
concurrent-ruby (~> 1.0)
|
50
|
+
yard (0.9.34)
|
51
|
+
zeitwerk (2.6.8)
|
52
|
+
|
53
|
+
PLATFORMS
|
54
|
+
ruby
|
55
|
+
|
56
|
+
DEPENDENCIES
|
57
|
+
appraisal
|
58
|
+
bundler (~> 1.17)
|
59
|
+
rake (~> 10.0)
|
60
|
+
rspec (~> 3.0)
|
61
|
+
sqlite3
|
62
|
+
where_row!
|
63
|
+
yard
|
64
|
+
|
65
|
+
BUNDLED WITH
|
66
|
+
1.17.3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 Odysseas Doumas
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
# WhereRow
|
2
|
+
|
3
|
+
A minimalistic Rails gem to allow easy use of SQL row value syntax.
|
4
|
+
|
5
|
+
Sometimes, the classic offset method to paginate results can be very inneficient, and not the best approach for some problems such as infinite scrolling. The seek method is a good alternative for these cases.
|
6
|
+
|
7
|
+
Consider the following example, as it appears on [Use The Index Luke](https://use-the-index-luke.com/sql/partial-results/fetch-next-page)
|
8
|
+
|
9
|
+
```SQL
|
10
|
+
CREATE INDEX sl_dtid ON sales (sale_date, sale_id)
|
11
|
+
|
12
|
+
SELECT *
|
13
|
+
FROM sales
|
14
|
+
WHERE (sale_date, sale_id) < (?, ?)
|
15
|
+
ORDER BY sale_date DESC, sale_id DESC
|
16
|
+
FETCH FIRST 10 ROWS ONLY
|
17
|
+
```
|
18
|
+
|
19
|
+
The Row Value syntax is straigth not supported in Rails in any way. Furthermore, some databases still don't support this syntax as well, or
|
20
|
+
maybe there is partial support (for example, the index is not properly utilized).
|
21
|
+
|
22
|
+
Thankfully, the same results can be achieved with plain-old logical expressions and comparisons. The equivalent query would look like this:
|
23
|
+
|
24
|
+
```SQL
|
25
|
+
SELECT *
|
26
|
+
FROM sales
|
27
|
+
WHERE sale_date <= ?
|
28
|
+
AND NOT (sale_date = ? AND sale_id >= ?)
|
29
|
+
ORDER BY sale_date DESC, sale_id DESC
|
30
|
+
FETCH FIRST 10 ROWS ONLY
|
31
|
+
```
|
32
|
+
|
33
|
+
This is something that can be directly expressed in Rails/ One possible way is the following:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
Sales.
|
37
|
+
where(sale_date: (..date_offset)).
|
38
|
+
where.not(sale_date: date_offset, sale_id: (sale_id_offset..)).
|
39
|
+
order(sale_date: :desc, sale_id: :desc).
|
40
|
+
limit(10)
|
41
|
+
```
|
42
|
+
|
43
|
+
However, the intent of this query is not clear at all when reading through this piece of code. Furthermore, if for any reason we need more than two columns, this will blow up pretty quickly. This gem allows us to generate this query/relation with a more explicit syntax.
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
Sales.
|
47
|
+
where_row(:sale_date, :sale_id).lt(date_offset, sale_id_offset).
|
48
|
+
order(sale_date: :desc, sale_id: :desc).
|
49
|
+
limit(10)
|
50
|
+
```
|
51
|
+
|
52
|
+
## Installation
|
53
|
+
|
54
|
+
Add this line to your application's Gemfile:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
gem 'where_row'
|
58
|
+
```
|
59
|
+
|
60
|
+
And then execute:
|
61
|
+
|
62
|
+
$ bundle
|
63
|
+
|
64
|
+
Or install it yourself as:
|
65
|
+
|
66
|
+
$ gem install where_row
|
67
|
+
|
68
|
+
## Usage
|
69
|
+
|
70
|
+
A single `where_row` method is made available for all relations.
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
date = Date.new(2021, 4, 5)
|
74
|
+
|
75
|
+
Sales.where_row(:sale_date, :sale_id).eq(date, 42)
|
76
|
+
Sales.where_row(:sale_date, :sale_id).in([date, 42], [date + 1.day, 43])
|
77
|
+
Sales.where_row(:sale_date, :sale_id).lt(date, 42)
|
78
|
+
Sales.where_row(:sale_date, :sale_id).gt(date, 42)
|
79
|
+
Sales.where_row(:sale_date, :sale_id).gte(date, 42)
|
80
|
+
Sales.where_row(:sale_date, :sale_id).lte(date, 42)
|
81
|
+
```
|
82
|
+
|
83
|
+
There is also a `not` method for negated queries.
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
Sales.where_row(:sale_date, :sale_id).not.eq(date, 42)
|
87
|
+
```
|
88
|
+
|
89
|
+
The result is also a relation, so it can be chained with regular Rails query methods.
|
90
|
+
|
91
|
+
## Contributing
|
92
|
+
|
93
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/odydoum/where_row.
|
94
|
+
|
95
|
+
## License
|
96
|
+
|
97
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
module WhereRow::ActiveRecord; end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
module WhereRow
|
2
|
+
class QueryBuilder
|
3
|
+
def initialize(relation, keys, operator, values)
|
4
|
+
@relation = relation
|
5
|
+
@keys = keys.map(&:to_s)
|
6
|
+
@operator = operator
|
7
|
+
@values = values
|
8
|
+
end
|
9
|
+
|
10
|
+
REVERSE_OP_MAP = {
|
11
|
+
lt: :gteq,
|
12
|
+
gt: :lteq,
|
13
|
+
lteq: :gt,
|
14
|
+
gteq: :lt
|
15
|
+
}.freeze
|
16
|
+
private_constant :REVERSE_OP_MAP
|
17
|
+
|
18
|
+
COMPARISON_OPERATORS = REVERSE_OP_MAP.keys
|
19
|
+
private_constant :COMPARISON_OPERATORS
|
20
|
+
|
21
|
+
def build
|
22
|
+
return relation if keys.blank?
|
23
|
+
|
24
|
+
case operator
|
25
|
+
when :eq
|
26
|
+
validate_single(values)
|
27
|
+
relation.where(keys.zip(values).to_h)
|
28
|
+
when :not_eq
|
29
|
+
validate_single(values)
|
30
|
+
build_not_eq_clause(relation, keys.zip(values))
|
31
|
+
when :in
|
32
|
+
validate_multiple(values)
|
33
|
+
build_in_clause
|
34
|
+
when :not_in
|
35
|
+
validate_multiple(values)
|
36
|
+
build_not_in_clause
|
37
|
+
when *COMPARISON_OPERATORS
|
38
|
+
validate_single(values)
|
39
|
+
build_comparison_clause
|
40
|
+
else
|
41
|
+
raise ArgumentError, 'Invalid operator'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
attr_reader :relation, :keys, :operator, :values
|
48
|
+
|
49
|
+
def build_not_eq_clause(rel, key_value_pairs)
|
50
|
+
key, value = key_value_pairs.first
|
51
|
+
|
52
|
+
base_relation = rel.where.not(key => value)
|
53
|
+
|
54
|
+
return base_relation if key_value_pairs.length == 1
|
55
|
+
|
56
|
+
key_value_pairs[1..-1].reduce(base_relation) do |r, (k, v)|
|
57
|
+
r.or!(rel.where.not(k => v))
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def build_in_clause
|
62
|
+
in_relation = relation.unscoped.where!(keys.zip(values.first).to_h)
|
63
|
+
|
64
|
+
values[1..-1].each do |v|
|
65
|
+
in_relation.or!(relation.unscoped.where!(keys.zip(v).to_h))
|
66
|
+
end
|
67
|
+
|
68
|
+
relation.merge(in_relation)
|
69
|
+
end
|
70
|
+
|
71
|
+
def build_not_in_clause
|
72
|
+
base_relation = build_not_eq_clause(relation, keys.zip(values.first))
|
73
|
+
|
74
|
+
return base_relation if values.length == 1
|
75
|
+
|
76
|
+
values[1..-1].reduce(base_relation) do |r, v|
|
77
|
+
base_relation.merge!(build_not_eq_clause(relation, keys.zip(v)))
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def build_comparison_clause
|
82
|
+
relation.where(build_comparison_predicate)
|
83
|
+
end
|
84
|
+
|
85
|
+
def build_comparison_predicate
|
86
|
+
last_idx = keys.size - 1
|
87
|
+
reversed_op = REVERSE_OP_MAP[operator]
|
88
|
+
last_pred = build_predicate_for_key(relation, last_idx, reversed_op)
|
89
|
+
|
90
|
+
return last_pred if last_idx.zero?
|
91
|
+
|
92
|
+
first_keys_op = :lt if reversed_op == :lteq
|
93
|
+
first_keys_op = :gt if reversed_op == :gteq
|
94
|
+
first_keys_op ||= reversed_op
|
95
|
+
|
96
|
+
(0...last_idx).
|
97
|
+
map { |i| build_predicate_for_key(relation, i, first_keys_op) }.
|
98
|
+
reduce(:and).
|
99
|
+
and(last_pred)
|
100
|
+
end
|
101
|
+
|
102
|
+
def build_predicate_for_key(relation, idx, op)
|
103
|
+
last_pred = build_predicate(relation, keys[idx], values[idx], op)
|
104
|
+
|
105
|
+
return last_pred.not if idx == 0
|
106
|
+
|
107
|
+
(0...idx).
|
108
|
+
map { |j| build_predicate(relation, keys[j], values[j], :eq) }.
|
109
|
+
reduce(:and).
|
110
|
+
and(last_pred).
|
111
|
+
not
|
112
|
+
end
|
113
|
+
|
114
|
+
def build_predicate(relation, attr_name, value, operator)
|
115
|
+
relation.arel_table[attr_name].public_send(operator, value)
|
116
|
+
end
|
117
|
+
|
118
|
+
def validate_single(values)
|
119
|
+
if keys.length != values.length
|
120
|
+
raise ArgumentError, 'Argument lengths do not match'
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def validate_multiple(values)
|
125
|
+
values.each { |v| validate_single(v) }
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require 'where_row/query_builder'
|
2
|
+
|
3
|
+
module WhereRow
|
4
|
+
class QueryBuilderFascade
|
5
|
+
def initialize(relation, keys, negated = false)
|
6
|
+
@relation = relation
|
7
|
+
@keys = keys
|
8
|
+
@negated = negated
|
9
|
+
end
|
10
|
+
|
11
|
+
#
|
12
|
+
# Negate the where_row condition that follows
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
# Rel.where_row(:c1, c2).eq(v1, v2) # Generates the equivalent of (c1, c2) = (v1, v2)
|
16
|
+
# Rel.where_row(:c1, c2).not.eq(v1, v2) # Generates the equivalent of (c1, c2) != (v1, v2)
|
17
|
+
#
|
18
|
+
# @return [WhereRow::QueryBuilderFascade]
|
19
|
+
#
|
20
|
+
def not
|
21
|
+
self.class.new(@relation, @keys, true)
|
22
|
+
end
|
23
|
+
|
24
|
+
#
|
25
|
+
# Generates the equivalent clause of (c1, c2, c3, ...) = (v1, v2, v3, ...)
|
26
|
+
#
|
27
|
+
# @param [Array<Object>] values The values to compare against
|
28
|
+
#
|
29
|
+
# @return [ActiveRecord::Relation] The resulting relation
|
30
|
+
#
|
31
|
+
def eq(*values)
|
32
|
+
op = @negated ? :not_eq : :eq
|
33
|
+
|
34
|
+
QueryBuilder.new(@relation, @keys, op, values).build
|
35
|
+
end
|
36
|
+
|
37
|
+
#
|
38
|
+
# Generates the equivalent clause of (c1, c2, c3, ...) IN ((a1, a2, a3, ...), (b1, b2, b3, ...))
|
39
|
+
#
|
40
|
+
# @param [Array<Array<Object>>] values The values to compare against. Each element is itself an array of values.
|
41
|
+
#
|
42
|
+
# @return [ActiveRecord::Relation] The resulting relation
|
43
|
+
#
|
44
|
+
def in(*values)
|
45
|
+
op = @negated ? :not_in : :in
|
46
|
+
|
47
|
+
QueryBuilder.new(@relation, @keys, op, values).build
|
48
|
+
end
|
49
|
+
|
50
|
+
def in_range(range)
|
51
|
+
if @negated
|
52
|
+
result = @relation.where_row(@keys).lt(range.begin)
|
53
|
+
|
54
|
+
if range.exclude_end?
|
55
|
+
result.or(@relation.where_row(@keys).gte(range.end))
|
56
|
+
else
|
57
|
+
result.or(@relation.where_row(@keys).gt(range.end))
|
58
|
+
end
|
59
|
+
else
|
60
|
+
result = @relation.where_row(@keys).gte(range.begin)
|
61
|
+
|
62
|
+
if range.exclude_end?
|
63
|
+
result.where_row(@keys).lt(range.end)
|
64
|
+
else
|
65
|
+
result.where_row(@keys).lte(range.end)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
#
|
71
|
+
# Generates the equivalent clause of (c1, c2, c3, ...) > (v1, v2, v3, ...)
|
72
|
+
#
|
73
|
+
# @param [Array<Object>] values The values to compare against
|
74
|
+
#
|
75
|
+
# @return [ActiveRecord::Relation] The resulting relation
|
76
|
+
#
|
77
|
+
def gt(*values)
|
78
|
+
op = @negated ? :lteq : :gt
|
79
|
+
|
80
|
+
QueryBuilder.new(@relation, @keys, op, values).build
|
81
|
+
end
|
82
|
+
|
83
|
+
#
|
84
|
+
# Generates the equivalent clause of (c1, c2, c3, ...) >= (v1, v2, v3, ...)
|
85
|
+
#
|
86
|
+
# @param [Array<Object>] values The values to compare against
|
87
|
+
#
|
88
|
+
# @return [ActiveRecord::Relation] The resulting relation
|
89
|
+
#
|
90
|
+
def gte(*values)
|
91
|
+
op = @negated ? :lt : :gteq
|
92
|
+
|
93
|
+
QueryBuilder.new(@relation, @keys, op, values).build
|
94
|
+
end
|
95
|
+
|
96
|
+
#
|
97
|
+
# Generates the equivalent clause of (c1, c2, c3, ...) < (v1, v2, v3, ...)
|
98
|
+
#
|
99
|
+
# @param [Array<Object>] values The values to compare against
|
100
|
+
#
|
101
|
+
# @return [ActiveRecord::Relation] The resulting relation
|
102
|
+
#
|
103
|
+
def lt(*values)
|
104
|
+
op = @negated ? :gteq : :lt
|
105
|
+
|
106
|
+
QueryBuilder.new(@relation, @keys, op, values).build
|
107
|
+
end
|
108
|
+
|
109
|
+
#
|
110
|
+
# Generates the equivalent clause of (c1, c2, c3, ...) <= (v1, v2, v3, ...)
|
111
|
+
#
|
112
|
+
# @param [Array<Object>] values The values to compare against
|
113
|
+
#
|
114
|
+
# @return [ActiveRecord::Relation] The resulting relation
|
115
|
+
#
|
116
|
+
def lte(*values)
|
117
|
+
op = @negated ? :gt : :lteq
|
118
|
+
|
119
|
+
QueryBuilder.new(@relation, @keys, op, values).build
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
data/lib/where_row.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "where_row/version"
|
3
|
+
require "where_row/active_record/relation"
|
4
|
+
require "where_row/active_record/base"
|
5
|
+
|
6
|
+
require "active_record"
|
7
|
+
|
8
|
+
module WhereRow; end
|
9
|
+
|
10
|
+
ActiveRecord::Relation.prepend ::WhereRow::ActiveRecord::Relation
|
11
|
+
ActiveRecord::Base.extend ::WhereRow::ActiveRecord::Base
|
data/where_row.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "where_row/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "where_row"
|
8
|
+
spec.version = WhereRow::VERSION
|
9
|
+
spec.authors = ["Odysseas Doumas"]
|
10
|
+
spec.email = ["odydoum@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = 'Write row value queries in active record'
|
13
|
+
spec.description = 'Write row value queries in active record'
|
14
|
+
spec.homepage = "https://github.com/odoumas/where_row"
|
15
|
+
spec.license = "MIT"
|
16
|
+
spec.required_ruby_version = ">= 2.5.0"
|
17
|
+
|
18
|
+
# Specify which files should be added to the gem when it is released.
|
19
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
20
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
21
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
end
|
23
|
+
spec.require_paths = ["lib"]
|
24
|
+
|
25
|
+
spec.add_runtime_dependency "activerecord", ">= 5.2", "< 7.1"
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
28
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
29
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
30
|
+
spec.add_development_dependency "appraisal"
|
31
|
+
spec.add_development_dependency "sqlite3"
|
32
|
+
spec.add_development_dependency "yard"
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: where_row
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Odysseas Doumas
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-06-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activerecord
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.2'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '7.1'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '5.2'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '7.1'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.17'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.17'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '10.0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '10.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rspec
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '3.0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '3.0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: appraisal
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: sqlite3
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: yard
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
description: Write row value queries in active record
|
118
|
+
email:
|
119
|
+
- odydoum@gmail.com
|
120
|
+
executables: []
|
121
|
+
extensions: []
|
122
|
+
extra_rdoc_files: []
|
123
|
+
files:
|
124
|
+
- ".gitignore"
|
125
|
+
- ".rspec"
|
126
|
+
- Appraisals
|
127
|
+
- Gemfile
|
128
|
+
- Gemfile.lock
|
129
|
+
- LICENSE.txt
|
130
|
+
- README.md
|
131
|
+
- Rakefile
|
132
|
+
- lib/where_row.rb
|
133
|
+
- lib/where_row/active_record.rb
|
134
|
+
- lib/where_row/active_record/base.rb
|
135
|
+
- lib/where_row/active_record/relation.rb
|
136
|
+
- lib/where_row/query_builder.rb
|
137
|
+
- lib/where_row/query_builder_fascade.rb
|
138
|
+
- lib/where_row/version.rb
|
139
|
+
- where_row.gemspec
|
140
|
+
homepage: https://github.com/odoumas/where_row
|
141
|
+
licenses:
|
142
|
+
- MIT
|
143
|
+
metadata: {}
|
144
|
+
post_install_message:
|
145
|
+
rdoc_options: []
|
146
|
+
require_paths:
|
147
|
+
- lib
|
148
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 2.5.0
|
153
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - ">="
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
requirements: []
|
159
|
+
rubygems_version: 3.1.6
|
160
|
+
signing_key:
|
161
|
+
specification_version: 4
|
162
|
+
summary: Write row value queries in active record
|
163
|
+
test_files: []
|