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
data/doc/file_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/frames.html
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8">
|
5
|
-
<title>Documentation by YARD 0.9.
|
5
|
+
<title>Documentation by YARD 0.9.25</title>
|
6
6
|
</head>
|
7
|
-
<script type="text/javascript"
|
7
|
+
<script type="text/javascript">
|
8
8
|
var match = unescape(window.location.hash).match(/^#!(.+)/);
|
9
9
|
var name = match ? match[1] : 'index.html';
|
10
10
|
name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
|
data/doc/index.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:19 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>
|
data/doc/js/app.js
CHANGED
@@ -171,6 +171,7 @@ function generateTOC() {
|
|
171
171
|
var counter = 0;
|
172
172
|
var tags = ['h2', 'h3', 'h4', 'h5', 'h6'];
|
173
173
|
var i;
|
174
|
+
var curli;
|
174
175
|
if ($('#filecontents h1').length > 1) tags.unshift('h1');
|
175
176
|
for (i = 0; i < tags.length; i++) { tags[i] = '#filecontents ' + tags[i]; }
|
176
177
|
var lastTag = parseInt(tags[0][1], 10);
|
@@ -190,15 +191,25 @@ function generateTOC() {
|
|
190
191
|
}
|
191
192
|
if (thisTag > lastTag) {
|
192
193
|
for (i = 0; i < thisTag - lastTag; i++) {
|
193
|
-
|
194
|
+
if ( typeof(curli) == "undefined" ) {
|
195
|
+
curli = $('<li/>');
|
196
|
+
toc.append(curli);
|
197
|
+
}
|
198
|
+
toc = $('<ol/>');
|
199
|
+
curli.append(toc);
|
200
|
+
curli = undefined;
|
194
201
|
}
|
195
202
|
}
|
196
203
|
if (thisTag < lastTag) {
|
197
|
-
for (i = 0; i < lastTag - thisTag; i++)
|
204
|
+
for (i = 0; i < lastTag - thisTag; i++) {
|
205
|
+
toc = toc.parent();
|
206
|
+
toc = toc.parent();
|
207
|
+
}
|
198
208
|
}
|
199
209
|
var title = $(this).attr('toc-title');
|
200
210
|
if (typeof(title) == "undefined") title = $(this).text();
|
201
|
-
|
211
|
+
curli =$('<li><a href="#' + this.id + '">' + title + '</a></li>');
|
212
|
+
toc.append(curli);
|
202
213
|
lastTag = thisTag;
|
203
214
|
});
|
204
215
|
if (!show) return;
|
data/doc/method_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
|
|
@@ -172,6 +172,22 @@
|
|
172
172
|
</li>
|
173
173
|
|
174
174
|
|
175
|
+
<li class="odd ">
|
176
|
+
<div class="item">
|
177
|
+
<span class='object_link'><a href="Inquery/Mixins/SchemaValidation/ClassMethods.html#schema2-instance_method" title="Inquery::Mixins::SchemaValidation::ClassMethods#schema2 (method)">#schema2</a></span>
|
178
|
+
<small>Inquery::Mixins::SchemaValidation::ClassMethods</small>
|
179
|
+
</div>
|
180
|
+
</li>
|
181
|
+
|
182
|
+
|
183
|
+
<li class="even ">
|
184
|
+
<div class="item">
|
185
|
+
<span class='object_link'><a href="Inquery/Mixins/SchemaValidation/ClassMethods.html#schema3-instance_method" title="Inquery::Mixins::SchemaValidation::ClassMethods#schema3 (method)">#schema3</a></span>
|
186
|
+
<small>Inquery::Mixins::SchemaValidation::ClassMethods</small>
|
187
|
+
</div>
|
188
|
+
</li>
|
189
|
+
|
190
|
+
|
175
191
|
<li class="odd ">
|
176
192
|
<div class="item">
|
177
193
|
<span class='object_link'><a href="Inquery/Mixins/RelationValidation.html#validate_relation!-instance_method" title="Inquery::Mixins::RelationValidation#validate_relation! (method)">#validate_relation!</a></span>
|
@@ -6,15 +6,15 @@
|
|
6
6
|
<title>
|
7
7
|
Top Level Namespace
|
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 = "";
|
19
19
|
relpath = '';
|
20
20
|
</script>
|
@@ -100,9 +100,9 @@
|
|
100
100
|
</div>
|
101
101
|
|
102
102
|
<div id="footer">
|
103
|
-
Generated on Wed
|
103
|
+
Generated on Wed Nov 25 14:05:20 2020 by
|
104
104
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
105
|
-
0.9.
|
105
|
+
0.9.25 (ruby-2.6.2).
|
106
106
|
</div>
|
107
107
|
|
108
108
|
</div>
|
data/inquery.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: inquery 1.0.
|
2
|
+
# stub: inquery 1.0.7 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "inquery".freeze
|
6
|
-
s.version = "1.0.
|
6
|
+
s.version = "1.0.7"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["Sitrox".freeze]
|
11
|
-
s.date = "
|
11
|
+
s.date = "2020-11-25"
|
12
12
|
s.files = [".gitignore".freeze, ".releaser_config".freeze, ".rubocop.yml".freeze, ".travis.yml".freeze, ".yardopts".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "RUBY_VERSION".freeze, "Rakefile".freeze, "VERSION".freeze, "doc/Inquery.html".freeze, "doc/Inquery/Exceptions.html".freeze, "doc/Inquery/Exceptions/Base.html".freeze, "doc/Inquery/Exceptions/InvalidRelation.html".freeze, "doc/Inquery/Exceptions/UnknownCallSignature.html".freeze, "doc/Inquery/Mixins.html".freeze, "doc/Inquery/Mixins/RawSqlUtils.html".freeze, "doc/Inquery/Mixins/RelationValidation.html".freeze, "doc/Inquery/Mixins/RelationValidation/ClassMethods.html".freeze, "doc/Inquery/Mixins/SchemaValidation.html".freeze, "doc/Inquery/Mixins/SchemaValidation/ClassMethods.html".freeze, "doc/Inquery/Query.html".freeze, "doc/Inquery/Query/Chainable.html".freeze, "doc/_index.html".freeze, "doc/class_list.html".freeze, "doc/css/common.css".freeze, "doc/css/full_list.css".freeze, "doc/css/style.css".freeze, "doc/file.README.html".freeze, "doc/file_list.html".freeze, "doc/frames.html".freeze, "doc/index.html".freeze, "doc/js/app.js".freeze, "doc/js/full_list.js".freeze, "doc/js/jquery.js".freeze, "doc/method_list.html".freeze, "doc/top-level-namespace.html".freeze, "inquery.gemspec".freeze, "lib/inquery.rb".freeze, "lib/inquery/exceptions.rb".freeze, "lib/inquery/mixins/raw_sql_utils.rb".freeze, "lib/inquery/mixins/relation_validation.rb".freeze, "lib/inquery/mixins/schema_validation.rb".freeze, "lib/inquery/query.rb".freeze, "lib/inquery/query/chainable.rb".freeze, "test/db/models.rb".freeze, "test/db/schema.rb".freeze, "test/inquery/query/chainable_test.rb".freeze, "test/inquery/query_test.rb".freeze, "test/queries/group/fetch_as_json.rb".freeze, "test/queries/group/fetch_green.rb".freeze, "test/queries/group/fetch_red.rb".freeze, "test/queries/group/filter_with_color.rb".freeze, "test/queries/user/fetch_all.rb".freeze, "test/queries/user/fetch_in_group.rb".freeze, "test/queries/user/fetch_in_group_rel.rb".freeze, "test/test_helper.rb".freeze]
|
13
13
|
s.rubygems_version = "3.0.3".freeze
|
14
14
|
s.summary = "A skeleton that allows extracting queries into atomic, reusable classes.".freeze
|
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.add_runtime_dependency(%q<minitest>.freeze, [">= 0"])
|
29
29
|
s.add_runtime_dependency(%q<activesupport>.freeze, [">= 0"])
|
30
30
|
s.add_runtime_dependency(%q<activerecord>.freeze, [">= 0"])
|
31
|
-
s.add_runtime_dependency(%q<schemacop>.freeze, ["
|
31
|
+
s.add_runtime_dependency(%q<schemacop>.freeze, [">= 2.0"])
|
32
32
|
else
|
33
33
|
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
34
34
|
s.add_dependency(%q<rake>.freeze, [">= 0"])
|
@@ -40,7 +40,7 @@ Gem::Specification.new do |s|
|
|
40
40
|
s.add_dependency(%q<minitest>.freeze, [">= 0"])
|
41
41
|
s.add_dependency(%q<activesupport>.freeze, [">= 0"])
|
42
42
|
s.add_dependency(%q<activerecord>.freeze, [">= 0"])
|
43
|
-
s.add_dependency(%q<schemacop>.freeze, ["
|
43
|
+
s.add_dependency(%q<schemacop>.freeze, [">= 2.0"])
|
44
44
|
end
|
45
45
|
else
|
46
46
|
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
@@ -53,6 +53,6 @@ Gem::Specification.new do |s|
|
|
53
53
|
s.add_dependency(%q<minitest>.freeze, [">= 0"])
|
54
54
|
s.add_dependency(%q<activesupport>.freeze, [">= 0"])
|
55
55
|
s.add_dependency(%q<activerecord>.freeze, [">= 0"])
|
56
|
-
s.add_dependency(%q<schemacop>.freeze, ["
|
56
|
+
s.add_dependency(%q<schemacop>.freeze, [">= 2.0"])
|
57
57
|
end
|
58
58
|
end
|
@@ -3,11 +3,20 @@ module Inquery
|
|
3
3
|
module RelationValidation
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
if defined?(Schemacop::Schema3)
|
7
|
+
OPTIONS_SCHEMA = Schemacop::Schema3.new(:hash) do
|
8
|
+
str? :class
|
9
|
+
int? :fields
|
10
|
+
sym? :default_select
|
11
|
+
rby? :default, [Proc, FalseClass]
|
12
|
+
end
|
13
|
+
else
|
14
|
+
OPTIONS_SCHEMA = Schemacop::Schema.new do
|
15
|
+
opt :class, :string
|
16
|
+
opt :fields, :integer
|
17
|
+
opt :default_select, :symbol
|
18
|
+
opt :default, :object, classes: [Proc, FalseClass]
|
19
|
+
end
|
11
20
|
end
|
12
21
|
|
13
22
|
DEFAULT_OPTIONS = {
|
@@ -9,10 +9,21 @@ module Inquery
|
|
9
9
|
end
|
10
10
|
|
11
11
|
module ClassMethods
|
12
|
-
def
|
13
|
-
|
12
|
+
def schema2(*args, &block)
|
13
|
+
self._schema = Schemacop::Schema.new(*args, &block)
|
14
|
+
end
|
14
15
|
|
15
|
-
|
16
|
+
def schema3(reference = nil, **options, &block)
|
17
|
+
if reference
|
18
|
+
self._schema = Schemacop::Schema3.new(:reference, options.merge(path: reference))
|
19
|
+
else
|
20
|
+
self._schema = Schemacop::Schema3.new(:hash, **options, &block)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# @see schema2
|
25
|
+
def schema(*args, &block)
|
26
|
+
schema2(*args, &block)
|
16
27
|
end
|
17
28
|
end
|
18
29
|
end
|
data/lib/inquery/query.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inquery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sitrox
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -154,18 +154,18 @@ dependencies:
|
|
154
154
|
name: schemacop
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- - "
|
157
|
+
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '2.0'
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- - "
|
164
|
+
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '2.0'
|
167
|
-
description:
|
168
|
-
email:
|
167
|
+
description:
|
168
|
+
email:
|
169
169
|
executables: []
|
170
170
|
extensions: []
|
171
171
|
extra_rdoc_files: []
|
@@ -229,10 +229,10 @@ files:
|
|
229
229
|
- test/queries/user/fetch_in_group.rb
|
230
230
|
- test/queries/user/fetch_in_group_rel.rb
|
231
231
|
- test/test_helper.rb
|
232
|
-
homepage:
|
232
|
+
homepage:
|
233
233
|
licenses: []
|
234
234
|
metadata: {}
|
235
|
-
post_install_message:
|
235
|
+
post_install_message:
|
236
236
|
rdoc_options: []
|
237
237
|
require_paths:
|
238
238
|
- lib
|
@@ -247,8 +247,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
247
|
- !ruby/object:Gem::Version
|
248
248
|
version: '0'
|
249
249
|
requirements: []
|
250
|
-
rubygems_version: 3.
|
251
|
-
signing_key:
|
250
|
+
rubygems_version: 3.1.4
|
251
|
+
signing_key:
|
252
252
|
specification_version: 4
|
253
253
|
summary: A skeleton that allows extracting queries into atomic, reusable classes.
|
254
254
|
test_files:
|