top_n_loader 1.0.0
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 +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +57 -0
- data/LICENSE.txt +21 -0
- data/README.md +61 -0
- data/Rakefile +10 -0
- data/bin/console +8 -0
- data/bin/setup +8 -0
- data/lib/top_n_loader.rb +84 -0
- data/lib/top_n_loader/sql_builder.rb +152 -0
- data/lib/top_n_loader/version.rb +3 -0
- data/top_n_loader.gemspec +27 -0
- metadata +154 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cd29e09d74f26981a3772f7ac8871d7fe00bbaa736588f2de733acea20ad7bc5
|
4
|
+
data.tar.gz: 19a89bc3aaf851949e203fd0c29402f0c99fa6d3b3ce40227b4c7faa39c95370
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 42e80f413a55f32365bcc68425ae2d070f56a708387db2b91f867018604b1b20076e303ce07212369cb04cc86eb66632aa70fde0f932608199c6bfc31c363c8f
|
7
|
+
data.tar.gz: bbbbe954a980640ad53014604198fed10ff1047e09e1850ae18b7cb304e38240029ce9e583cdbb634923ac2f99819789cc9eec7a06680a1e32f2bcf861e42402
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
top_n_loader (1.0.0)
|
5
|
+
activerecord
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activemodel (5.2.3)
|
11
|
+
activesupport (= 5.2.3)
|
12
|
+
activerecord (5.2.3)
|
13
|
+
activemodel (= 5.2.3)
|
14
|
+
activesupport (= 5.2.3)
|
15
|
+
arel (>= 9.0)
|
16
|
+
activesupport (5.2.3)
|
17
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
+
i18n (>= 0.7, < 2)
|
19
|
+
minitest (~> 5.1)
|
20
|
+
tzinfo (~> 1.1)
|
21
|
+
arel (9.0.0)
|
22
|
+
coderay (1.1.2)
|
23
|
+
concurrent-ruby (1.1.5)
|
24
|
+
docile (1.1.5)
|
25
|
+
i18n (1.6.0)
|
26
|
+
concurrent-ruby (~> 1.0)
|
27
|
+
json (2.1.0)
|
28
|
+
method_source (0.9.0)
|
29
|
+
minitest (5.11.3)
|
30
|
+
pry (0.11.3)
|
31
|
+
coderay (~> 1.1.0)
|
32
|
+
method_source (~> 0.9.0)
|
33
|
+
rake (10.5.0)
|
34
|
+
simplecov (0.15.1)
|
35
|
+
docile (~> 1.1.0)
|
36
|
+
json (>= 1.8, < 3)
|
37
|
+
simplecov-html (~> 0.10.0)
|
38
|
+
simplecov-html (0.10.2)
|
39
|
+
sqlite3 (1.3.13)
|
40
|
+
thread_safe (0.3.6)
|
41
|
+
tzinfo (1.2.5)
|
42
|
+
thread_safe (~> 0.1)
|
43
|
+
|
44
|
+
PLATFORMS
|
45
|
+
ruby
|
46
|
+
|
47
|
+
DEPENDENCIES
|
48
|
+
bundler
|
49
|
+
minitest
|
50
|
+
pry
|
51
|
+
rake
|
52
|
+
simplecov
|
53
|
+
sqlite3
|
54
|
+
top_n_loader!
|
55
|
+
|
56
|
+
BUNDLED WITH
|
57
|
+
1.17.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 tompng
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# TopNLoader
|
2
|
+
|
3
|
+
When you need top 5 sub-records for each record
|
4
|
+
```ruby
|
5
|
+
posts = Post.limit(10).to_a
|
6
|
+
```
|
7
|
+
|
8
|
+
Without TopNLoader: N+1 queries
|
9
|
+
```ruby
|
10
|
+
posts = Post.limit(10)
|
11
|
+
render json: posts.map do |post|
|
12
|
+
{
|
13
|
+
title: post.title,
|
14
|
+
comments: post.comments.order(id: :desc).limit(5)
|
15
|
+
}
|
16
|
+
end
|
17
|
+
```
|
18
|
+
|
19
|
+
With TopNLoader: Only 2 queries
|
20
|
+
```ruby
|
21
|
+
# One query here
|
22
|
+
posts = Post.limit(10).to_a
|
23
|
+
post_ids = posts.map(&:id)
|
24
|
+
# ANd just one query to load each comments(limit:5) for all posts
|
25
|
+
top5s = TopNLoader.load_associations Post, posts_ids, :comments, order: :desc, limit: 5
|
26
|
+
render json: posts.map do |post|
|
27
|
+
{
|
28
|
+
title: post.title,
|
29
|
+
comments: top5s[post.id]
|
30
|
+
}
|
31
|
+
end
|
32
|
+
```
|
33
|
+
|
34
|
+
# Usage
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
# Gemfile
|
38
|
+
gem 'top_n_loader', github: 'tompng/top_n_loader'
|
39
|
+
```
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
TopNLoader.load_associations(ParentModel, ids, relation_name, limit:, order: nil)
|
43
|
+
# limit: >=0
|
44
|
+
# order: :asc, :desc, {order_column: (:asc or :desc)}
|
45
|
+
|
46
|
+
# will return the results below with a single query
|
47
|
+
records = ParentModel.find(ids).map do |record|
|
48
|
+
[record.id, record.send(relation_name).order(order).take(limit)]
|
49
|
+
end.to_h
|
50
|
+
```
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
TopNLoader.load_groups(YourModel, group_column, group_values, limit:, order: nil, condition: nil)
|
54
|
+
# limit: >=0
|
55
|
+
# order: :asc, :desc, {order_column: (:asc or :desc)}
|
56
|
+
# condition: 'name is null', ['name = ?', 'jack'], { age: (1..10), name: { not: 'jack' }}
|
57
|
+
|
58
|
+
# will return the results below with a single query
|
59
|
+
records = YourModel.where(condition).where(group_column => group_values).order(order)
|
60
|
+
records.group_by(&group_column).transform_values { |list| list.take(limit) }
|
61
|
+
```
|
data/Rakefile
ADDED
data/bin/console
ADDED
data/bin/setup
ADDED
data/lib/top_n_loader.rb
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'top_n_loader/version'
|
2
|
+
require 'active_record'
|
3
|
+
require 'top_n_loader/sql_builder'
|
4
|
+
|
5
|
+
module TopNLoader
|
6
|
+
class << self
|
7
|
+
def load_associations(base_klass, ids, relation, limit:, order: nil)
|
8
|
+
validate_ar_class! :base_klass, base_klass
|
9
|
+
validate_limit! limit
|
10
|
+
return Hash.new { [] } if ids.empty? || limit.zero?
|
11
|
+
klass = base_klass.reflect_on_association(relation.to_sym).klass
|
12
|
+
order_option = { limit: limit, **parse_order(klass, order) }
|
13
|
+
sql = SQLBuilder.top_n_association_sql base_klass, klass, relation, order_option
|
14
|
+
records = klass.find_by_sql([sql, ids])
|
15
|
+
format_result(records, klass: klass, **order_option)
|
16
|
+
end
|
17
|
+
|
18
|
+
def load_groups(klass, column, keys, limit:, order: nil, condition: nil)
|
19
|
+
validate_ar_class! :klass, klass
|
20
|
+
validate_limit! limit
|
21
|
+
return Hash.new { [] } if keys.empty? || limit.zero?
|
22
|
+
options = {
|
23
|
+
klass: klass,
|
24
|
+
group_column: column,
|
25
|
+
limit: limit,
|
26
|
+
**parse_order(klass, order)
|
27
|
+
}
|
28
|
+
records = klass.find_by_sql(
|
29
|
+
SQLBuilder.top_n_group_sql(
|
30
|
+
group_keys: keys,
|
31
|
+
condition: condition,
|
32
|
+
**options
|
33
|
+
)
|
34
|
+
)
|
35
|
+
format_result records, options
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def validate_ar_class!(var_name, klass)
|
41
|
+
return if klass.is_a?(Class) && klass < ActiveRecord::Base
|
42
|
+
raise ArgumentError, "#{var_name} should be a subclass of ActiveRecord::Base"
|
43
|
+
end
|
44
|
+
|
45
|
+
def validate_limit!(limit)
|
46
|
+
raise ArgumentError, 'negative limit' if limit < 0
|
47
|
+
end
|
48
|
+
|
49
|
+
def parse_order(klass, order)
|
50
|
+
key, mode = begin
|
51
|
+
case order
|
52
|
+
when Hash
|
53
|
+
raise ArgumentError, 'invalid order' unless order.size == 1
|
54
|
+
order.first
|
55
|
+
when Symbol
|
56
|
+
[klass.primary_key, order]
|
57
|
+
when NilClass
|
58
|
+
[klass.primary_key, :asc]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
raise ArgumentError, "invalid order key: #{key}" unless klass.has_attribute? key
|
62
|
+
raise ArgumentError, "invalid order mode: #{mode.inspect}" unless %i[asc desc].include? mode
|
63
|
+
{ order_key: key, order_mode: mode }
|
64
|
+
end
|
65
|
+
|
66
|
+
def format_result(records, klass:, group_column: nil, limit:, order_mode:, order_key:)
|
67
|
+
primary_key = klass.primary_key
|
68
|
+
type = klass.attribute_types[group_column.to_s] if group_column
|
69
|
+
result = records.group_by do |record|
|
70
|
+
key = record.top_n_group_key
|
71
|
+
type ? type.cast(key) : key unless key.nil?
|
72
|
+
end
|
73
|
+
result.transform_values! do |grouped_records|
|
74
|
+
existings, blanks = grouped_records.partition { |o| o[order_key] }
|
75
|
+
existings.sort_by! { |o| [o[order_key], o[primary_key]] }
|
76
|
+
blanks.sort_by! { |o| o[primary_key] }
|
77
|
+
ordered = blanks + existings
|
78
|
+
ordered.reverse! if order_mode == :desc
|
79
|
+
ordered.take limit
|
80
|
+
end
|
81
|
+
Hash.new { [] }.update result
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,152 @@
|
|
1
|
+
module TopNLoader::SQLBuilder
|
2
|
+
def self.condition_sql(klass, condition)
|
3
|
+
condition_sql = where_condition_to_sql condition
|
4
|
+
inheritance_column = klass.inheritance_column
|
5
|
+
return condition_sql unless klass.has_attribute?(inheritance_column) && klass.base_class != klass
|
6
|
+
sti_names = [klass, *klass.descendants].map(&:sti_name).compact
|
7
|
+
sti_sql = where_condition_to_sql inheritance_column => sti_names
|
8
|
+
[condition_sql, sti_sql].compact.join ' AND '
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.top_n_association_sql(klass, target_klass, relation, limit:, order_mode:, order_key:)
|
12
|
+
parent_table = klass.table_name
|
13
|
+
joins = klass.joins relation.to_sym
|
14
|
+
target_table = target_klass.table_name
|
15
|
+
if target_table == klass.table_name
|
16
|
+
target_table = "#{joins.joins_values.first.to_s.pluralize}_#{target_table}"
|
17
|
+
end
|
18
|
+
join_sql = joins.to_sql.match(/FROM.+/)[0]
|
19
|
+
%(
|
20
|
+
SELECT #{qt target_table}.*, top_n_group_key
|
21
|
+
#{join_sql}
|
22
|
+
INNER JOIN
|
23
|
+
(
|
24
|
+
SELECT T.#{q klass.primary_key} as top_n_group_key,
|
25
|
+
(
|
26
|
+
SELECT #{qt target_table}.#{q order_key}
|
27
|
+
#{join_sql}
|
28
|
+
WHERE #{qt parent_table}.#{q klass.primary_key} = T.#{q klass.primary_key}
|
29
|
+
ORDER BY #{qt target_table}.#{q order_key} #{order_mode.upcase}
|
30
|
+
LIMIT 1 OFFSET #{limit.to_i - 1}
|
31
|
+
) AS last_value
|
32
|
+
FROM #{qt parent_table} as T where T.#{q klass.primary_key} in (?)
|
33
|
+
) T
|
34
|
+
ON #{qt parent_table}.#{q klass.primary_key} = T.top_n_group_key
|
35
|
+
AND (
|
36
|
+
T.last_value IS NULL
|
37
|
+
OR #{qt target_table}.#{q order_key} #{{ asc: :<=, desc: :>= }[order_mode]} T.last_value
|
38
|
+
OR #{qt target_table}.#{q order_key} is NULL
|
39
|
+
)
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
def self.top_n_group_sql(klass:, group_column:, group_keys:, condition:, limit:, order_mode:, order_key:)
|
45
|
+
order_op = order_mode == :asc ? :<= : :>=
|
46
|
+
group_key_table = value_table(:T, :top_n_group_key, group_keys)
|
47
|
+
table_name = klass.table_name
|
48
|
+
sql = condition_sql klass, condition
|
49
|
+
join_cond = %(#{qt table_name}.#{q group_column} = T.top_n_group_key)
|
50
|
+
if group_keys.include? nil
|
51
|
+
nil_join_cond = %((#{qt table_name}.#{q group_column} IS NULL AND T.top_n_group_key IS NULL))
|
52
|
+
join_cond = %((#{join_cond} OR #{nil_join_cond}))
|
53
|
+
end
|
54
|
+
%(
|
55
|
+
SELECT #{qt table_name}.*, top_n_group_key
|
56
|
+
FROM #{qt table_name}
|
57
|
+
INNER JOIN
|
58
|
+
(
|
59
|
+
SELECT top_n_group_key,
|
60
|
+
(
|
61
|
+
SELECT #{qt table_name}.#{q order_key} FROM #{qt table_name}
|
62
|
+
WHERE #{join_cond}
|
63
|
+
#{"AND #{sql}" if sql}
|
64
|
+
ORDER BY #{qt table_name}.#{q order_key} #{order_mode.to_s.upcase}
|
65
|
+
LIMIT 1 OFFSET #{limit.to_i - 1}
|
66
|
+
) AS last_value
|
67
|
+
FROM #{group_key_table}
|
68
|
+
) T
|
69
|
+
ON #{join_cond}
|
70
|
+
AND (
|
71
|
+
T.last_value IS NULL
|
72
|
+
OR #{qt table_name}.#{q order_key} #{order_op} T.last_value
|
73
|
+
OR #{qt table_name}.#{q order_key} is NULL
|
74
|
+
)
|
75
|
+
#{"WHERE #{sql}" if sql}
|
76
|
+
)
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.q(name)
|
80
|
+
ActiveRecord::Base.connection.quote_column_name name
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.qt(name)
|
84
|
+
ActiveRecord::Base.connection.quote_table_name name
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.value_table(table, column, values)
|
88
|
+
if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL'
|
89
|
+
values_value_table(table, column, values)
|
90
|
+
else
|
91
|
+
union_value_table(table, column, values)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def self.union_value_table(table, column, values)
|
96
|
+
sanitize_sql_array [
|
97
|
+
"(SELECT ? AS #{column}#{' UNION SELECT ?' * (values.size - 1)}) AS #{table}",
|
98
|
+
*values
|
99
|
+
]
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.values_value_table(table, column, values)
|
103
|
+
sanitize_sql_array [
|
104
|
+
"(VALUES #{(['(?)'] * values.size).join(',')}) AS #{table} (#{column})",
|
105
|
+
*values
|
106
|
+
]
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.where_condition_to_sql(condition)
|
110
|
+
case condition
|
111
|
+
when String
|
112
|
+
condition
|
113
|
+
when Array
|
114
|
+
sanitize_sql_array condition
|
115
|
+
when Hash
|
116
|
+
condition.map { |k, v| kv_condition_to_sql k, v }.join ' AND '
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def self.kv_condition_to_sql(key, value)
|
121
|
+
return "NOT (#{where_condition_to_sql(value)})" if key == :not
|
122
|
+
sql_binds = begin
|
123
|
+
case value
|
124
|
+
when NilClass
|
125
|
+
%(#{q key} IS NULL)
|
126
|
+
when Range
|
127
|
+
if value.exclude_end?
|
128
|
+
[%(#{q key} >= ? AND #{q key} < ?), value.begin, value.end]
|
129
|
+
else
|
130
|
+
[%(#{q key} BETWEEN ? AND ?), value.begin, value.end]
|
131
|
+
end
|
132
|
+
when Hash
|
133
|
+
raise ArgumentError, '' unless value.keys == [:not]
|
134
|
+
"NOT (#{kv_condition_to_sql(key, value[:not])})"
|
135
|
+
when Enumerable
|
136
|
+
array = value.to_a
|
137
|
+
if array.include? nil
|
138
|
+
[%((#{q key} IS NULL OR #{q key} IN (?))), array.reject(&:nil?)]
|
139
|
+
else
|
140
|
+
[%(#{q key} IN (?)), array]
|
141
|
+
end
|
142
|
+
else
|
143
|
+
[%(#{q key} = ?), value]
|
144
|
+
end
|
145
|
+
end
|
146
|
+
sanitize_sql_array sql_binds
|
147
|
+
end
|
148
|
+
|
149
|
+
def self.sanitize_sql_array(array)
|
150
|
+
ActiveRecord::Base.send :sanitize_sql_array, array
|
151
|
+
end
|
152
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "top_n_loader/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "top_n_loader"
|
7
|
+
spec.version = TopNLoader::VERSION
|
8
|
+
spec.authors = ["tompng"]
|
9
|
+
spec.email = ["tomoyapenguin@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = %q{load top n records for each group}
|
12
|
+
spec.description = %q{load top n records for each group}
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
16
|
+
f.match(%r{^(test|spec|features)/})
|
17
|
+
end
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "activerecord"
|
23
|
+
|
24
|
+
%w[bundler rake minitest sqlite3 pry simplecov].each do |gem_name|
|
25
|
+
spec.add_development_dependency gem_name
|
26
|
+
end
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: top_n_loader
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- tompng
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-05-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activerecord
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sqlite3
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: load top n records for each group
|
112
|
+
email:
|
113
|
+
- tomoyapenguin@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- ".travis.yml"
|
120
|
+
- Gemfile
|
121
|
+
- Gemfile.lock
|
122
|
+
- LICENSE.txt
|
123
|
+
- README.md
|
124
|
+
- Rakefile
|
125
|
+
- bin/console
|
126
|
+
- bin/setup
|
127
|
+
- lib/top_n_loader.rb
|
128
|
+
- lib/top_n_loader/sql_builder.rb
|
129
|
+
- lib/top_n_loader/version.rb
|
130
|
+
- top_n_loader.gemspec
|
131
|
+
homepage:
|
132
|
+
licenses:
|
133
|
+
- MIT
|
134
|
+
metadata: {}
|
135
|
+
post_install_message:
|
136
|
+
rdoc_options: []
|
137
|
+
require_paths:
|
138
|
+
- lib
|
139
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
requirements: []
|
150
|
+
rubygems_version: 3.0.1
|
151
|
+
signing_key:
|
152
|
+
specification_version: 4
|
153
|
+
summary: load top n records for each group
|
154
|
+
test_files: []
|