rails-pg-extras 3.1.0 → 3.2.2
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/lib/rails-pg-extras/index_info.rb +11 -0
- data/lib/rails-pg-extras/index_info_print.rb +6 -0
- data/lib/rails-pg-extras/table_info.rb +11 -0
- data/lib/rails-pg-extras/table_info_print.rb +6 -0
- data/lib/rails-pg-extras/version.rb +1 -1
- data/lib/rails-pg-extras.rb +32 -0
- data/spec/smoke_spec.rb +14 -0
- metadata +9 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e274fc39b73b8bdaf1b0f0f2a92fed8024e99b2796b208967f87d796ae9edbd2
|
4
|
+
data.tar.gz: 34cdb4362d0fd7240c4eac857cfd24d342a4e99eed7cda2eb20791bd8bce6c86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9045c9281c65bb9648898102d534e0cecc05a675949cd394900e8b7c821fb46b69e93e4fbb6243d470a77568858ce3295f61c95ce86737e604f7b687cbf05bd
|
7
|
+
data.tar.gz: fa66c8f4f06f233a2a2a8288d69c5e4fb257c1c2801f4c7f8c90bac722a4d82cce439759c2fe893986043ba3a30816ccd31e155ed6ab8e1666717d34a549cb5f
|
data/lib/rails-pg-extras.rb
CHANGED
@@ -4,6 +4,10 @@ require 'terminal-table'
|
|
4
4
|
require 'ruby-pg-extras'
|
5
5
|
require 'rails-pg-extras/diagnose_data'
|
6
6
|
require 'rails-pg-extras/diagnose_print'
|
7
|
+
require 'rails-pg-extras/index_info'
|
8
|
+
require 'rails-pg-extras/index_info_print'
|
9
|
+
require 'rails-pg-extras/table_info'
|
10
|
+
require 'rails-pg-extras/table_info_print'
|
7
11
|
|
8
12
|
module RailsPGExtras
|
9
13
|
QUERIES = RubyPGExtras::QUERIES
|
@@ -58,6 +62,34 @@ module RailsPGExtras
|
|
58
62
|
end
|
59
63
|
end
|
60
64
|
|
65
|
+
def self.index_info(args: {}, in_format: :display_table)
|
66
|
+
data = RailsPGExtras::IndexInfo.call(args[:table_name])
|
67
|
+
|
68
|
+
if in_format == :display_table
|
69
|
+
RailsPGExtras::IndexInfoPrint.call(data)
|
70
|
+
elsif in_format == :hash
|
71
|
+
data
|
72
|
+
elsif in_format == :array
|
73
|
+
data.map(&:values)
|
74
|
+
else
|
75
|
+
raise "Invalid 'in_format' argument!"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.table_info(args: {}, in_format: :display_table)
|
80
|
+
data = RailsPGExtras::TableInfo.call(args[:table_name])
|
81
|
+
|
82
|
+
if in_format == :display_table
|
83
|
+
RailsPGExtras::TableInfoPrint.call(data)
|
84
|
+
elsif in_format == :hash
|
85
|
+
data
|
86
|
+
elsif in_format == :array
|
87
|
+
data.map(&:values)
|
88
|
+
else
|
89
|
+
raise "Invalid 'in_format' argument!"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
61
93
|
def self.connection
|
62
94
|
ActiveRecord::Base.connection
|
63
95
|
end
|
data/spec/smoke_spec.rb
CHANGED
@@ -13,4 +13,18 @@ describe RailsPGExtras do
|
|
13
13
|
end.not_to raise_error
|
14
14
|
end
|
15
15
|
end
|
16
|
+
|
17
|
+
it "runs the custom methods" do
|
18
|
+
expect do
|
19
|
+
RailsPGExtras.diagnose(in_format: :hash)
|
20
|
+
end.not_to raise_error
|
21
|
+
|
22
|
+
expect do
|
23
|
+
RailsPGExtras.index_info(in_format: :hash)
|
24
|
+
end.not_to raise_error
|
25
|
+
|
26
|
+
expect do
|
27
|
+
RailsPGExtras.table_info(in_format: :hash)
|
28
|
+
end.not_to raise_error
|
29
|
+
end
|
16
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-pg-extras
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pawurb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-pg-extras
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.
|
19
|
+
version: 3.2.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3.
|
26
|
+
version: 3.2.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activerecord
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -85,7 +85,11 @@ files:
|
|
85
85
|
- lib/rails-pg-extras.rb
|
86
86
|
- lib/rails-pg-extras/diagnose_data.rb
|
87
87
|
- lib/rails-pg-extras/diagnose_print.rb
|
88
|
+
- lib/rails-pg-extras/index_info.rb
|
89
|
+
- lib/rails-pg-extras/index_info_print.rb
|
88
90
|
- lib/rails-pg-extras/railtie.rb
|
91
|
+
- lib/rails-pg-extras/table_info.rb
|
92
|
+
- lib/rails-pg-extras/table_info_print.rb
|
89
93
|
- lib/rails-pg-extras/tasks/all.rake
|
90
94
|
- lib/rails-pg-extras/version.rb
|
91
95
|
- rails-pg-extras-diagnose.png
|
@@ -112,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
116
|
- !ruby/object:Gem::Version
|
113
117
|
version: '0'
|
114
118
|
requirements: []
|
115
|
-
rubygems_version: 3.
|
119
|
+
rubygems_version: 3.0.3
|
116
120
|
signing_key:
|
117
121
|
specification_version: 4
|
118
122
|
summary: Rails PostgreSQL performance database insights
|