rasti-db 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ab65952edd3d755127be36c3e95655fcf230900
4
- data.tar.gz: 58e110b0bc077663cc4ca7b8f2a53167c68bf8e0
3
+ metadata.gz: e82be256b84a31356c81f62ce16b00a0fa576d23
4
+ data.tar.gz: e44de553c36041c9f572f3506ff427b68dd77142
5
5
  SHA512:
6
- metadata.gz: 2d880a6ab0e060fc7917a980249be459f209e11d607ecf79289cb7d68f05dff209476502da842613a9d434503282d20f2bba78fbe5fd4f51986fa650e6d9bc29
7
- data.tar.gz: cffd9d898ceaac6aa3a316e4a9d34249549e008cb7ba43d2945d55c2d8beb6bc1c66abf84cafae95ccaf7ed88fbd7f70dea4d0610e282d0e95269e335763270b
6
+ metadata.gz: 807edc88d2733aa2bc1ba8253596fbc3c6ba8f0e4ae4ac72c156b2f856afbcad5c71035172cc3459176264fb39dcc6447c117afbbe309e260f3c56e7b0b9f6a8
7
+ data.tar.gz: 8252f75a29543c6e08608753d9ceca667a70ec2c7d05df73a880f1e48922f85b83f25796f37e70f42d95d60f2848b950893491eb0dd0ec938c054ff3b24adc56
@@ -191,7 +191,7 @@ module Rasti
191
191
  end
192
192
 
193
193
  def qualified_collection_name
194
- schema.nil? ? self.class.collection_name : Sequel.qualify(schema, self.class.collection_name)
194
+ schema.nil? ? self.class.collection_name : Sequel[schema][self.class.collection_name]
195
195
  end
196
196
 
197
197
  def build_query(filter=nil, &block)
@@ -7,8 +7,8 @@ module Rasti
7
7
  private
8
8
 
9
9
  def with_schema(table, field=nil)
10
- qualified_table = schema ? Sequel.qualify(schema, table) : table
11
- field ? Sequel.qualify(qualified_table, field) : qualified_table
10
+ qualified_table = schema ? Sequel[schema][table] : table
11
+ field ? Sequel[qualified_table][field] : qualified_table
12
12
  end
13
13
 
14
14
  end
@@ -19,7 +19,7 @@ module Rasti
19
19
  end
20
20
 
21
21
  def pluck(*attributes)
22
- ds = dataset.select(*attributes.map { |attr| Sequel.qualify(collection_class.collection_name, attr) })
22
+ ds = dataset.select(*attributes.map { |attr| Sequel[collection_class.collection_name][attr] })
23
23
  attributes.count == 1 ? ds.map { |r| r[attributes.first] } : ds.map(&:values)
24
24
  end
25
25
 
@@ -125,7 +125,7 @@ module Rasti
125
125
  end
126
126
 
127
127
  def qualified_relation_collection_name(schema=nil)
128
- schema.nil? ? relation_collection_name : Sequel.qualify(schema, relation_collection_name)
128
+ schema.nil? ? relation_collection_name : Sequel[schema][relation_collection_name]
129
129
  end
130
130
 
131
131
  def graph_to(rows, db, schema=nil, relations=[])
@@ -137,7 +137,7 @@ module Rasti
137
137
 
138
138
  join_rows = target_collection.dataset
139
139
  .join(relation_name, target_foreign_key => target_collection_class.primary_key)
140
- .where(Sequel.qualify(relation_name, source_foreign_key) => pks)
140
+ .where(Sequel[relation_name][source_foreign_key] => pks)
141
141
  .all
142
142
 
143
143
  Relations.graph_to join_rows, relations, target_collection_class, db, schema
@@ -1,5 +1,5 @@
1
1
  module Rasti
2
2
  module DB
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
@@ -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(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
211
+ db[:comments].join(:posts, id: :post_id).where(Sequel[:posts][:user_id] => 1).count.must_equal 3
212
+ db[:categories_posts].join(:posts, id: :post_id).where(Sequel[: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(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
219
+ db[:comments].join(:posts, id: :post_id).where(Sequel[:posts][:user_id] => 1).count.must_equal 0
220
+ db[:categories_posts].join(:posts, id: :post_id).where(Sequel[: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(Sequel.qualify(:comments, :user_id) => user_id)
48
+ dataset.where(Sequel[: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 }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rasti-db
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Naiman