ree_lib 1.0.57 → 1.0.58
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/Gemfile.lock +1 -1
- data/lib/ree_lib/packages/ree_dao/package/ree_dao/association.rb +15 -4
- data/lib/ree_lib/packages/ree_dao/package/ree_dao/associations.rb +7 -6
- data/lib/ree_lib/packages/ree_dao/package/ree_dao/functions/load_agg.rb +11 -2
- data/lib/ree_lib/packages/ree_dao/spec/ree_dao/functions/load_agg/load_agg_spec.rb +1 -1
- data/lib/ree_lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdb25650f338b4be087e72a1ef04fff5b9e1bf47d0b22221ead03743c74de398
|
4
|
+
data.tar.gz: 333d7adc841964ddd5b50d690f6c016b096622ba327953ae5a5fa57d50f7bde1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 220bc20b778767ec025b5402e7f0fb5a32c2cd15b37373e26af20d5de11529a75b79c745fc9e062b5e27d0bf2c62e0438806aad79950498badebc5f980562825
|
7
|
+
data.tar.gz: 375223a38b2016acb6d3bf9f45a01b6e286b95b32dcd2ab39fa2f90e4d1758bc12e3409333b9370a1b4c653c0ee6d6e5d1249891d93fbff159e5d8d2ad2dcf66
|
data/Gemfile.lock
CHANGED
@@ -26,8 +26,8 @@ module ReeDao
|
|
26
26
|
load_association(assoc_type, assoc_name, **opts, &block)
|
27
27
|
end
|
28
28
|
|
29
|
-
def handle_field(
|
30
|
-
|
29
|
+
def handle_field(field_proc)
|
30
|
+
field_proc.call
|
31
31
|
end
|
32
32
|
|
33
33
|
contract(
|
@@ -109,13 +109,24 @@ module ReeDao
|
|
109
109
|
**global_opts
|
110
110
|
).instance_exec(assoc_list, &block)
|
111
111
|
else
|
112
|
-
ReeDao::Associations.new(
|
112
|
+
threads = ReeDao::Associations.new(
|
113
113
|
parent.agg_caller,
|
114
114
|
assoc_list,
|
115
115
|
parent.local_vars,
|
116
116
|
autoload_children,
|
117
117
|
**global_opts
|
118
|
-
).instance_exec(assoc_list, &block)
|
118
|
+
).instance_exec(assoc_list, &block)
|
119
|
+
threads[:association_threads].map do |association, assoc_type, assoc_name, opts, block|
|
120
|
+
Thread.new do
|
121
|
+
association.load(assoc_type, assoc_name, **opts, &block)
|
122
|
+
end
|
123
|
+
end.map(&:join)
|
124
|
+
|
125
|
+
threads[:field_threads].map do |association, field_proc|
|
126
|
+
Thread.new do
|
127
|
+
association.handle_field(field_proc)
|
128
|
+
end
|
129
|
+
end.map(&:join)
|
119
130
|
end
|
120
131
|
end
|
121
132
|
|
@@ -97,17 +97,18 @@ module ReeDao
|
|
97
97
|
association = Association.new(self, list, **global_opts)
|
98
98
|
|
99
99
|
if assoc_type == :field
|
100
|
+
field_proc = opts
|
100
101
|
{
|
101
102
|
association_threads: @assoc_threads,
|
102
|
-
field_threads: @field_threads <<
|
103
|
-
association
|
104
|
-
|
103
|
+
field_threads: @field_threads << [
|
104
|
+
association, field_proc
|
105
|
+
]
|
105
106
|
}
|
106
107
|
else
|
107
108
|
{
|
108
|
-
association_threads: @assoc_threads <<
|
109
|
-
association
|
110
|
-
|
109
|
+
association_threads: @assoc_threads << [
|
110
|
+
association, assoc_type, assoc_name, get_assoc_opts(opts), block
|
111
|
+
],
|
111
112
|
field_threads: @field_threads
|
112
113
|
}
|
113
114
|
end
|
@@ -68,8 +68,17 @@ class ReeDao::LoadAgg
|
|
68
68
|
if ReeDao.load_sync_associations_enabled?
|
69
69
|
associations
|
70
70
|
else
|
71
|
-
associations[:association_threads].map
|
72
|
-
|
71
|
+
associations[:association_threads].map do |association, assoc_type, assoc_name, opts, block|
|
72
|
+
Thread.new do
|
73
|
+
association.load(assoc_type, assoc_name, **opts, &block)
|
74
|
+
end
|
75
|
+
end.map(&:join)
|
76
|
+
|
77
|
+
associations[:field_threads].map do |association, field_proc|
|
78
|
+
Thread.new do
|
79
|
+
association.handle_field(field_proc)
|
80
|
+
end
|
81
|
+
end.map(&:join)
|
73
82
|
end
|
74
83
|
end
|
75
84
|
end
|
@@ -275,7 +275,7 @@ RSpec.describe :load_agg do
|
|
275
275
|
load_agg(users, ids_or_scope, **opts) do |agg_list|
|
276
276
|
some_id = agg_list.first.id
|
277
277
|
title = "1984"
|
278
|
-
belongs_to :organization
|
278
|
+
belongs_to :organization
|
279
279
|
|
280
280
|
has_many :books, -> { books_opts(title) }
|
281
281
|
end
|
data/lib/ree_lib/version.rb
CHANGED