graphql-sources 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -0
- data/lib/graphql/sources/active_record_base.rb +10 -1
- data/lib/graphql/sources/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4484ab76e8479321a3b7c451654dfbf6f4d2bc8468305829e45d9edfebf7115
|
4
|
+
data.tar.gz: e4838bff5cd3e1755e5a5cb3a714ba0502fdf2c24c6db4aeec190e45b2d9f238
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f4ffac3729a6210f9a4ec7b5fbeebe37442d0e4c3578714e1648bc136b51f7abfe71b28432253607580c475f9c1f74992226f5af363857a715554dce0e92393
|
7
|
+
data.tar.gz: f10d7510af4681949aac56d252496da8d633151cd0151e9f34bf920e9d9d192c9943e869f506f2c92c4733c1a8662070173fb923405aa66f3f4967642d46907f
|
data/Gemfile
CHANGED
@@ -6,7 +6,16 @@ module GraphQL
|
|
6
6
|
class ActiveRecordBase < GraphQL::Dataloader::Source
|
7
7
|
# @param model [Class] a child class of ActiveRecord::Base (e.g. Comment)
|
8
8
|
# @param key [Symbol] an attribute (typically a foreign key) to use for loading (e.g. :user_id)
|
9
|
-
|
9
|
+
# @return [Array] a key
|
10
|
+
def self.batch_key_for(model, key: :id)
|
11
|
+
return [model.to_sql, key] if model.is_a?(ActiveRecord::Relation)
|
12
|
+
|
13
|
+
[model, key]
|
14
|
+
end
|
15
|
+
|
16
|
+
# @param model [Class] a child class of ActiveRecord::Base (e.g. Comment)
|
17
|
+
# @param key [Symbol] an attribute (typically a foreign key) to use for loading (e.g. :user_id)
|
18
|
+
def initialize(model, key: :id)
|
10
19
|
super()
|
11
20
|
@model = model
|
12
21
|
@key = key
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-sources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Sylvestre
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|
@@ -178,6 +178,20 @@ dependencies:
|
|
178
178
|
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: rubocop-rspec_rails
|
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'
|
181
195
|
- !ruby/object:Gem::Dependency
|
182
196
|
name: simplecov
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -234,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
234
248
|
- !ruby/object:Gem::Version
|
235
249
|
version: '0'
|
236
250
|
requirements: []
|
237
|
-
rubygems_version: 3.
|
251
|
+
rubygems_version: 3.5.11
|
238
252
|
signing_key:
|
239
253
|
specification_version: 4
|
240
254
|
summary: A set of common GraphQL DataLoader sources.
|