rasti-db 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -3
- data/lib/rasti/db/collection.rb +10 -1
- data/lib/rasti/db/computed_attribute.rb +22 -0
- data/lib/rasti/db/nql/nodes/attribute.rb +37 -0
- data/lib/rasti/db/nql/nodes/binary_node.rb +4 -0
- data/lib/rasti/db/nql/nodes/comparisons/base.rb +5 -1
- data/lib/rasti/db/nql/nodes/comparisons/equal.rb +2 -2
- data/lib/rasti/db/nql/nodes/comparisons/greater_than.rb +2 -2
- data/lib/rasti/db/nql/nodes/comparisons/greater_than_or_equal.rb +2 -2
- data/lib/rasti/db/nql/nodes/comparisons/include.rb +2 -2
- data/lib/rasti/db/nql/nodes/comparisons/less_than.rb +2 -2
- data/lib/rasti/db/nql/nodes/comparisons/less_than_or_equal.rb +2 -2
- data/lib/rasti/db/nql/nodes/comparisons/like.rb +2 -2
- data/lib/rasti/db/nql/nodes/comparisons/not_equal.rb +2 -2
- data/lib/rasti/db/nql/nodes/comparisons/not_include.rb +2 -2
- data/lib/rasti/db/nql/nodes/conjunction.rb +2 -2
- data/lib/rasti/db/nql/nodes/disjunction.rb +2 -2
- data/lib/rasti/db/nql/nodes/parenthesis_sentence.rb +6 -2
- data/lib/rasti/db/nql/nodes/sentence.rb +6 -2
- data/lib/rasti/db/nql/syntax.rb +33 -33
- data/lib/rasti/db/nql/syntax.treetop +12 -12
- data/lib/rasti/db/query.rb +41 -7
- data/lib/rasti/db/version.rb +1 -1
- data/spec/computed_attribute_spec.rb +32 -0
- data/spec/minitest_helper.rb +30 -3
- data/spec/model_spec.rb +1 -1
- data/spec/nql/computed_attributes_spec.rb +29 -0
- data/spec/nql/filter_condition_spec.rb +4 -2
- data/spec/nql/syntax_parser_spec.rb +12 -5
- data/spec/query_spec.rb +146 -34
- metadata +8 -3
- data/lib/rasti/db/nql/nodes/field.rb +0 -23
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rasti-db
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Naiman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|
@@ -277,10 +277,12 @@ files:
|
|
277
277
|
- lib/rasti-db.rb
|
278
278
|
- lib/rasti/db.rb
|
279
279
|
- lib/rasti/db/collection.rb
|
280
|
+
- lib/rasti/db/computed_attribute.rb
|
280
281
|
- lib/rasti/db/data_source.rb
|
281
282
|
- lib/rasti/db/environment.rb
|
282
283
|
- lib/rasti/db/model.rb
|
283
284
|
- lib/rasti/db/nql/invalid_expression_error.rb
|
285
|
+
- lib/rasti/db/nql/nodes/attribute.rb
|
284
286
|
- lib/rasti/db/nql/nodes/binary_node.rb
|
285
287
|
- lib/rasti/db/nql/nodes/comparisons/base.rb
|
286
288
|
- lib/rasti/db/nql/nodes/comparisons/equal.rb
|
@@ -301,7 +303,6 @@ files:
|
|
301
303
|
- lib/rasti/db/nql/nodes/constants/time.rb
|
302
304
|
- lib/rasti/db/nql/nodes/constants/true.rb
|
303
305
|
- lib/rasti/db/nql/nodes/disjunction.rb
|
304
|
-
- lib/rasti/db/nql/nodes/field.rb
|
305
306
|
- lib/rasti/db/nql/nodes/parenthesis_sentence.rb
|
306
307
|
- lib/rasti/db/nql/nodes/sentence.rb
|
307
308
|
- lib/rasti/db/nql/syntax.rb
|
@@ -322,9 +323,11 @@ files:
|
|
322
323
|
- lib/rasti/db/version.rb
|
323
324
|
- rasti-db.gemspec
|
324
325
|
- spec/collection_spec.rb
|
326
|
+
- spec/computed_attribute_spec.rb
|
325
327
|
- spec/coverage_helper.rb
|
326
328
|
- spec/minitest_helper.rb
|
327
329
|
- spec/model_spec.rb
|
330
|
+
- spec/nql/computed_attributes_spec.rb
|
328
331
|
- spec/nql/dependency_tables_spec.rb
|
329
332
|
- spec/nql/filter_condition_spec.rb
|
330
333
|
- spec/nql/syntax_parser_spec.rb
|
@@ -357,9 +360,11 @@ specification_version: 4
|
|
357
360
|
summary: Database collections and relations
|
358
361
|
test_files:
|
359
362
|
- spec/collection_spec.rb
|
363
|
+
- spec/computed_attribute_spec.rb
|
360
364
|
- spec/coverage_helper.rb
|
361
365
|
- spec/minitest_helper.rb
|
362
366
|
- spec/model_spec.rb
|
367
|
+
- spec/nql/computed_attributes_spec.rb
|
363
368
|
- spec/nql/dependency_tables_spec.rb
|
364
369
|
- spec/nql/filter_condition_spec.rb
|
365
370
|
- spec/nql/syntax_parser_spec.rb
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module Rasti
|
2
|
-
module DB
|
3
|
-
module NQL
|
4
|
-
module Nodes
|
5
|
-
class Field < Treetop::Runtime::SyntaxNode
|
6
|
-
|
7
|
-
def identifier
|
8
|
-
tables.empty? ? Sequel[column.to_sym] : Sequel[tables.join('__').to_sym][column.to_sym]
|
9
|
-
end
|
10
|
-
|
11
|
-
def tables
|
12
|
-
_tables.elements.map{ |e| e.table.text_value }
|
13
|
-
end
|
14
|
-
|
15
|
-
def column
|
16
|
-
_column.text_value
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|