logical_query_parser 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +20 -4
- data/CHANGELOG.md +9 -0
- data/gemfiles/rails60.gemfile +1 -0
- data/gemfiles/rails61.gemfile +1 -0
- data/gemfiles/rails70.gemfile +1 -0
- data/gemfiles/rails71.gemfile +6 -0
- data/lib/logical_query_parser/assoc.rb +2 -0
- data/lib/logical_query_parser/assoc_resolver.rb +2 -0
- data/lib/logical_query_parser/nodes/active_record.rb +12 -10
- data/lib/logical_query_parser/nodes/base.rb +2 -0
- data/lib/logical_query_parser/version.rb +3 -1
- data/lib/logical_query_parser.rb +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21e876f1e9e4496b81a09656f8f9667817b79cc961fd72557dafd56ee20f7f37
|
4
|
+
data.tar.gz: b44d2f653f33c10de26fa2f80010836291abe78804354b84bb9aa1c54f5210ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b1337963075eb702293de0b3f9fb01880db2e2b7ed15b265858806fd5a75c25c0dd253c309060c7fa6982a8eda8e1b42d1ed82a3d978ac94a58f6169b9959e3
|
7
|
+
data.tar.gz: 02a3028859413314aee0284ac1beda1355dd633101ed449c2029447277a5e3c8fd552afc683313f276e8bdd25f9a868f6fc8b1cbd443603c9f6ce422947f3104
|
data/.github/workflows/ci.yml
CHANGED
@@ -4,12 +4,12 @@ on: [push, pull_request]
|
|
4
4
|
|
5
5
|
jobs:
|
6
6
|
test:
|
7
|
-
runs-on: ubuntu-
|
7
|
+
runs-on: ubuntu-22.04
|
8
8
|
strategy:
|
9
9
|
fail-fast: false
|
10
10
|
matrix:
|
11
|
-
ruby: [2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2]
|
12
|
-
gemfile: ['rails42', 'rails50', 'rails51', 'rails52', 'rails60', 'rails61', 'rails70']
|
11
|
+
ruby: [2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2, 3.3]
|
12
|
+
gemfile: ['rails42', 'rails50', 'rails51', 'rails52', 'rails60', 'rails61', 'rails70', 'rails71']
|
13
13
|
exclude:
|
14
14
|
- ruby: 2.3
|
15
15
|
gemfile: rails60
|
@@ -17,16 +17,24 @@ jobs:
|
|
17
17
|
gemfile: rails61
|
18
18
|
- ruby: 2.3
|
19
19
|
gemfile: rails70
|
20
|
+
- ruby: 2.3
|
21
|
+
gemfile: rails71
|
20
22
|
- ruby: 2.4
|
21
23
|
gemfile: rails60
|
22
24
|
- ruby: 2.4
|
23
25
|
gemfile: rails61
|
24
26
|
- ruby: 2.4
|
25
27
|
gemfile: rails70
|
28
|
+
- ruby: 2.4
|
29
|
+
gemfile: rails71
|
26
30
|
- ruby: 2.5
|
27
31
|
gemfile: rails70
|
32
|
+
- ruby: 2.5
|
33
|
+
gemfile: rails71
|
28
34
|
- ruby: 2.6
|
29
35
|
gemfile: rails70
|
36
|
+
- ruby: 2.6
|
37
|
+
gemfile: rails71
|
30
38
|
- ruby: 2.7
|
31
39
|
gemfile: rails42
|
32
40
|
- ruby: 3.0
|
@@ -53,6 +61,14 @@ jobs:
|
|
53
61
|
gemfile: rails51
|
54
62
|
- ruby: 3.2
|
55
63
|
gemfile: rails52
|
64
|
+
- ruby: 3.3
|
65
|
+
gemfile: rails42
|
66
|
+
- ruby: 3.3
|
67
|
+
gemfile: rails50
|
68
|
+
- ruby: 3.3
|
69
|
+
gemfile: rails51
|
70
|
+
- ruby: 3.3
|
71
|
+
gemfile: rails52
|
56
72
|
|
57
73
|
name: ruby ${{ matrix.ruby }}, ${{ matrix.gemfile }}
|
58
74
|
|
@@ -60,7 +76,7 @@ jobs:
|
|
60
76
|
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
|
61
77
|
|
62
78
|
steps:
|
63
|
-
- uses: actions/checkout@
|
79
|
+
- uses: actions/checkout@v4
|
64
80
|
- uses: ruby/setup-ruby@v1
|
65
81
|
with:
|
66
82
|
ruby-version: ${{ matrix.ruby }}
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 0.4.0
|
4
|
+
|
5
|
+
* Add `frozen_string_literal: true`.
|
6
|
+
* Fix internal hash key for building sql.
|
7
|
+
|
8
|
+
## 0.3.4
|
9
|
+
|
10
|
+
* Just rebuild gem file to fix file permission.
|
11
|
+
|
3
12
|
## 0.3.3
|
4
13
|
|
5
14
|
* Fix parsing literals which contains a logical operator. (#7 by scambra)
|
data/gemfiles/rails60.gemfile
CHANGED
data/gemfiles/rails61.gemfile
CHANGED
data/gemfiles/rails70.gemfile
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module LogicalQueryParser
|
2
4
|
module ExpNode
|
3
5
|
def to_sql(params = {})
|
4
|
-
params[:
|
6
|
+
params[:_sql] ||= ''.dup
|
5
7
|
exp.to_sql(params)
|
6
8
|
end
|
7
9
|
end
|
@@ -15,10 +17,10 @@ module LogicalQueryParser
|
|
15
17
|
exp.to_sql(params)
|
16
18
|
rparen.to_sql(params)
|
17
19
|
if rexp.elements.size > 0
|
18
|
-
params[:
|
20
|
+
params[:_sql] += ' AND '
|
19
21
|
rexp.elements[0].to_sql(params)
|
20
22
|
end
|
21
|
-
params[:
|
23
|
+
params[:_sql]
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
@@ -33,38 +35,38 @@ module LogicalQueryParser
|
|
33
35
|
module LiteralExpNode
|
34
36
|
def to_sql(params)
|
35
37
|
literal.to_sql(params)
|
36
|
-
params[:
|
38
|
+
params[:_sql] << ' AND '
|
37
39
|
exp.to_sql(params)
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
41
43
|
module LParenNode
|
42
44
|
def to_sql(params)
|
43
|
-
params[:
|
45
|
+
params[:_sql] << '('
|
44
46
|
end
|
45
47
|
end
|
46
48
|
|
47
49
|
module RParenNode
|
48
50
|
def to_sql(params)
|
49
|
-
params[:
|
51
|
+
params[:_sql] << ')'
|
50
52
|
end
|
51
53
|
end
|
52
54
|
|
53
55
|
module AndNode
|
54
56
|
def to_sql(params)
|
55
|
-
params[:
|
57
|
+
params[:_sql] << ' AND '
|
56
58
|
end
|
57
59
|
end
|
58
60
|
|
59
61
|
module OrNode
|
60
62
|
def to_sql(params)
|
61
|
-
params[:
|
63
|
+
params[:_sql] << ' OR '
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
65
67
|
module NotNode
|
66
68
|
def to_sql(params)
|
67
|
-
params[:
|
69
|
+
params[:_sql] << 'NOT '
|
68
70
|
end
|
69
71
|
end
|
70
72
|
|
@@ -75,7 +77,7 @@ module LogicalQueryParser
|
|
75
77
|
|
76
78
|
sql = build_arel(params, operator, text).reduce(logic).to_sql
|
77
79
|
sql = "(#{sql})" if sql[0] != '(' && sql[-1] != ')'
|
78
|
-
params[:
|
80
|
+
params[:_sql] << sql
|
79
81
|
end
|
80
82
|
|
81
83
|
private
|
data/lib/logical_query_parser.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logical_query_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoshikazu Kaneta
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: treetop
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- gemfiles/rails60.gemfile
|
135
135
|
- gemfiles/rails61.gemfile
|
136
136
|
- gemfiles/rails70.gemfile
|
137
|
+
- gemfiles/rails71.gemfile
|
137
138
|
- lib/logical_query_parser.rb
|
138
139
|
- lib/logical_query_parser.treetop
|
139
140
|
- lib/logical_query_parser/assoc.rb
|