rasti-db 0.1.0 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa66e94f3945ca058846ce6031b4720516d58646
4
- data.tar.gz: 87e086acc3972e6a553aea23e9741a8d74235022
3
+ metadata.gz: 2ab65952edd3d755127be36c3e95655fcf230900
4
+ data.tar.gz: 58e110b0bc077663cc4ca7b8f2a53167c68bf8e0
5
5
  SHA512:
6
- metadata.gz: 6d0add21909af7df516237b904484e65b68042ec9da5f792ecc4c517a63d175fc98a19389ee2ca063f8a028457e9fd0adab0c2f4a46ea323ea93ab3148be8030
7
- data.tar.gz: db6e89b5c05617e65aaa07dab882de5376acf0dd3bda0d94001eaf5e24f482772b1fb3d8617c8647aeb72e26aeb5d62ccf15706ab3ea6617872adc0bccc696e7
6
+ metadata.gz: 2d880a6ab0e060fc7917a980249be459f209e11d607ecf79289cb7d68f05dff209476502da842613a9d434503282d20f2bba78fbe5fd4f51986fa650e6d9bc29
7
+ data.tar.gz: cffd9d898ceaac6aa3a316e4a9d34249549e008cb7ba43d2945d55c2d8beb6bc1c66abf84cafae95ccaf7ed88fbd7f70dea4d0610e282d0e95269e335763270b
@@ -2,7 +2,7 @@ module Rasti
2
2
  module DB
3
3
  class Query
4
4
 
5
- DATASET_CHAINED_METHODS = [:where, :exclude, :and, :or, :order, :reverse_order, :limit, :offset].freeze
5
+ DATASET_CHAINED_METHODS = [:where, :exclude, :or, :order, :reverse_order, :limit, :offset].freeze
6
6
 
7
7
  include Enumerable
8
8
  include Helpers::WithSchema
@@ -1,5 +1,5 @@
1
1
  module Rasti
2
2
  module DB
3
- VERSION = '0.1.0'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
data/rasti-db.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_runtime_dependency 'sequel', '~> 4.38'
21
+ spec.add_runtime_dependency 'sequel', '~> 5.0'
22
22
  spec.add_runtime_dependency 'consty', '~> 1.0'
23
23
 
24
24
  spec.add_development_dependency 'bundler', '~> 1.12'
@@ -208,16 +208,16 @@ describe 'Collection' do
208
208
  db[:users].where(id: 1).count.must_equal 1
209
209
  db[:comments].where(user_id: 1).count.must_equal 3
210
210
  db[:posts].where(user_id: 1).count.must_equal 3
211
- db[:comments].join(:posts, id: :post_id).where(posts__user_id: 1).count.must_equal 3
212
- db[:categories_posts].join(:posts, id: :post_id).where(posts__user_id: 1).count.must_equal 3
211
+ db[:comments].join(:posts, id: :post_id).where(Sequel.qualify(:posts, :user_id) => 1).count.must_equal 3
212
+ db[:categories_posts].join(:posts, id: :post_id).where(Sequel.qualify(:posts, :user_id) => 1).count.must_equal 3
213
213
 
214
214
  users.delete_cascade 1
215
215
 
216
216
  db[:users].where(id: 1).count.must_equal 0
217
217
  db[:comments].where(user_id: 1).count.must_equal 0
218
218
  db[:posts].where(user_id: 1).count.must_equal 0
219
- db[:comments].join(:posts, id: :post_id).where(posts__user_id: 1).count.must_equal 0
220
- db[:categories_posts].join(:posts, id: :post_id).where(posts__user_id: 1).count.must_equal 0
219
+ db[:comments].join(:posts, id: :post_id).where(Sequel.qualify(:posts, :user_id) => 1).count.must_equal 0
220
+ db[:categories_posts].join(:posts, id: :post_id).where(Sequel.qualify(:posts, :user_id) => 1).count.must_equal 0
221
221
 
222
222
  db[:users].count.must_equal 2
223
223
  db[:categories].count.must_equal 3
@@ -45,7 +45,7 @@ class Comments < Rasti::DB::Collection
45
45
  many_to_one :post
46
46
 
47
47
  def posts_commented_by(user_id)
48
- dataset.where(comments__user_id: user_id)
48
+ dataset.where(Sequel.qualify(:comments, :user_id) => user_id)
49
49
  .join(with_schema(:posts), id: :post_id)
50
50
  .select_all(with_schema(:posts))
51
51
  .map { |row| Post.new row }
data/spec/query_spec.rb CHANGED
@@ -49,7 +49,7 @@ describe 'Query' do
49
49
  end
50
50
 
51
51
  it 'And' do
52
- users_query.where(id: [1,2]).and(name: 'User 2').all.must_equal [User.new(id: 2, name: 'User 2')]
52
+ users_query.where(id: [1,2]).where(name: 'User 2').all.must_equal [User.new(id: 2, name: 'User 2')]
53
53
  end
54
54
 
55
55
  it 'Or' do
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.1.0
4
+ version: 0.2.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: 2017-08-30 00:00:00.000000000 Z
11
+ date: 2017-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '4.38'
19
+ version: '5.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '4.38'
26
+ version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: consty
29
29
  requirement: !ruby/object:Gem::Requirement