flounder 0.11.3 → 0.11.4

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: f4ac07a24ace10c1749674bf6267e9a72340dbb6
4
- data.tar.gz: 727e4e6fd344cf1af92787e82ffd18c505fe5956
3
+ metadata.gz: b1e40f2f96562740062a78b94e3fe1aaefda394c
4
+ data.tar.gz: 6142038a425251078a47f4f0aea1dc4a2a383551
5
5
  SHA512:
6
- metadata.gz: e9397d1aaef91195b6506305ba65738cebb2936cc3e1c507b5650ac3b8da2abc1ad5f221d8c36240a631621f1f1ca4d3c8b7a6261d1fc961b3f2d4200a6ce355
7
- data.tar.gz: f48c8f2963b7ac31f16dd9e8a52d282221d39670ed12f72ac16c22e55a2d38fec7aa57523c3eaea51deb827a1ac6335fc7d24b7666033874414c2e92064f9e3f
6
+ metadata.gz: 3bceb92cf55b7e0cfe1c7ace211e0283f66a08be18f30ad841e923ac00f929f7089817098c30bf2fcbf10e87f2b322548d2fb726de8fd710299c997c46df3127
7
+ data.tar.gz: 56dffcedde3366684040a6aff7c29e84efe81ec1418a5c3580a7f76d8303a519b8aa34b69606c72cbafc1bfc2d35ca6e828e179b8c2d4a8cd6366b6bacd5c78c
data/HISTORY CHANGED
@@ -4,6 +4,7 @@
4
4
  value.
5
5
  + #hoist is the opposite of #anchor - it reverts to the original entity.
6
6
  + native treatment of hstore - returns you a hashie::mash.
7
+ + Fixes a bug where limit would leak the SelectManager.
7
8
 
8
9
  # 0.10
9
10
  + Datamapper interop is improved (also in #order_by)
data/README CHANGED
@@ -13,9 +13,10 @@ SYNOPSIS
13
13
 
14
14
  STATUS
15
15
 
16
- Company-wide private alpha.
16
+ Heavily volatile alpha, but feature stable for most of what we already have.
17
+ We welcome feedback! (flounder at technologyastronauts dot ch)
17
18
 
18
19
  LICENSE
19
20
 
20
- Private code for now. No use permitted.
21
+ MIT License.
21
22
 
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.11.3'
5
+ s.version = '0.11.4'
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"
@@ -108,7 +108,9 @@ module Flounder
108
108
  end
109
109
 
110
110
  # Query initiators
111
- [:where, :join, :outer_join, :project, :order_by, :group_by].each do |name|
111
+ [:where, :join, :outer_join, :project,
112
+ :order_by, :group_by,
113
+ :limit, :offset].each do |name|
112
114
  define_method name do |*args|
113
115
  select { |q| q.send(name, *args) }
114
116
  end
@@ -118,6 +118,11 @@ module Flounder::Query
118
118
 
119
119
  def limit n
120
120
  manager.take n
121
+ self
122
+ end
123
+ def offset n
124
+ manager.skip n
125
+ self
121
126
  end
122
127
 
123
128
  alias all kick
data/qed/selects.md CHANGED
@@ -45,6 +45,27 @@ You can treat the entities and the queries like an array.
45
45
  query.size.assert == entity.size
46
46
  ~~~
47
47
 
48
+ # `LIMIT` and `OFFSET`
49
+
50
+ Limit the amount of results fetched:
51
+
52
+ ~~~ruby
53
+ rows = domain[:users].limit(1).order_by(:id).to_a
54
+ rows.size.assert == 1
55
+
56
+ rows = domain[:users].order_by(:id).limit(1).to_a
57
+ rows.size.assert == 1
58
+ ~~~
59
+
60
+ And start at a given offset:
61
+
62
+ ~~~ruby
63
+ rows = domain[:users].order_by(:id).offset(1).to_a
64
+ rows.first.id.assert == 2
65
+ ~~~
66
+
67
+ As a special case, calling `#first` on a query will `.limit(1).first`.
68
+
48
69
  # Subqueries
49
70
 
50
71
  Sometimes you have to say it with a subquery. For example, you might want to look at the latest post for each author in the database.
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.11.3
4
+ version: 0.11.4
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-09-01 00:00:00.000000000 Z
12
+ date: 2014-09-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: arel