pg_clip 0.1.1 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pg_clip/paginator.rb +9 -2
- data/lib/pg_clip/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e82278b583376e5666b32ebe2c32e1639ad7a47b52dae82562e3bb2938af2fd7
|
4
|
+
data.tar.gz: e9c606b803fb19c89c76af20d63016a9f749a2914922aa8d268906de8c760842
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0801b0b423d3c3d7c26fbd45b841837a545131709684969daf6c52139b675544176436e3401c54a6b91960ad12386f308fef5b8241ab812c06e3ba745699d929'
|
7
|
+
data.tar.gz: f82f6fc9554afe8c84d47af2a1f2bd8ce5b93ff7b820aebccdba6cfc61a6421a4befedabf84d3f20a95e27d86ded70cec2e1ba43f8f0fa6af1415cd7a7d1cca1
|
data/lib/pg_clip/paginator.rb
CHANGED
@@ -16,11 +16,18 @@ module PgClip
|
|
16
16
|
def execute_query(query)
|
17
17
|
connection.execute <<-SQL
|
18
18
|
SET intervalstyle = 'iso_8601';
|
19
|
-
WITH insight AS (#{query})
|
19
|
+
WITH insight AS (#{query}), stats AS (
|
20
|
+
SELECT
|
21
|
+
1 AS page,
|
22
|
+
COUNT(*) AS total_count,
|
23
|
+
1 AS total_pages
|
24
|
+
FROM insight
|
25
|
+
)
|
20
26
|
|
21
27
|
SELECT
|
28
|
+
stats.*,
|
22
29
|
row_to_json(insight) AS record
|
23
|
-
FROM insight
|
30
|
+
FROM insight, stats
|
24
31
|
SQL
|
25
32
|
end
|
26
33
|
|
data/lib/pg_clip/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_clip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomasz Mazur
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|