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 +4 -4
- data/HISTORY +1 -0
- data/README +3 -2
- data/flounder.gemspec +1 -1
- data/lib/flounder/entity.rb +3 -1
- data/lib/flounder/query/select.rb +5 -0
- data/qed/selects.md +21 -0
- 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: b1e40f2f96562740062a78b94e3fe1aaefda394c
|
4
|
+
data.tar.gz: 6142038a425251078a47f4f0aea1dc4a2a383551
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bceb92cf55b7e0cfe1c7ace211e0283f66a08be18f30ad841e923ac00f929f7089817098c30bf2fcbf10e87f2b322548d2fb726de8fd710299c997c46df3127
|
7
|
+
data.tar.gz: 56dffcedde3366684040a6aff7c29e84efe81ec1418a5c3580a7f76d8303a519b8aa34b69606c72cbafc1bfc2d35ca6e828e179b8c2d4a8cd6366b6bacd5c78c
|
data/HISTORY
CHANGED
data/README
CHANGED
@@ -13,9 +13,10 @@ SYNOPSIS
|
|
13
13
|
|
14
14
|
STATUS
|
15
15
|
|
16
|
-
|
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
|
-
|
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.
|
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"
|
data/lib/flounder/entity.rb
CHANGED
@@ -108,7 +108,9 @@ module Flounder
|
|
108
108
|
end
|
109
109
|
|
110
110
|
# Query initiators
|
111
|
-
[:where, :join, :outer_join, :project,
|
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
|
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.
|
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-
|
12
|
+
date: 2014-09-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: arel
|