gizzard 0.9.0 → 0.10.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 +4 -4
- data/README.md +2 -1
- data/lib/gizzard/base.rb +1 -5
- data/lib/gizzard/mysql.rb +6 -2
- data/lib/gizzard/version.rb +1 -1
- data/sig/gizzard.rbs +45 -0
- metadata +42 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee9dce1d68e1340d6ece571a820cfe9e1d2747fa4f054fc76c61d94650afd1d3
|
4
|
+
data.tar.gz: 9edae9b1e9c06e39ff973226c7a831da823dd4f3494a6b042b5b6fd4268091f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5298a47808e83dc8cfc659e10cc0e5cc48e898e3e4e32288032adfe7949d84aa21cf457d0a0c9537883affd07d09680f59308ecb3a685cbb4035c9fcb50dd1a
|
7
|
+
data.tar.gz: 6e639cd57f45b9f321a70e6055ce493a1e9993defbdaceb88f02a05ddee9bb799a1f3ea4c5e6a143c9ef4b38671cef81aaac2a6129f223cfd218ce675cac6081
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Gizzard
|
2
2
|
|
3
|
-
[](https://github.com/taka0125/gizzard/actions/workflows/main.yml)
|
4
|
+
[](https://badge.fury.io/rb/gizzard)
|
4
5
|
|
5
6
|
Often use snippet for ActiveRecord.
|
6
7
|
|
data/lib/gizzard/base.rb
CHANGED
@@ -7,11 +7,7 @@ module Gizzard
|
|
7
7
|
records = Array(records)
|
8
8
|
return if records.empty?
|
9
9
|
|
10
|
-
|
11
|
-
ActiveRecord::Associations::Preloader.new(records: records, associations: associations, scope: scope).call
|
12
|
-
else
|
13
|
-
ActiveRecord::Associations::Preloader.new.preload(records, associations, scope)
|
14
|
-
end
|
10
|
+
ActiveRecord::Associations::Preloader.new(records: records, associations: associations, scope: scope).call
|
15
11
|
end
|
16
12
|
|
17
13
|
def delete_all_by_id(batch_size: 1000)
|
data/lib/gizzard/mysql.rb
CHANGED
@@ -7,7 +7,9 @@ module Gizzard
|
|
7
7
|
|
8
8
|
scope :filtered_by, -> (column, value) do
|
9
9
|
v = value.respond_to?(:strip) ? value.strip : value
|
10
|
-
|
10
|
+
return where(column => v) if v.present?
|
11
|
+
|
12
|
+
all
|
11
13
|
end
|
12
14
|
|
13
15
|
scope :forward_matching_by, -> (column, value) { where("`#{table_name}`.`#{column}` LIKE ?", "#{sanitize_sql_like(value)}%") }
|
@@ -17,7 +19,9 @@ module Gizzard
|
|
17
19
|
|
18
20
|
class_methods do
|
19
21
|
def order_by_field(column, values)
|
20
|
-
|
22
|
+
return in_order_of(column, values) unless values.empty?
|
23
|
+
|
24
|
+
all
|
21
25
|
end
|
22
26
|
|
23
27
|
def order_by_id_field(ids)
|
data/lib/gizzard/version.rb
CHANGED
data/sig/gizzard.rbs
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# TypeProf 0.21.8
|
2
|
+
|
3
|
+
# Classes
|
4
|
+
module Gizzard
|
5
|
+
VERSION: String
|
6
|
+
|
7
|
+
class Error < StandardError
|
8
|
+
end
|
9
|
+
|
10
|
+
module Base
|
11
|
+
extend ActiveSupport::Concern
|
12
|
+
extend ActiveRecord::Core::ClassMethods
|
13
|
+
|
14
|
+
module ClassMethods
|
15
|
+
def preload_associations: (records: untyped, associations: untyped, ?scope: nil) -> nil
|
16
|
+
def delete_all_by_id: (?batch_size: Integer) -> untyped
|
17
|
+
def less_than_id: (Integer id) -> ActiveRecord::Relation
|
18
|
+
def greater_than_id: (Integer id) -> ActiveRecord::Relation
|
19
|
+
def less_than: (String | Symbol key, untyped value) -> ActiveRecord::Relation
|
20
|
+
def less_than_equal: (String | Symbol key, untyped value) -> ActiveRecord::Relation
|
21
|
+
def greater_than: (String | Symbol key, untyped value) -> ActiveRecord::Relation
|
22
|
+
def greater_than_equal: (String | Symbol key, untyped value) -> ActiveRecord::Relation
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
module Mysql
|
27
|
+
include Base
|
28
|
+
extend Base::ClassMethods
|
29
|
+
|
30
|
+
module ClassMethods
|
31
|
+
def lock_in_share: -> ActiveRecord::Relation
|
32
|
+
def order_by_field: (String | Symbol column, [untyped] values) -> ActiveRecord::Relation
|
33
|
+
def order_by_id_field: ([untyped] ids) -> ActiveRecord::Relation
|
34
|
+
def use_index: (String | [String] indexes) -> ActiveRecord::Relation
|
35
|
+
def force_index: (String | [String] indexes) -> ActiveRecord::Relation
|
36
|
+
def joins_with_use_index: (String | Symbol relation_name, String | [String] indexes) -> ActiveRecord::Relation
|
37
|
+
def joins_with_force_index: (String | Symbol relation_name, String | [String] indexes) -> ActiveRecord::Relation
|
38
|
+
def left_outer_joins_with_use_index: (String | Symbol relation_name, String | [String] indexes) -> ActiveRecord::Relation
|
39
|
+
def left_outer_joins_with_force_index: (String | Symbol relation_name, String | [String] indexes) -> ActiveRecord::Relation
|
40
|
+
end
|
41
|
+
|
42
|
+
def to_id: -> Integer
|
43
|
+
def lock_in_share!: -> untyped
|
44
|
+
end
|
45
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gizzard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takahiro Ooishi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '7.0'
|
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: '
|
26
|
+
version: '7.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '7.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '7.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: ridgepole
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,6 +164,34 @@ dependencies:
|
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '3.0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: typeprof
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: steep
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
167
195
|
description: Often use snippet for ActiveRecord.
|
168
196
|
email:
|
169
197
|
- taka0125@gmail.com
|
@@ -177,9 +205,13 @@ files:
|
|
177
205
|
- lib/gizzard/base.rb
|
178
206
|
- lib/gizzard/mysql.rb
|
179
207
|
- lib/gizzard/version.rb
|
208
|
+
- sig/gizzard.rbs
|
180
209
|
homepage: https://github.com/taka0125/gizzard
|
181
|
-
licenses:
|
182
|
-
|
210
|
+
licenses:
|
211
|
+
- MIT
|
212
|
+
metadata:
|
213
|
+
homepage_uri: https://github.com/taka0125/gizzard
|
214
|
+
source_code_uri: https://github.com/taka0125/gizzard
|
183
215
|
post_install_message:
|
184
216
|
rdoc_options: []
|
185
217
|
require_paths:
|
@@ -188,14 +220,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
188
220
|
requirements:
|
189
221
|
- - ">="
|
190
222
|
- !ruby/object:Gem::Version
|
191
|
-
version:
|
223
|
+
version: 3.1.0
|
192
224
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
225
|
requirements:
|
194
226
|
- - ">="
|
195
227
|
- !ruby/object:Gem::Version
|
196
228
|
version: '0'
|
197
229
|
requirements: []
|
198
|
-
rubygems_version: 3.4.
|
230
|
+
rubygems_version: 3.4.19
|
199
231
|
signing_key:
|
200
232
|
specification_version: 4
|
201
233
|
summary: Often use snippet for ActiveRecord.
|