inquery 1.0.2 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/LICENSE +1 -1
- data/README.md +4 -1
- data/RUBY_VERSION +1 -1
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/doc/Inquery.html +6 -6
- data/doc/Inquery/Exceptions.html +6 -6
- data/doc/Inquery/Exceptions/Base.html +6 -6
- data/doc/Inquery/Exceptions/InvalidRelation.html +6 -6
- data/doc/Inquery/Exceptions/UnknownCallSignature.html +6 -6
- data/doc/Inquery/Mixins.html +6 -6
- data/doc/Inquery/Mixins/RawSqlUtils.html +6 -6
- data/doc/Inquery/Mixins/RelationValidation.html +17 -17
- data/doc/Inquery/Mixins/RelationValidation/ClassMethods.html +11 -11
- data/doc/Inquery/Mixins/SchemaValidation.html +6 -6
- data/doc/Inquery/Mixins/SchemaValidation/ClassMethods.html +136 -12
- data/doc/Inquery/Query.html +9 -9
- data/doc/Inquery/Query/Chainable.html +8 -8
- data/doc/_index.html +7 -7
- data/doc/class_list.html +2 -2
- data/doc/css/style.css +2 -2
- data/doc/file.README.html +24 -21
- data/doc/file_list.html +2 -2
- data/doc/frames.html +2 -2
- data/doc/index.html +24 -21
- data/doc/js/app.js +14 -3
- data/doc/method_list.html +18 -2
- data/doc/top-level-namespace.html +6 -6
- data/inquery.gemspec +6 -6
- data/lib/inquery/mixins/relation_validation.rb +14 -5
- data/lib/inquery/mixins/schema_validation.rb +14 -3
- data/lib/inquery/query.rb +2 -2
- metadata +11 -11
@@ -6,15 +6,15 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Inquery::Mixins::SchemaValidation::ClassMethods
|
8
8
|
|
9
|
-
— Documentation by YARD 0.9.
|
9
|
+
— Documentation by YARD 0.9.25
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
13
|
-
<link rel="stylesheet" href="../../../css/style.css" type="text/css"
|
13
|
+
<link rel="stylesheet" href="../../../css/style.css" type="text/css" />
|
14
14
|
|
15
|
-
<link rel="stylesheet" href="../../../css/common.css" type="text/css"
|
15
|
+
<link rel="stylesheet" href="../../../css/common.css" type="text/css" />
|
16
16
|
|
17
|
-
<script type="text/javascript"
|
17
|
+
<script type="text/javascript">
|
18
18
|
pathId = "Inquery::Mixins::SchemaValidation::ClassMethods";
|
19
19
|
relpath = '../../../';
|
20
20
|
</script>
|
@@ -115,6 +115,50 @@
|
|
115
115
|
|
116
116
|
|
117
117
|
|
118
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
119
|
+
|
120
|
+
</li>
|
121
|
+
|
122
|
+
|
123
|
+
<li class="public ">
|
124
|
+
<span class="summary_signature">
|
125
|
+
|
126
|
+
<a href="#schema2-instance_method" title="#schema2 (instance method)">#<strong>schema2</strong>(*args, &block) ⇒ Object </a>
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
</span>
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
141
|
+
|
142
|
+
</li>
|
143
|
+
|
144
|
+
|
145
|
+
<li class="public ">
|
146
|
+
<span class="summary_signature">
|
147
|
+
|
148
|
+
<a href="#schema3-instance_method" title="#schema3 (instance method)">#<strong>schema3</strong>(reference = nil, **options, &block) ⇒ Object </a>
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
</span>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
118
162
|
<span class="summary_desc"><div class='inline'></div></span>
|
119
163
|
|
120
164
|
</li>
|
@@ -138,6 +182,52 @@
|
|
138
182
|
|
139
183
|
|
140
184
|
|
185
|
+
</h3><div class="docstring">
|
186
|
+
<div class="discussion">
|
187
|
+
|
188
|
+
|
189
|
+
</div>
|
190
|
+
</div>
|
191
|
+
<div class="tags">
|
192
|
+
|
193
|
+
|
194
|
+
<p class="tag_title">See Also:</p>
|
195
|
+
<ul class="see">
|
196
|
+
|
197
|
+
<li><span class='object_link'><a href="#schema2-instance_method" title="Inquery::Mixins::SchemaValidation::ClassMethods#schema2 (method)">#schema2</a></span></li>
|
198
|
+
|
199
|
+
</ul>
|
200
|
+
|
201
|
+
</div><table class="source_code">
|
202
|
+
<tr>
|
203
|
+
<td>
|
204
|
+
<pre class="lines">
|
205
|
+
|
206
|
+
|
207
|
+
25
|
208
|
+
26
|
209
|
+
27</pre>
|
210
|
+
</td>
|
211
|
+
<td>
|
212
|
+
<pre class="code"><span class="info file"># File 'lib/inquery/mixins/schema_validation.rb', line 25</span>
|
213
|
+
|
214
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_schema'>schema</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
215
|
+
<span class='id identifier rubyid_schema2'>schema2</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
216
|
+
<span class='kw'>end</span></pre>
|
217
|
+
</td>
|
218
|
+
</tr>
|
219
|
+
</table>
|
220
|
+
</div>
|
221
|
+
|
222
|
+
<div class="method_details ">
|
223
|
+
<h3 class="signature " id="schema2-instance_method">
|
224
|
+
|
225
|
+
#<strong>schema2</strong>(*args, &block) ⇒ <tt>Object</tt>
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
141
231
|
</h3><table class="source_code">
|
142
232
|
<tr>
|
143
233
|
<td>
|
@@ -146,17 +236,51 @@
|
|
146
236
|
|
147
237
|
12
|
148
238
|
13
|
149
|
-
14
|
150
|
-
15
|
151
|
-
16</pre>
|
239
|
+
14</pre>
|
152
240
|
</td>
|
153
241
|
<td>
|
154
242
|
<pre class="code"><span class="info file"># File 'lib/inquery/mixins/schema_validation.rb', line 12</span>
|
155
243
|
|
156
|
-
<span class='kw'>def</span> <span class='id identifier
|
157
|
-
<span class='id identifier
|
244
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_schema2'>schema2</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
245
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid__schema'>_schema</span> <span class='op'>=</span> <span class='const'>Schemacop</span><span class='op'>::</span><span class='const'>Schema</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
246
|
+
<span class='kw'>end</span></pre>
|
247
|
+
</td>
|
248
|
+
</tr>
|
249
|
+
</table>
|
250
|
+
</div>
|
251
|
+
|
252
|
+
<div class="method_details ">
|
253
|
+
<h3 class="signature " id="schema3-instance_method">
|
254
|
+
|
255
|
+
#<strong>schema3</strong>(reference = nil, **options, &block) ⇒ <tt>Object</tt>
|
256
|
+
|
158
257
|
|
159
|
-
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
</h3><table class="source_code">
|
262
|
+
<tr>
|
263
|
+
<td>
|
264
|
+
<pre class="lines">
|
265
|
+
|
266
|
+
|
267
|
+
16
|
268
|
+
17
|
269
|
+
18
|
270
|
+
19
|
271
|
+
20
|
272
|
+
21
|
273
|
+
22</pre>
|
274
|
+
</td>
|
275
|
+
<td>
|
276
|
+
<pre class="code"><span class="info file"># File 'lib/inquery/mixins/schema_validation.rb', line 16</span>
|
277
|
+
|
278
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_schema3'>schema3</span><span class='lparen'>(</span><span class='id identifier rubyid_reference'>reference</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
279
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_reference'>reference</span>
|
280
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid__schema'>_schema</span> <span class='op'>=</span> <span class='const'>Schemacop</span><span class='op'>::</span><span class='const'>Schema3</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:reference</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='label'>path:</span> <span class='id identifier rubyid_reference'>reference</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
281
|
+
<span class='kw'>else</span>
|
282
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid__schema'>_schema</span> <span class='op'>=</span> <span class='const'>Schemacop</span><span class='op'>::</span><span class='const'>Schema3</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:hash</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
283
|
+
<span class='kw'>end</span>
|
160
284
|
<span class='kw'>end</span></pre>
|
161
285
|
</td>
|
162
286
|
</tr>
|
@@ -168,9 +292,9 @@
|
|
168
292
|
</div>
|
169
293
|
|
170
294
|
<div id="footer">
|
171
|
-
Generated on Wed
|
295
|
+
Generated on Wed Nov 25 14:05:20 2020 by
|
172
296
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
173
|
-
0.9.
|
297
|
+
0.9.25 (ruby-2.6.2).
|
174
298
|
</div>
|
175
299
|
|
176
300
|
</div>
|
data/doc/Inquery/Query.html
CHANGED
@@ -6,15 +6,15 @@
|
|
6
6
|
<title>
|
7
7
|
Class: Inquery::Query
|
8
8
|
|
9
|
-
— Documentation by YARD 0.9.
|
9
|
+
— Documentation by YARD 0.9.25
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css"
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" />
|
14
14
|
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css"
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" />
|
16
16
|
|
17
|
-
<script type="text/javascript"
|
17
|
+
<script type="text/javascript">
|
18
18
|
pathId = "Inquery::Query";
|
19
19
|
relpath = '../';
|
20
20
|
</script>
|
@@ -421,8 +421,8 @@ was a validation schema specified).</p>
|
|
421
421
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
422
422
|
<span class='ivar'>@params</span> <span class='op'>=</span> <span class='id identifier rubyid_params'>params</span>
|
423
423
|
|
424
|
-
<span class='kw'>if</span> <span class='
|
425
|
-
<span class='
|
424
|
+
<span class='kw'>if</span> <span class='id identifier rubyid__schema'>_schema</span>
|
425
|
+
<span class='ivar'>@params</span> <span class='op'>=</span> <span class='id identifier rubyid__schema'>_schema</span><span class='period'>.</span><span class='id identifier rubyid_validate!'>validate!</span><span class='lparen'>(</span><span class='ivar'>@params</span><span class='rparen'>)</span>
|
426
426
|
<span class='kw'>end</span>
|
427
427
|
<span class='kw'>end</span></pre>
|
428
428
|
</td>
|
@@ -448,7 +448,7 @@ was a validation schema specified).</p>
|
|
448
448
|
|
449
449
|
</h3><div class="docstring">
|
450
450
|
<div class="discussion">
|
451
|
-
<p>Returns the value of attribute params
|
451
|
+
<p>Returns the value of attribute params.</p>
|
452
452
|
|
453
453
|
|
454
454
|
</div>
|
@@ -779,9 +779,9 @@ easyer access.</p>
|
|
779
779
|
</div>
|
780
780
|
|
781
781
|
<div id="footer">
|
782
|
-
Generated on Wed
|
782
|
+
Generated on Wed Nov 25 14:05:20 2020 by
|
783
783
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
784
|
-
0.9.
|
784
|
+
0.9.25 (ruby-2.6.2).
|
785
785
|
</div>
|
786
786
|
|
787
787
|
</div>
|
@@ -6,15 +6,15 @@
|
|
6
6
|
<title>
|
7
7
|
Class: Inquery::Query::Chainable
|
8
8
|
|
9
|
-
— Documentation by YARD 0.9.
|
9
|
+
— Documentation by YARD 0.9.25
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
13
|
-
<link rel="stylesheet" href="../../css/style.css" type="text/css"
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" />
|
14
14
|
|
15
|
-
<link rel="stylesheet" href="../../css/common.css" type="text/css"
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" />
|
16
16
|
|
17
|
-
<script type="text/javascript"
|
17
|
+
<script type="text/javascript">
|
18
18
|
pathId = "Inquery::Query::Chainable";
|
19
19
|
relpath = '../../';
|
20
20
|
</script>
|
@@ -321,7 +321,7 @@
|
|
321
321
|
|
322
322
|
</h3><div class="docstring">
|
323
323
|
<div class="discussion">
|
324
|
-
<p>Returns a new instance of Chainable
|
324
|
+
<p>Returns a new instance of Chainable.</p>
|
325
325
|
|
326
326
|
|
327
327
|
</div>
|
@@ -372,7 +372,7 @@
|
|
372
372
|
|
373
373
|
</h3><div class="docstring">
|
374
374
|
<div class="discussion">
|
375
|
-
<p>Returns the value of attribute relation
|
375
|
+
<p>Returns the value of attribute relation.</p>
|
376
376
|
|
377
377
|
|
378
378
|
</div>
|
@@ -529,9 +529,9 @@
|
|
529
529
|
</div>
|
530
530
|
|
531
531
|
<div id="footer">
|
532
|
-
Generated on Wed
|
532
|
+
Generated on Wed Nov 25 14:05:20 2020 by
|
533
533
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
534
|
-
0.9.
|
534
|
+
0.9.25 (ruby-2.6.2).
|
535
535
|
</div>
|
536
536
|
|
537
537
|
</div>
|
data/doc/_index.html
CHANGED
@@ -4,15 +4,15 @@
|
|
4
4
|
<meta charset="utf-8">
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
6
|
<title>
|
7
|
-
Documentation by YARD 0.9.
|
7
|
+
Documentation by YARD 0.9.25
|
8
8
|
|
9
9
|
</title>
|
10
10
|
|
11
|
-
<link rel="stylesheet" href="css/style.css" type="text/css"
|
11
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
12
12
|
|
13
|
-
<link rel="stylesheet" href="css/common.css" type="text/css"
|
13
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
14
14
|
|
15
|
-
<script type="text/javascript"
|
15
|
+
<script type="text/javascript">
|
16
16
|
pathId = null;
|
17
17
|
relpath = '';
|
18
18
|
</script>
|
@@ -52,7 +52,7 @@
|
|
52
52
|
<div class="clear"></div>
|
53
53
|
</div>
|
54
54
|
|
55
|
-
<div id="content"><h1 class="noborder title">Documentation by YARD 0.9.
|
55
|
+
<div id="content"><h1 class="noborder title">Documentation by YARD 0.9.25</h1>
|
56
56
|
<div id="listing">
|
57
57
|
<h1 class="alphaindex">Alphabetic Index</h1>
|
58
58
|
|
@@ -248,9 +248,9 @@
|
|
248
248
|
</div>
|
249
249
|
|
250
250
|
<div id="footer">
|
251
|
-
Generated on Wed
|
251
|
+
Generated on Wed Nov 25 14:05:19 2020 by
|
252
252
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
253
|
-
0.9.
|
253
|
+
0.9.25 (ruby-2.6.2).
|
254
254
|
</div>
|
255
255
|
|
256
256
|
</div>
|
data/doc/class_list.html
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
5
|
<meta charset="utf-8" />
|
6
6
|
|
7
|
-
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen"
|
7
|
+
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" />
|
8
8
|
|
9
|
-
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen"
|
9
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" />
|
10
10
|
|
11
11
|
|
12
12
|
|
data/doc/css/style.css
CHANGED
@@ -422,8 +422,8 @@ li.r2 { background: #fafafa; }
|
|
422
422
|
#toc ol { padding-left: 1.8em; }
|
423
423
|
#toc li { font-size: 1.1em; line-height: 1.7em; }
|
424
424
|
#toc > ol > li { font-size: 1.1em; font-weight: bold; }
|
425
|
-
#toc ol > ol { font-size: 0.9em; }
|
426
|
-
#toc ol ol > ol { padding-left: 2.3em; }
|
425
|
+
#toc ol > li > ol { font-size: 0.9em; }
|
426
|
+
#toc ol ol > li > ol { padding-left: 2.3em; }
|
427
427
|
#toc ol + li { margin-top: 0.3em; }
|
428
428
|
#toc.hidden { padding: 10px; background: #fefefe; box-shadow: none; }
|
429
429
|
#toc.hidden:hover { background: #fafafa; }
|
data/doc/file.README.html
CHANGED
@@ -6,15 +6,15 @@
|
|
6
6
|
<title>
|
7
7
|
File: README
|
8
8
|
|
9
|
-
— Documentation by YARD 0.9.
|
9
|
+
— Documentation by YARD 0.9.25
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css"
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
14
14
|
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css"
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
16
16
|
|
17
|
-
<script type="text/javascript"
|
17
|
+
<script type="text/javascript">
|
18
18
|
pathId = "README";
|
19
19
|
relpath = '';
|
20
20
|
</script>
|
@@ -60,11 +60,11 @@
|
|
60
60
|
<div id="content"><div id='filecontents'><p><a href="https://travis-ci.org/sitrox/inquery"><img src="https://travis-ci.org/sitrox/inquery.svg?branch=master" alt="Build Status"></a>
|
61
61
|
<a href="https://badge.fury.io/rb/inquery"><img src="https://badge.fury.io/rb/inquery.svg" alt="Gem Version"></a></p>
|
62
62
|
|
63
|
-
<h1>Inquery</h1>
|
63
|
+
<h1 id="inquery">Inquery</h1>
|
64
64
|
|
65
65
|
<p>A skeleton that allows extracting queries into atomic, reusable classes.</p>
|
66
66
|
|
67
|
-
<h2>Installation</h2>
|
67
|
+
<h2 id="installation">Installation</h2>
|
68
68
|
|
69
69
|
<p>To install the <strong>Inquery</strong> gem:</p>
|
70
70
|
|
@@ -77,7 +77,7 @@ to your <code>Gemfile</code>:</p>
|
|
77
77
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>inquery</span><span class='tstring_end'>'</span></span>
|
78
78
|
</code></pre>
|
79
79
|
|
80
|
-
<h2>Basic usage</h2>
|
80
|
+
<h2 id="basic-usage">Basic usage</h2>
|
81
81
|
|
82
82
|
<pre class="code ruby"><code class="ruby"><span class='kw'>class</span> <span class='const'>FetchUsersWithACar</span> <span class='op'><</span> <span class='const'><span class='object_link'><a href="Inquery.html" title="Inquery (module)">Inquery</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Inquery/Query.html" title="Inquery::Query (class)">Query</a></span></span>
|
83
83
|
<span class='id identifier rubyid_schema'>schema</span> <span class='kw'>do</span>
|
@@ -97,7 +97,7 @@ to your <code>Gemfile</code>:</p>
|
|
97
97
|
and <span class='object_link'><a href="Inquery/Query/Chainable.html" title="Inquery::Query::Chainable (class)">Inquery::Query::Chainable</a></span>. See the following sections for detailed
|
98
98
|
explanations.</p>
|
99
99
|
|
100
|
-
<h2>Basic queries</h2>
|
100
|
+
<h2 id="basic-queries">Basic queries</h2>
|
101
101
|
|
102
102
|
<p>Basic queries inherit from <span class='object_link'><a href="Inquery/Query.html" title="Inquery::Query (class)">Inquery::Query</a></span>. They receive an optional set of
|
103
103
|
parameters and commonly return a relation / AR result. An optional <code>process</code>
|
@@ -141,7 +141,7 @@ the <code>call</code> and optionally the <code>process</code> method:</p>
|
|
141
141
|
<p>Note that it's perfectly fine for some queries to return <code>nil</code>, i.e. if they're
|
142
142
|
writing queries that don't fetch any results.</p>
|
143
143
|
|
144
|
-
<h3>Using raw SQL</h3>
|
144
|
+
<h3 id="using-raw-sql">Using raw SQL</h3>
|
145
145
|
|
146
146
|
<p>In some cases it may make sense to push down all computation to the database and
|
147
147
|
only construct an SQL query for this purpose. To facilitate this,
|
@@ -171,7 +171,7 @@ only construct an SQL query for this purpose. To facilitate this,
|
|
171
171
|
<span class='kw'>end</span>
|
172
172
|
</code></pre>
|
173
173
|
|
174
|
-
<h2>Chainable queries</h2>
|
174
|
+
<h2 id="chainable-queries">Chainable queries</h2>
|
175
175
|
|
176
176
|
<p>Chainable queries are queries that input and output an Active Record relation.
|
177
177
|
You can access the given relation using the method <code>relation</code>:</p>
|
@@ -187,7 +187,7 @@ You can access the given relation using the method <code>relation</code>:</p>
|
|
187
187
|
could pass a relation of <code>Group</code>s and receive back a relation of corresponding
|
188
188
|
<code>User</code>s).</p>
|
189
189
|
|
190
|
-
<h3>Relation validation</h3>
|
190
|
+
<h3 id="relation-validation">Relation validation</h3>
|
191
191
|
|
192
192
|
<p>Chainable queries allow you to further specify and validate the relation it
|
193
193
|
receives. This is done using the static <code>relation</code> method:</p>
|
@@ -229,7 +229,7 @@ automatically select the given field. This option defaults to <code>:id</code>.
|
|
229
229
|
<code>nil</code> to disable this behavior.</p></li>
|
230
230
|
</ul>
|
231
231
|
|
232
|
-
<h3>Using query classes as regular scopes</h3>
|
232
|
+
<h3 id="using-query-classes-as-regular-scopes">Using query classes as regular scopes</h3>
|
233
233
|
|
234
234
|
<p>Chainable queries can also be used as regular AR model scopes:</p>
|
235
235
|
|
@@ -255,7 +255,7 @@ but have the possibly complex query code hidden in a separate, reusable class.</
|
|
255
255
|
|
256
256
|
<p>Note that when using classes as scopes, the <code>process</code> method will be ignored.</p>
|
257
257
|
|
258
|
-
<h3>Using the given relation as subquery</h3>
|
258
|
+
<h3 id="using-the-given-relation-as-subquery">Using the given relation as subquery</h3>
|
259
259
|
|
260
260
|
<p>In simple cases and all the examples above, we just extend the given relation
|
261
261
|
and return it again. It is also possible however to just use the given relation
|
@@ -291,7 +291,7 @@ as a subquery and return a completely new relation:</p>
|
|
291
291
|
</span><span class='const'>FetchUsersInGroup</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='const'>Group</span><span class='period'>.</span><span class='id identifier rubyid_where'>where</span><span class='lparen'>(</span><span class='label'>color:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>red</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
292
292
|
</code></pre>
|
293
293
|
|
294
|
-
<h2>Parameters</h2>
|
294
|
+
<h2 id="parameters">Parameters</h2>
|
295
295
|
|
296
296
|
<p>Both query classes can be parameterized using a hash called <code>params</code>. It is
|
297
297
|
recommended to specify and validate input parameters in every query. For this
|
@@ -328,14 +328,17 @@ access.</p>
|
|
328
328
|
<span class='kw'>end</span>
|
329
329
|
</code></pre>
|
330
330
|
|
331
|
-
<
|
331
|
+
<p>Inquery supports both schemacop specification versions 2 and 3 using the methods
|
332
|
+
<code>schema</code> / <code>schema2</code> for version 2 and method <code>schema3</code> for version 3.</p>
|
333
|
+
|
334
|
+
<h2 id="rails-integration">Rails integration</h2>
|
332
335
|
|
333
336
|
<p>While it is optional, Inquery has been written from the ground up to be
|
334
337
|
perfectly integrated into any Rails application. It has proven to be a winning
|
335
338
|
concept to extract all complex queries into separate classes that are
|
336
339
|
independently executable and testable.</p>
|
337
340
|
|
338
|
-
<h3>Directory structure</h3>
|
341
|
+
<h3 id="directory-structure">Directory structure</h3>
|
339
342
|
|
340
343
|
<p>While not enforced, it is encouraged to use the following structure for storing
|
341
344
|
your query classes:</p>
|
@@ -363,20 +366,20 @@ clear where to find the corresponding unit tests for each one of your
|
|
363
366
|
query classes.</li>
|
364
367
|
</ul>
|
365
368
|
|
366
|
-
<h2>Contributors</h2>
|
369
|
+
<h2 id="contributors">Contributors</h2>
|
367
370
|
|
368
371
|
<p>Thanks to Jeroen Weeink for his insights regarding using query classes as scopes
|
369
372
|
in his <a href="http://craftingruby.com/posts/2015/06/29/query-objects-through-scopes.html">blog post</a>.</p>
|
370
373
|
|
371
|
-
<h2>Copyright</h2>
|
374
|
+
<h2 id="copyright">Copyright</h2>
|
372
375
|
|
373
|
-
<p>Copyright (c)
|
376
|
+
<p>Copyright (c) 2020 Sitrox. See <code>LICENSE</code> for further details.</p>
|
374
377
|
</div></div>
|
375
378
|
|
376
379
|
<div id="footer">
|
377
|
-
Generated on Wed
|
380
|
+
Generated on Wed Nov 25 14:05:20 2020 by
|
378
381
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
379
|
-
0.9.
|
382
|
+
0.9.25 (ruby-2.6.2).
|
380
383
|
</div>
|
381
384
|
|
382
385
|
</div>
|