inquery 0.1.0 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +26 -0
  3. data/LICENSE +2 -2
  4. data/README.md +41 -13
  5. data/RUBY_VERSION +1 -1
  6. data/Rakefile +2 -2
  7. data/VERSION +1 -1
  8. data/doc/Inquery.html +7 -7
  9. data/doc/Inquery/Exceptions.html +6 -6
  10. data/doc/Inquery/Exceptions/Base.html +6 -6
  11. data/doc/Inquery/Exceptions/InvalidRelation.html +6 -6
  12. data/doc/Inquery/Exceptions/UnknownCallSignature.html +6 -6
  13. data/doc/Inquery/Mixins.html +9 -9
  14. data/doc/Inquery/Mixins/RawSqlUtils.html +116 -0
  15. data/doc/Inquery/Mixins/RelationValidation.html +40 -36
  16. data/doc/Inquery/Mixins/RelationValidation/ClassMethods.html +12 -12
  17. data/doc/Inquery/Mixins/SchemaValidation.html +6 -6
  18. data/doc/Inquery/Mixins/SchemaValidation/ClassMethods.html +14 -20
  19. data/doc/Inquery/Query.html +105 -34
  20. data/doc/Inquery/Query/Chainable.html +78 -8
  21. data/doc/_index.html +18 -11
  22. data/doc/class_list.html +3 -3
  23. data/doc/css/style.css +12 -8
  24. data/doc/file.README.html +60 -33
  25. data/doc/file_list.html +2 -2
  26. data/doc/frames.html +2 -2
  27. data/doc/index.html +60 -33
  28. data/doc/js/app.js +69 -3
  29. data/doc/method_list.html +26 -10
  30. data/doc/top-level-namespace.html +6 -6
  31. data/inquery.gemspec +11 -11
  32. data/lib/inquery.rb +1 -0
  33. data/lib/inquery/mixins/raw_sql_utils.rb +23 -0
  34. data/lib/inquery/mixins/relation_validation.rb +16 -9
  35. data/lib/inquery/mixins/schema_validation.rb +5 -8
  36. data/lib/inquery/query.rb +9 -2
  37. data/lib/inquery/query/chainable.rb +5 -0
  38. data/test/inquery/query/chainable_test.rb +1 -1
  39. data/test/inquery/query_test.rb +2 -2
  40. data/test/queries/group/filter_with_color.rb +3 -1
  41. data/test/queries/user/fetch_in_group.rb +3 -3
  42. metadata +20 -18
@@ -6,15 +6,15 @@
6
6
  <title>
7
7
  Class: Inquery::Query::Chainable
8
8
 
9
- &mdash; Documentation by YARD 0.9.9
9
+ &mdash; Documentation by YARD 0.9.25
10
10
 
11
11
  </title>
12
12
 
13
- <link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
13
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" />
14
14
 
15
- <link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
15
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" />
16
16
 
17
- <script type="text/javascript" charset="utf-8">
17
+ <script type="text/javascript">
18
18
  pathId = "Inquery::Query::Chainable";
19
19
  relpath = '../../';
20
20
  </script>
@@ -216,6 +216,29 @@
216
216
 
217
217
  <span class="summary_desc"><div class='inline'></div></span>
218
218
 
219
+ </li>
220
+
221
+
222
+ <li class="public ">
223
+ <span class="summary_signature">
224
+
225
+ <a href="#connection-instance_method" title="#connection (instance method)">#<strong>connection</strong> &#x21d2; Object </a>
226
+
227
+
228
+
229
+ </span>
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+ <span class="summary_desc"><div class='inline'><p>Override the connection method to (re-)use the connection of the relation.</p>
240
+ </div></span>
241
+
219
242
  </li>
220
243
 
221
244
 
@@ -277,6 +300,13 @@
277
300
 
278
301
 
279
302
 
303
+
304
+
305
+
306
+
307
+
308
+
309
+
280
310
  <div id="constructor_details" class="method_details_list">
281
311
  <h2>Constructor Details</h2>
282
312
 
@@ -291,7 +321,7 @@
291
321
 
292
322
  </h3><div class="docstring">
293
323
  <div class="discussion">
294
- <p>Returns a new instance of Chainable</p>
324
+ <p>Returns a new instance of Chainable.</p>
295
325
 
296
326
 
297
327
  </div>
@@ -342,7 +372,7 @@
342
372
 
343
373
  </h3><div class="docstring">
344
374
  <div class="discussion">
345
- <p>Returns the value of attribute relation</p>
375
+ <p>Returns the value of attribute relation.</p>
346
376
 
347
377
 
348
378
  </div>
@@ -452,6 +482,46 @@
452
482
  </td>
453
483
  </tr>
454
484
  </table>
485
+ </div>
486
+
487
+ <div class="method_details ">
488
+ <h3 class="signature " id="connection-instance_method">
489
+
490
+ #<strong>connection</strong> &#x21d2; <tt>Object</tt>
491
+
492
+
493
+
494
+
495
+
496
+ </h3><div class="docstring">
497
+ <div class="discussion">
498
+ <p>Override the connection method to (re-)use the connection of the relation</p>
499
+
500
+
501
+ </div>
502
+ </div>
503
+ <div class="tags">
504
+
505
+
506
+ </div><table class="source_code">
507
+ <tr>
508
+ <td>
509
+ <pre class="lines">
510
+
511
+
512
+ 23
513
+ 24
514
+ 25</pre>
515
+ </td>
516
+ <td>
517
+ <pre class="code"><span class="info file"># File 'lib/inquery/query/chainable.rb', line 23</span>
518
+
519
+ <span class='kw'>def</span> <span class='id identifier rubyid_connection'>connection</span>
520
+ <span class='ivar'>@relation</span><span class='period'>.</span><span class='id identifier rubyid_connection'>connection</span>
521
+ <span class='kw'>end</span></pre>
522
+ </td>
523
+ </tr>
524
+ </table>
455
525
  </div>
456
526
 
457
527
  </div>
@@ -459,9 +529,9 @@
459
529
  </div>
460
530
 
461
531
  <div id="footer">
462
- Generated on Tue May 16 10:49:05 2017 by
532
+ Generated on Tue Nov 24 16:32:43 2020 by
463
533
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
464
- 0.9.9 (ruby-2.3.1).
534
+ 0.9.25 (ruby-2.6.2).
465
535
  </div>
466
536
 
467
537
  </div>
@@ -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.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" charset="utf-8" />
11
+ <link rel="stylesheet" href="css/style.css" type="text/css" />
12
12
 
13
- <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
13
+ <link rel="stylesheet" href="css/common.css" type="text/css" />
14
14
 
15
- <script type="text/javascript" charset="utf-8">
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.9</h1>
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
 
@@ -103,16 +103,16 @@
103
103
  </li>
104
104
 
105
105
  <li>
106
- <span class='object_link'><a href="Inquery/Mixins/SchemaValidation/ClassMethods.html" title="Inquery::Mixins::SchemaValidation::ClassMethods (module)">ClassMethods</a></span>
106
+ <span class='object_link'><a href="Inquery/Mixins/RelationValidation/ClassMethods.html" title="Inquery::Mixins::RelationValidation::ClassMethods (module)">ClassMethods</a></span>
107
107
 
108
- <small>(Inquery::Mixins::SchemaValidation)</small>
108
+ <small>(Inquery::Mixins::RelationValidation)</small>
109
109
 
110
110
  </li>
111
111
 
112
112
  <li>
113
- <span class='object_link'><a href="Inquery/Mixins/RelationValidation/ClassMethods.html" title="Inquery::Mixins::RelationValidation::ClassMethods (module)">ClassMethods</a></span>
113
+ <span class='object_link'><a href="Inquery/Mixins/SchemaValidation/ClassMethods.html" title="Inquery::Mixins::SchemaValidation::ClassMethods (module)">ClassMethods</a></span>
114
114
 
115
- <small>(Inquery::Mixins::RelationValidation)</small>
115
+ <small>(Inquery::Mixins::SchemaValidation)</small>
116
116
 
117
117
  </li>
118
118
 
@@ -189,6 +189,13 @@
189
189
  <li class="letter">R</li>
190
190
  <ul>
191
191
 
192
+ <li>
193
+ <span class='object_link'><a href="Inquery/Mixins/RawSqlUtils.html" title="Inquery::Mixins::RawSqlUtils (module)">RawSqlUtils</a></span>
194
+
195
+ <small>(Inquery::Mixins)</small>
196
+
197
+ </li>
198
+
192
199
  <li>
193
200
  <span class='object_link'><a href="Inquery/Mixins/RelationValidation.html" title="Inquery::Mixins::RelationValidation (module)">RelationValidation</a></span>
194
201
 
@@ -241,9 +248,9 @@
241
248
  </div>
242
249
 
243
250
  <div id="footer">
244
- Generated on Tue May 16 10:49:05 2017 by
251
+ Generated on Tue Nov 24 16:32:43 2020 by
245
252
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
246
- 0.9.9 (ruby-2.3.1).
253
+ 0.9.25 (ruby-2.6.2).
247
254
  </div>
248
255
 
249
256
  </div>
@@ -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" charset="utf-8" />
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" charset="utf-8" />
9
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" />
10
10
 
11
11
 
12
12
 
@@ -43,7 +43,7 @@
43
43
 
44
44
  <ul id="full_list" class="class">
45
45
  <li id="object_" class="odd"><div class="item" style="padding-left:30px"><span class='object_link'><a href="top-level-namespace.html" title="Top Level Namespace (root)">Top Level Namespace</a></span></div></li>
46
- <li id='object_Inquery' class='even'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="Inquery.html" title="Inquery (module)">Inquery</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_Inquery::Exceptions' class='collapsed odd'><div class='item' style='padding-left:45px'><a class='toggle'></a> <span class='object_link'><a href="Inquery/Exceptions.html" title="Inquery::Exceptions (module)">Exceptions</a></span><small class='search_info'>Inquery</small></div><ul><li id='object_Inquery::Exceptions::Base' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Inquery/Exceptions/Base.html" title="Inquery::Exceptions::Base (class)">Base</a></span> &lt; StandardError<small class='search_info'>Inquery::Exceptions</small></div></li><li id='object_Inquery::Exceptions::InvalidRelation' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Inquery/Exceptions/InvalidRelation.html" title="Inquery::Exceptions::InvalidRelation (class)">InvalidRelation</a></span> &lt; Base<small class='search_info'>Inquery::Exceptions</small></div></li><li id='object_Inquery::Exceptions::UnknownCallSignature' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Inquery/Exceptions/UnknownCallSignature.html" title="Inquery::Exceptions::UnknownCallSignature (class)">UnknownCallSignature</a></span> &lt; Base<small class='search_info'>Inquery::Exceptions</small></div></li></ul></li><li id='object_Inquery::Mixins' class='collapsed even'><div class='item' style='padding-left:45px'><a class='toggle'></a> <span class='object_link'><a href="Inquery/Mixins.html" title="Inquery::Mixins (module)">Mixins</a></span><small class='search_info'>Inquery</small></div><ul><li id='object_Inquery::Mixins::RelationValidation' class='collapsed'><div class='item' style='padding-left:60px'><a class='toggle'></a> <span class='object_link'><a href="Inquery/Mixins/RelationValidation.html" title="Inquery::Mixins::RelationValidation (module)">RelationValidation</a></span><small class='search_info'>Inquery::Mixins</small></div><ul><li id='object_Inquery::Mixins::RelationValidation::ClassMethods' class='collapsed'><div class='item' style='padding-left:75px'><span class='object_link'><a href="Inquery/Mixins/RelationValidation/ClassMethods.html" title="Inquery::Mixins::RelationValidation::ClassMethods (module)">ClassMethods</a></span><small class='search_info'>Inquery::Mixins::RelationValidation</small></div></li></ul></li><li id='object_Inquery::Mixins::SchemaValidation' class='collapsed'><div class='item' style='padding-left:60px'><a class='toggle'></a> <span class='object_link'><a href="Inquery/Mixins/SchemaValidation.html" title="Inquery::Mixins::SchemaValidation (module)">SchemaValidation</a></span><small class='search_info'>Inquery::Mixins</small></div><ul><li id='object_Inquery::Mixins::SchemaValidation::ClassMethods' class='collapsed'><div class='item' style='padding-left:75px'><span class='object_link'><a href="Inquery/Mixins/SchemaValidation/ClassMethods.html" title="Inquery::Mixins::SchemaValidation::ClassMethods (module)">ClassMethods</a></span><small class='search_info'>Inquery::Mixins::SchemaValidation</small></div></li></ul></li></ul></li><li id='object_Inquery::Query' class='collapsed odd'><div class='item' style='padding-left:45px'><a class='toggle'></a> <span class='object_link'><a href="Inquery/Query.html" title="Inquery::Query (class)">Query</a></span> &lt; Object<small class='search_info'>Inquery</small></div><ul><li id='object_Inquery::Query::Chainable' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Inquery/Query/Chainable.html" title="Inquery::Query::Chainable (class)">Chainable</a></span> &lt; Query<small class='search_info'>Inquery::Query</small></div></li></ul></li></ul></li>
46
+ <li id='object_Inquery' class='even'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="Inquery.html" title="Inquery (module)">Inquery</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_Inquery::Exceptions' class='collapsed odd'><div class='item' style='padding-left:45px'><a class='toggle'></a> <span class='object_link'><a href="Inquery/Exceptions.html" title="Inquery::Exceptions (module)">Exceptions</a></span><small class='search_info'>Inquery</small></div><ul><li id='object_Inquery::Exceptions::Base' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Inquery/Exceptions/Base.html" title="Inquery::Exceptions::Base (class)">Base</a></span> &lt; StandardError<small class='search_info'>Inquery::Exceptions</small></div></li><li id='object_Inquery::Exceptions::InvalidRelation' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Inquery/Exceptions/InvalidRelation.html" title="Inquery::Exceptions::InvalidRelation (class)">InvalidRelation</a></span> &lt; Base<small class='search_info'>Inquery::Exceptions</small></div></li><li id='object_Inquery::Exceptions::UnknownCallSignature' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Inquery/Exceptions/UnknownCallSignature.html" title="Inquery::Exceptions::UnknownCallSignature (class)">UnknownCallSignature</a></span> &lt; Base<small class='search_info'>Inquery::Exceptions</small></div></li></ul></li><li id='object_Inquery::Mixins' class='collapsed even'><div class='item' style='padding-left:45px'><a class='toggle'></a> <span class='object_link'><a href="Inquery/Mixins.html" title="Inquery::Mixins (module)">Mixins</a></span><small class='search_info'>Inquery</small></div><ul><li id='object_Inquery::Mixins::RawSqlUtils' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Inquery/Mixins/RawSqlUtils.html" title="Inquery::Mixins::RawSqlUtils (module)">RawSqlUtils</a></span><small class='search_info'>Inquery::Mixins</small></div></li><li id='object_Inquery::Mixins::RelationValidation' class='collapsed'><div class='item' style='padding-left:60px'><a class='toggle'></a> <span class='object_link'><a href="Inquery/Mixins/RelationValidation.html" title="Inquery::Mixins::RelationValidation (module)">RelationValidation</a></span><small class='search_info'>Inquery::Mixins</small></div><ul><li id='object_Inquery::Mixins::RelationValidation::ClassMethods' class='collapsed'><div class='item' style='padding-left:75px'><span class='object_link'><a href="Inquery/Mixins/RelationValidation/ClassMethods.html" title="Inquery::Mixins::RelationValidation::ClassMethods (module)">ClassMethods</a></span><small class='search_info'>Inquery::Mixins::RelationValidation</small></div></li></ul></li><li id='object_Inquery::Mixins::SchemaValidation' class='collapsed'><div class='item' style='padding-left:60px'><a class='toggle'></a> <span class='object_link'><a href="Inquery/Mixins/SchemaValidation.html" title="Inquery::Mixins::SchemaValidation (module)">SchemaValidation</a></span><small class='search_info'>Inquery::Mixins</small></div><ul><li id='object_Inquery::Mixins::SchemaValidation::ClassMethods' class='collapsed'><div class='item' style='padding-left:75px'><span class='object_link'><a href="Inquery/Mixins/SchemaValidation/ClassMethods.html" title="Inquery::Mixins::SchemaValidation::ClassMethods (module)">ClassMethods</a></span><small class='search_info'>Inquery::Mixins::SchemaValidation</small></div></li></ul></li></ul></li><li id='object_Inquery::Query' class='collapsed odd'><div class='item' style='padding-left:45px'><a class='toggle'></a> <span class='object_link'><a href="Inquery/Query.html" title="Inquery::Query (class)">Query</a></span> &lt; Object<small class='search_info'>Inquery</small></div><ul><li id='object_Inquery::Query::Chainable' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Inquery/Query/Chainable.html" title="Inquery::Query::Chainable (class)">Chainable</a></span> &lt; Query<small class='search_info'>Inquery::Query</small></div></li></ul></li></ul></li>
47
47
 
48
48
  </ul>
49
49
  </div>
@@ -245,6 +245,7 @@ ul.toplevel { list-style: none; padding-left: 0; font-size: 1.1em; }
245
245
 
246
246
  dl.constants { margin-left: 10px; }
247
247
  dl.constants dt { font-weight: bold; font-size: 1.1em; margin-bottom: 5px; }
248
+ dl.constants.compact dt { display: inline-block; font-weight: normal }
248
249
  dl.constants dd { width: 75%; white-space: pre; font-family: monospace; margin-bottom: 18px; }
249
250
  dl.constants .docstring .note:first-child { margin-top: 5px; }
250
251
 
@@ -326,13 +327,9 @@ ul.summary a, ul.summary a:visited {
326
327
  text-decoration: none; font-size: 1.1em;
327
328
  }
328
329
  ul.summary li { margin-bottom: 5px; }
329
- .summary .summary_signature {
330
- padding: 4px 8px;
331
- background: #f8f8f8;
332
- border: 1px solid #f0f0f0;
333
- border-radius: 5px;
334
- }
330
+ .summary_signature { padding: 4px 8px; background: #f8f8f8; border: 1px solid #f0f0f0; border-radius: 5px; }
335
331
  .summary_signature:hover { background: #CFEBFF; border-color: #A4CCDA; cursor: pointer; }
332
+ .summary_signature.deprecated { background: #ffe5e5; border-color: #e9dada; }
336
333
  ul.summary.compact li { display: inline-block; margin: 0px 5px 0px 0px; line-height: 2.6em;}
337
334
  ul.summary.compact .summary_signature { padding: 5px 7px; padding-right: 4px; }
338
335
  #content .summary_signature:hover a,
@@ -425,8 +422,8 @@ li.r2 { background: #fafafa; }
425
422
  #toc ol { padding-left: 1.8em; }
426
423
  #toc li { font-size: 1.1em; line-height: 1.7em; }
427
424
  #toc > ol > li { font-size: 1.1em; font-weight: bold; }
428
- #toc ol > ol { font-size: 0.9em; }
429
- #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; }
430
427
  #toc ol + li { margin-top: 0.3em; }
431
428
  #toc.hidden { padding: 10px; background: #fefefe; box-shadow: none; }
432
429
  #toc.hidden:hover { background: #fafafa; }
@@ -484,6 +481,13 @@ pre.code .rubyid_backref,
484
481
  pre.code .rubyid_nth_ref { color: #6D79DE; }
485
482
  pre.code .regexp, .dregexp { color: #036A07; }
486
483
  pre.code a { border-bottom: 1px dotted #bbf; }
484
+ /* inline code */
485
+ *:not(pre) > code {
486
+ padding: 1px 3px 1px 3px;
487
+ border: 1px solid #E1E1E8;
488
+ background: #F7F7F9;
489
+ border-radius: 4px;
490
+ }
487
491
 
488
492
  /* Color fix for links */
489
493
  #content .summary_desc pre.code .id > .object_link a, /* identifier */
@@ -6,15 +6,15 @@
6
6
  <title>
7
7
  File: README
8
8
 
9
- &mdash; Documentation by YARD 0.9.9
9
+ &mdash; Documentation by YARD 0.9.25
10
10
 
11
11
  </title>
12
12
 
13
- <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" />
14
14
 
15
- <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" />
16
16
 
17
- <script type="text/javascript" charset="utf-8">
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,12 +77,12 @@ 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'>&#39;</span><span class='tstring_content'>inquery</span><span class='tstring_end'>&#39;</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'>&lt;</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
- <span class='id identifier rubyid_schema'>schema</span><span class='lparen'>(</span>
84
- <span class='label'>color:</span> <span class='symbol'>:symbol</span>
85
- <span class='rparen'>)</span>
83
+ <span class='id identifier rubyid_schema'>schema</span> <span class='kw'>do</span>
84
+ <span class='id identifier rubyid_req'>req</span> <span class='symbol'>:color</span><span class='comma'>,</span> <span class='symbol'>:symbol</span>
85
+ <span class='kw'>end</span>
86
86
 
87
87
  <span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span>
88
88
  <span class='const'>User</span><span class='period'>.</span><span class='id identifier rubyid_joins'>joins</span><span class='lparen'>(</span><span class='symbol'>:cars</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_where'>where</span><span class='lparen'>(</span><span class='label'>cars:</span> <span class='lbrace'>{</span> <span class='label'>color:</span> <span class='id identifier rubyid_osparams'>osparams</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span> <span class='rbrace'>}</span><span class='rparen'>)</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,37 @@ the <code>call</code> and optionally the <code>process</code> method:</p>
141
141
  <p>Note that it&#39;s perfectly fine for some queries to return <code>nil</code>, i.e. if they&#39;re
142
142
  writing queries that don&#39;t fetch any results.</p>
143
143
 
144
- <h2>Chainable queries</h2>
144
+ <h3 id="using-raw-sql">Using raw SQL</h3>
145
+
146
+ <p>In some cases it may make sense to push down all computation to the database and
147
+ only construct an SQL query for this purpose. To facilitate this,
148
+ <span class='object_link'><a href="Inquery/Query.html" title="Inquery::Query (class)">Inquery::Query</a></span> provides sanitization and query execution methods:</p>
149
+
150
+ <pre class="code ruby"><code class="ruby"><span class='comment'># Note: There are better ways of achieving the same result, this is an example
151
+ </span><span class='comment'># to demonstrate the methods.
152
+ </span><span class='kw'>class</span> <span class='const'>CheckIfSold</span> <span class='op'>&lt;</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>
153
+ <span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span>
154
+ <span class='id identifier rubyid_parts'>parts</span> <span class='op'>=</span> <span class='lbracket'>[</span>
155
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>SELECT car_id FROM dealership_sales</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
156
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>SELECT car_id FROM dealership_leasings</span><span class='tstring_end'>&#39;</span></span>
157
+ <span class='rbracket'>]</span>
158
+
159
+ <span class='id identifier rubyid_sql'>sql</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>SELECT ? IN (</span><span class='tstring_end'>&#39;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_parts'>parts</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'> UNION </span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>)</span><span class='tstring_end'>&#39;</span></span>
160
+
161
+ <span class='comment'># The &#39;san&#39; method takes n+1 arguments: The SQL string and n parameters
162
+ </span> <span class='id identifier rubyid_sanitized_sql'>sanitized_sql</span> <span class='op'>=</span> <span class='id identifier rubyid_san'>san</span><span class='lparen'>(</span><span class='id identifier rubyid_sql'>sql</span><span class='comma'>,</span> <span class='id identifier rubyid_osparams'>osparams</span><span class='period'>.</span><span class='id identifier rubyid_car_id'>car_id</span><span class='rparen'>)</span>
163
+
164
+ <span class='comment'># Returns instance of ActiveRecord::Result
165
+ </span> <span class='kw'>return</span> <span class='id identifier rubyid_exec_query'>exec_query</span><span class='lparen'>(</span><span class='id identifier rubyid_sanitized_sql'>sanitized_sql</span><span class='rparen'>)</span>
166
+ <span class='kw'>end</span>
167
+
168
+ <span class='kw'>def</span> <span class='id identifier rubyid_process'>process</span><span class='lparen'>(</span><span class='id identifier rubyid_results'>results</span><span class='rparen'>)</span>
169
+ <span class='id identifier rubyid_results'>results</span><span class='period'>.</span><span class='id identifier rubyid_rows'>rows</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
170
+ <span class='kw'>end</span>
171
+ <span class='kw'>end</span>
172
+ </code></pre>
173
+
174
+ <h2 id="chainable-queries">Chainable queries</h2>
145
175
 
146
176
  <p>Chainable queries are queries that input and output an Active Record relation.
147
177
  You can access the given relation using the method <code>relation</code>:</p>
@@ -157,7 +187,7 @@ You can access the given relation using the method <code>relation</code>:</p>
157
187
  could pass a relation of <code>Group</code>s and receive back a relation of corresponding
158
188
  <code>User</code>s).</p>
159
189
 
160
- <h3>Relation validation</h3>
190
+ <h3 id="relation-validation">Relation validation</h3>
161
191
 
162
192
  <p>Chainable queries allow you to further specify and validate the relation it
163
193
  receives. This is done using the static <code>relation</code> method:</p>
@@ -199,7 +229,7 @@ automatically select the given field. This option defaults to <code>:id</code>.
199
229
  <code>nil</code> to disable this behavior.</p></li>
200
230
  </ul>
201
231
 
202
- <h3>Using query classes as regular scopes</h3>
232
+ <h3 id="using-query-classes-as-regular-scopes">Using query classes as regular scopes</h3>
203
233
 
204
234
  <p>Chainable queries can also be used as regular AR model scopes:</p>
205
235
 
@@ -225,7 +255,7 @@ but have the possibly complex query code hidden in a separate, reusable class.</
225
255
 
226
256
  <p>Note that when using classes as scopes, the <code>process</code> method will be ignored.</p>
227
257
 
228
- <h3>Using the given relation as subquery</h3>
258
+ <h3 id="using-the-given-relation-as-subquery">Using the given relation as subquery</h3>
229
259
 
230
260
  <p>In simple cases and all the examples above, we just extend the given relation
231
261
  and return it again. It is also possible however to just use the given relation
@@ -261,7 +291,7 @@ as a subquery and return a completely new relation:</p>
261
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'>&#39;</span><span class='tstring_content'>red</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
262
292
  </code></pre>
263
293
 
264
- <h2>Parameters</h2>
294
+ <h2 id="parameters">Parameters</h2>
265
295
 
266
296
  <p>Both query classes can be parameterized using a hash called <code>params</code>. It is
267
297
  recommended to specify and validate input parameters in every query. For this
@@ -269,14 +299,12 @@ purpose, Inquery provides the <code>schema</code> method witch integrates the
269
299
  <a href="https://github.com/sitrox/schemacop">Schemacop</a> validation Gem:</p>
270
300
 
271
301
  <pre class="code ruby"><code class="ruby"><span class='kw'>class</span> <span class='const'>SomeQueryClass</span> <span class='op'>&lt;</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>
272
- <span class='id identifier rubyid_schema'>schema</span><span class='lparen'>(</span>
273
- <span class='label'>some_param:</span> <span class='symbol'>:integer</span><span class='comma'>,</span>
274
- <span class='label'>some_other_param:</span> <span class='lbrace'>{</span>
275
- <span class='label'>hash:</span> <span class='lbrace'>{</span>
276
- <span class='label'>some_field:</span> <span class='symbol'>:string</span>
277
- <span class='rbrace'>}</span>
278
- <span class='rbrace'>}</span>
279
- <span class='rparen'>)</span>
302
+ <span class='id identifier rubyid_schema'>schema</span> <span class='kw'>do</span>
303
+ <span class='id identifier rubyid_req'>req</span> <span class='symbol'>:some_param</span><span class='comma'>,</span> <span class='symbol'>:integer</span>
304
+ <span class='id identifier rubyid_opt'>opt</span> <span class='symbol'>:some_other_param</span><span class='comma'>,</span> <span class='symbol'>:hash</span> <span class='kw'>do</span>
305
+ <span class='id identifier rubyid_req'>req</span> <span class='symbol'>:some_field</span><span class='comma'>,</span> <span class='symbol'>:string</span>
306
+ <span class='kw'>end</span>
307
+ <span class='kw'>end</span>
280
308
 
281
309
  <span class='comment'># ...
282
310
  </span><span class='kw'>end</span>
@@ -300,14 +328,14 @@ access.</p>
300
328
  <span class='kw'>end</span>
301
329
  </code></pre>
302
330
 
303
- <h2>Rails integration</h2>
331
+ <h2 id="rails-integration">Rails integration</h2>
304
332
 
305
333
  <p>While it is optional, Inquery has been written from the ground up to be
306
334
  perfectly integrated into any Rails application. It has proven to be a winning
307
335
  concept to extract all complex queries into separate classes that are
308
336
  independently executable and testable.</p>
309
337
 
310
- <h3>Directory structure</h3>
338
+ <h3 id="directory-structure">Directory structure</h3>
311
339
 
312
340
  <p>While not enforced, it is encouraged to use the following structure for storing
313
341
  your query classes:</p>
@@ -335,21 +363,20 @@ clear where to find the corresponding unit tests for each one of your
335
363
  query classes.</li>
336
364
  </ul>
337
365
 
338
- <h2>Contributors</h2>
366
+ <h2 id="contributors">Contributors</h2>
339
367
 
340
368
  <p>Thanks to Jeroen Weeink for his insights regarding using query classes as scopes
341
- in his <a href="http://craftingruby.com/posts/2015/06/29/query-objects-through-scopes.html">blog post</a>.
342
- And special thanks to <a href="http://www.subgit.com/">SubGit</a> for their great open source licensing.</p>
369
+ in his <a href="http://craftingruby.com/posts/2015/06/29/query-objects-through-scopes.html">blog post</a>.</p>
343
370
 
344
- <h2>Copyright</h2>
371
+ <h2 id="copyright">Copyright</h2>
345
372
 
346
- <p>Copyright (c) 2017 Sitrox. See <code>LICENSE</code> for further details.</p>
373
+ <p>Copyright (c) 2020 Sitrox. See <code>LICENSE</code> for further details.</p>
347
374
  </div></div>
348
375
 
349
376
  <div id="footer">
350
- Generated on Tue May 16 10:49:05 2017 by
377
+ Generated on Tue Nov 24 16:32:43 2020 by
351
378
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
352
- 0.9.9 (ruby-2.3.1).
379
+ 0.9.25 (ruby-2.6.2).
353
380
  </div>
354
381
 
355
382
  </div>