rasti-db 0.2.5 → 0.2.6
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.
- checksums.yaml +4 -4
- data/.travis.yml +12 -1
- data/lib/rasti/db/type_converter.rb +1 -0
- data/lib/rasti/db/version.rb +1 -1
- data/spec/collection_spec.rb +2 -2
- data/spec/type_converter_spec.rb +9 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e666cc71839d82d36edfac7d7370d9f31e6d275
|
4
|
+
data.tar.gz: 80a4c04065aa81c0f2c5c3935127d15c36a1127a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50fc211f54d91108ff10290deb0e7ade32cc045424c8228514fddd32c8d5fd3a64fa02e2e5fb3809db3d343f91a90ddd70d392c1eeec65cd5847c5fc5b3a9533
|
7
|
+
data.tar.gz: 8b10f98acbc07463c72bffe2e50117236d882ae3eae0442bef02f4d47124a80a4e0cb52dfb5e31151f3d3b510b21d0489300e782846084ce6b4351f8479b22be
|
data/.travis.yml
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
language: ruby
|
2
|
+
|
2
3
|
rvm:
|
3
4
|
- 1.9.3
|
4
5
|
- 2.0
|
@@ -6,6 +7,16 @@ rvm:
|
|
6
7
|
- 2.2
|
7
8
|
- 2.3.0
|
8
9
|
- 2.4.0
|
9
|
-
- jruby
|
10
|
+
- jruby-1.7.25
|
11
|
+
- jruby-9.1.7.0
|
12
|
+
- ruby-head
|
13
|
+
- jruby-head
|
14
|
+
|
15
|
+
matrix:
|
16
|
+
fast_finish: true
|
17
|
+
allow_failures:
|
18
|
+
- rvm: ruby-head
|
19
|
+
- rvm: jruby-head
|
20
|
+
|
10
21
|
before_install:
|
11
22
|
- gem install bundler
|
@@ -5,6 +5,7 @@ module Rasti
|
|
5
5
|
CONVERTIONS = {
|
6
6
|
postgres: {
|
7
7
|
/^json$/ => ->(value, match) { Sequel.pg_json value },
|
8
|
+
/^jsonb$/ => ->(value, match) { Sequel.pg_jsonb value },
|
8
9
|
/^hstore$/ => ->(value, match) { Sequel.hstore value },
|
9
10
|
/^hstore\[\]$/ => ->(value, match) { Sequel.pg_array value.map { |v| Sequel.hstore v }, 'hstore' },
|
10
11
|
/^([a-z]+)\[\]$/ => ->(value, match) { Sequel.pg_array value, match.captures[0] }
|
data/lib/rasti/db/version.rb
CHANGED
data/spec/collection_spec.rb
CHANGED
@@ -277,10 +277,10 @@ describe 'Collection' do
|
|
277
277
|
1.upto(10) { |i| db[:users].insert name: "User #{i}" }
|
278
278
|
|
279
279
|
users.detect(id: 1).must_equal User.new(id: 1, name: 'User 1')
|
280
|
-
users.detect(id: 0).
|
280
|
+
users.detect(id: 0).must_be_nil
|
281
281
|
|
282
282
|
users.detect { where id: 1 }.must_equal User.new(id: 1, name: 'User 1')
|
283
|
-
users.detect { where id: 0 }.
|
283
|
+
users.detect { where id: 0 }.must_be_nil
|
284
284
|
end
|
285
285
|
|
286
286
|
it 'Chained query' do
|
data/spec/type_converter_spec.rb
CHANGED
@@ -21,7 +21,8 @@ describe 'Type Converter' do
|
|
21
21
|
[:text_array, {db_type: 'text[]'}],
|
22
22
|
[:integer_array, {db_type: 'integer[]'}],
|
23
23
|
[:hstore_array, {db_type: 'hstore[]'}],
|
24
|
-
[:json, {db_type: 'json'}]
|
24
|
+
[:json, {db_type: 'json'}],
|
25
|
+
[:jsonb, {db_type: 'jsonb'}]
|
25
26
|
]
|
26
27
|
end
|
27
28
|
end
|
@@ -93,6 +94,13 @@ describe 'Type Converter' do
|
|
93
94
|
attributes[:json].must_equal [{key_1: {key_2: [3]}}]
|
94
95
|
end
|
95
96
|
|
97
|
+
it 'Json binary' do
|
98
|
+
attributes = type_converter.apply_to jsonb: {key_1: {key_2: [3]}}
|
99
|
+
|
100
|
+
attributes[:jsonb].class.must_equal Sequel::Postgres::JSONBHash
|
101
|
+
attributes[:jsonb].must_equal key_1: {key_2: [3]}
|
102
|
+
end
|
103
|
+
|
96
104
|
end
|
97
105
|
|
98
106
|
end
|
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: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Naiman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|