flounder 0.9.2 → 0.9.3

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: 0f322c0fdd9247c24a821bce8f602d025f961d19
4
- data.tar.gz: d27d58604c817b088add6384ebd9022e38d3d650
3
+ metadata.gz: d5865e63fb12cfb93c2514d412f9640e00383072
4
+ data.tar.gz: 09a4d7dfab77ccea44f7b7c0f0fb9f8212e9d909
5
5
  SHA512:
6
- metadata.gz: 338d6f3a5a574b442375846b94af3c17b7104aeae5519fea3b7b2d8c4d7a2e167841021b78ad68117a90840bc056e348f1168487f82dac21f622afdfb4704b01
7
- data.tar.gz: e0a72ca40089dcd6221589c2c989d7ea9a6dfac60d809e165e1265328694b7a803974f95ce3c697da961d1546454bf119bf7b77c94705650763746bf47ca0890
6
+ metadata.gz: 61fe664adec772a796f5136ecba197754aefb6656a9a2839dbddbea8ff4ef1b5331d2e2df023df299ff4365b2d7dfbe2ebdac0ab87eeb9713c53850f89220370
7
+ data.tar.gz: c711c60ddee3a053ed91ef745773b3b4febb87edb5965028e8d0ff0ef1e17d2857b32d631f6855ac316249572b48228712c80f7483d9ed9a23efb4128c3b3729
data/HISTORY CHANGED
@@ -10,4 +10,9 @@
10
10
  + `search_path` argument for `Flounder.connect`.
11
11
 
12
12
  0.9.2
13
- + bind variables on INSERT/UPDATE.
13
+ + bind variables on INSERT/UPDATE.
14
+
15
+ 0.9.3
16
+ + DELETE FROM - entity#delete
17
+
18
+
Binary file
data/flounder.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "flounder"
5
- s.version = '0.9.2'
5
+ s.version = '0.9.3'
6
6
  s.summary = "Flounder is a way to write SQL simply in Ruby. It deals with everything BUT object relational mapping. "
7
7
  s.email = "kaspar.schiess@technologyastronauts.ch"
8
8
  s.homepage = "https://bitbucket.org/technologyastronauts/oss_flounder"
@@ -83,6 +83,10 @@ module Flounder
83
83
  Query::Update.new(domain, self).tap { |u|
84
84
  u.set(hash) }
85
85
  end
86
+
87
+ def delete
88
+ Query::Delete.new(domain, self)
89
+ end
86
90
 
87
91
  # Temporarily creates a new entity that is available as if it was declared
88
92
  # with the given plural and singular, but referencing to the same
@@ -111,7 +115,7 @@ module Flounder
111
115
  end
112
116
 
113
117
  # Kickers
114
- [:first, :all, :size, :delete].each do |name|
118
+ [:first, :all, :size].each do |name|
115
119
  define_method name do |*args|
116
120
  q = select
117
121
  q.send(name, *args)
@@ -0,0 +1,14 @@
1
+ require_relative 'base'
2
+
3
+ module Flounder::Query
4
+
5
+ # An update obtained by calling any of the chain methods on an entity.
6
+ #
7
+ class Delete < Base
8
+ def initialize domain, entity
9
+ super(domain, Arel::DeleteManager, entity)
10
+
11
+ manager.from entity.table
12
+ end
13
+ end # class
14
+ end # module Flounder
data/lib/flounder.rb CHANGED
@@ -14,10 +14,12 @@ require 'flounder/entity_alias'
14
14
  require 'flounder/field'
15
15
 
16
16
  require 'flounder/query/immediate'
17
+
17
18
  require 'flounder/query/select'
18
19
  require 'flounder/query/insert'
19
-
20
20
  require 'flounder/query/update'
21
+ require 'flounder/query/delete'
22
+
21
23
  require 'flounder/exceptions'
22
24
 
23
25
  module Flounder
data/qed/delete.md ADDED
@@ -0,0 +1,10 @@
1
+
2
+ Flounder can delete records from the database.
3
+
4
+ ~~~ruby
5
+ post = posts.insert(title: 'test', text: 'text', user_id: 1).kick.first
6
+
7
+ posts.delete.where(id: post.id).kick
8
+
9
+ posts.where(id: post.id).count.assert == 0
10
+ ~~~
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flounder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaspar Schiess
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-13 00:00:00.000000000 Z
12
+ date: 2014-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: arel
@@ -91,6 +91,7 @@ files:
91
91
  - LICENSE
92
92
  - README
93
93
  - flounder-0.9.1.gem
94
+ - flounder-0.9.2.gem
94
95
  - flounder.gemspec
95
96
  - lib/flounder.rb
96
97
  - lib/flounder/connection.rb
@@ -103,6 +104,7 @@ files:
103
104
  - lib/flounder/field.rb
104
105
  - lib/flounder/postgres_utils.rb
105
106
  - lib/flounder/query/base.rb
107
+ - lib/flounder/query/delete.rb
106
108
  - lib/flounder/query/immediate.rb
107
109
  - lib/flounder/query/insert.rb
108
110
  - lib/flounder/query/returning.rb
@@ -115,6 +117,7 @@ files:
115
117
  - qed/atomic_insert_update.md
116
118
  - qed/conditions.md
117
119
  - qed/database_technicalities.md
120
+ - qed/delete.md
118
121
  - qed/exceptions.md
119
122
  - qed/flounder.sql
120
123
  - qed/index.md
@@ -155,6 +158,7 @@ test_files:
155
158
  - qed/atomic_insert_update.md
156
159
  - qed/conditions.md
157
160
  - qed/database_technicalities.md
161
+ - qed/delete.md
158
162
  - qed/exceptions.md
159
163
  - qed/flounder.sql
160
164
  - qed/index.md