rom-sql 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/LICENSE.txt +1 -1
- data/lib/rom/sql/group_dsl.rb +1 -1
- data/lib/rom/sql/version.rb +1 -1
- data/spec/unit/relation/group_spec.rb +14 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf05af538889499fb9fc1d4cb73ca842fae74482
|
4
|
+
data.tar.gz: '07441291fd839e047161b70cb9f20c88ebb240f9'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 447330e1514ca0aea9127434f02f2a81792e7702155f29c9a6c534938f1f88209ebc31328ef23cd7b368972854cb9e245916162ac05c981e59533c111c59ea54
|
7
|
+
data.tar.gz: 35a04cc320ec2d246c58fddb5b95aeb3787af7f055f27395596d84cd56013572999648e514d9beeafc15b9f87d879cf29753f3cd3715a8df5e05fe44d2dc061a
|
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
data/lib/rom/sql/group_dsl.rb
CHANGED
data/lib/rom/sql/version.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
RSpec.describe ROM::Relation, '#group' do
|
2
2
|
subject(:relation) { relations[:users] }
|
3
3
|
|
4
|
+
let(:notes) { relations[:notes] }
|
4
5
|
let(:tasks) { relations[:tasks] }
|
5
6
|
|
6
7
|
include_context 'users and tasks'
|
@@ -36,6 +37,8 @@ RSpec.describe ROM::Relation, '#group' do
|
|
36
37
|
end
|
37
38
|
|
38
39
|
with_adapters :postgres do
|
40
|
+
include_context 'notes'
|
41
|
+
|
39
42
|
it 'groups by provided attribute name in and attributes from a block' do
|
40
43
|
grouped = relation.
|
41
44
|
qualified.
|
@@ -44,5 +47,16 @@ RSpec.describe ROM::Relation, '#group' do
|
|
44
47
|
|
45
48
|
expect(grouped.to_a).to eql([{ id: 1, name: 'Jane' }, { id: 2, name: 'Joe'}])
|
46
49
|
end
|
50
|
+
|
51
|
+
it 'groups by a function' do
|
52
|
+
notes.insert user_id: 1, text: 'Foo', created_at: Time.now, updated_at: Time.now
|
53
|
+
|
54
|
+
grouped = notes
|
55
|
+
.select { [int::count(id), time::date_trunc('day', created_at).as(:date)] }
|
56
|
+
.group { date_trunc('day', created_at) }
|
57
|
+
.order(nil)
|
58
|
+
|
59
|
+
expect(grouped.to_a).to eql([ count: 1, date: Date.today.to_time ])
|
60
|
+
end
|
47
61
|
end
|
48
62
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rom-sql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|
@@ -345,7 +345,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
345
345
|
version: '0'
|
346
346
|
requirements: []
|
347
347
|
rubyforge_project:
|
348
|
-
rubygems_version: 2.
|
348
|
+
rubygems_version: 2.5.2
|
349
349
|
signing_key:
|
350
350
|
specification_version: 4
|
351
351
|
summary: SQL databases support for ROM
|