ree_lib 1.0.68 → 1.0.69
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 +4 -4
- data/lib/ree_lib/packages/ree_dao/package/ree_dao/association.rb +26 -31
- data/lib/ree_lib/packages/ree_dao/package/ree_dao/association_methods.rb +11 -16
- data/lib/ree_lib/packages/ree_dao/package/ree_dao/associations.rb +7 -9
- data/lib/ree_lib/packages/ree_dao/package/ree_dao/functions/agg.rb +6 -20
- data/lib/ree_lib/packages/ree_dao/schemas/ree_dao/functions/agg.schema.json +2 -17
- data/lib/ree_lib/packages/ree_dao/spec/ree_dao/functions/load_agg/agg_benchmark_spec.rb +5 -5
- data/lib/ree_lib/packages/ree_dao/spec/ree_dao/functions/load_agg/agg_spec.rb +9 -9
- data/lib/ree_lib/packages/ree_dao/spec/ree_dao/functions/load_agg/ree_dao_agg_test.rb +4 -4
- 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: c746828c8b09f58c0406659649ef01ba7b7300f4b1f35f808f8e1f58a0dc4165
|
4
|
+
data.tar.gz: c03ddd00be42dbbe2ee2e2660a105a84912d19ccb5251fd882bd88d04e5bd781
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fa6ca950b18d4e6678610f8dd1b1d3c239090e18d7c914be33643e75d846332e041109d8cb2f6d301398e9eafeeb6897320bfac688c2defb427bc2bec6a4e5c
|
7
|
+
data.tar.gz: 13405b30d0b4be4aba5e579f8bab5a410af29fe820a5aca37502ea6a7d356a5d5fdad315214fa70b8581927c7ee712607a101b191ec2d9fd383a4b4e1989f8a8
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ree_lib (1.0.
|
4
|
+
ree_lib (1.0.69)
|
5
5
|
binding_of_caller (~> 1.0.0)
|
6
6
|
i18n (~> 1.12.0)
|
7
7
|
loofah (~> 2.18.0)
|
@@ -37,10 +37,10 @@ GEM
|
|
37
37
|
loofah (2.18.0)
|
38
38
|
crass (~> 1.0.2)
|
39
39
|
nokogiri (>= 1.5.9)
|
40
|
-
mini_portile2 (2.8.1)
|
41
40
|
msgpack (1.6.0)
|
42
|
-
nokogiri (1.
|
43
|
-
|
41
|
+
nokogiri (1.15.4-x86_64-darwin)
|
42
|
+
racc (~> 1.4)
|
43
|
+
nokogiri (1.15.4-x86_64-linux)
|
44
44
|
racc (~> 1.4)
|
45
45
|
oj (3.13.23)
|
46
46
|
pg (1.4.6)
|
@@ -8,12 +8,12 @@ module ReeDao
|
|
8
8
|
link :index_by, from: :ree_array
|
9
9
|
link :underscore, from: :ree_string
|
10
10
|
|
11
|
-
attr_reader :parent, :
|
11
|
+
attr_reader :parent, :parent_dao, :list, :global_opts
|
12
12
|
|
13
|
-
contract(ReeDao::Associations,
|
14
|
-
def initialize(parent,
|
13
|
+
contract(ReeDao::Associations, Sequel::Dataset, Array, Ksplat[RestKeys => Any] => Any)
|
14
|
+
def initialize(parent, parent_dao, list, **global_opts)
|
15
15
|
@parent = parent
|
16
|
-
@
|
16
|
+
@parent_dao = parent_dao
|
17
17
|
@list = list
|
18
18
|
@global_opts = global_opts
|
19
19
|
end
|
@@ -36,7 +36,7 @@ module ReeDao
|
|
36
36
|
Or[:belongs_to, :has_one, :has_many],
|
37
37
|
Symbol,
|
38
38
|
Ksplat[RestKeys => Any],
|
39
|
-
Optblock =>
|
39
|
+
Optblock => Array
|
40
40
|
)
|
41
41
|
def load_association(assoc_type, assoc_name, **__opts, &block)
|
42
42
|
__opts[:autoload_children] ||= false
|
@@ -47,21 +47,17 @@ module ReeDao
|
|
47
47
|
**__opts
|
48
48
|
)
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
dao_name = if dao
|
53
|
-
dao.first_source_table
|
54
|
-
elsif __opts[:scope].is_a?(Array)
|
55
|
-
name = underscore(demodulize(__opts[:scope].first.class.name))
|
50
|
+
scope = __opts[:scope]
|
56
51
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
52
|
+
dao = if scope.is_a?(Array)
|
53
|
+
return [] if scope.empty?
|
54
|
+
name = underscore(demodulize(scope.first.class.name))
|
55
|
+
find_dao(name, parent, nil)
|
56
|
+
else
|
57
|
+
find_dao(assoc_name, parent, scope)
|
62
58
|
end
|
63
59
|
|
64
|
-
process_block(assoc_index, __opts[:autoload_children], __opts[:to_dto],
|
60
|
+
process_block(assoc_index, __opts[:autoload_children], __opts[:to_dto], dao, &block) if block_given?
|
65
61
|
|
66
62
|
list
|
67
63
|
end
|
@@ -75,7 +71,7 @@ module ReeDao
|
|
75
71
|
case type
|
76
72
|
when :belongs_to
|
77
73
|
one_to_one(
|
78
|
-
|
74
|
+
parent_dao,
|
79
75
|
assoc_name,
|
80
76
|
list,
|
81
77
|
scope: __opts[:scope],
|
@@ -86,7 +82,7 @@ module ReeDao
|
|
86
82
|
)
|
87
83
|
when :has_one
|
88
84
|
one_to_one(
|
89
|
-
|
85
|
+
parent_dao,
|
90
86
|
assoc_name,
|
91
87
|
list,
|
92
88
|
scope: __opts[:scope],
|
@@ -98,7 +94,7 @@ module ReeDao
|
|
98
94
|
)
|
99
95
|
when :has_many
|
100
96
|
one_to_many(
|
101
|
-
|
97
|
+
parent_dao,
|
102
98
|
assoc_name,
|
103
99
|
list,
|
104
100
|
scope: __opts[:scope],
|
@@ -110,8 +106,8 @@ module ReeDao
|
|
110
106
|
end
|
111
107
|
end
|
112
108
|
|
113
|
-
contract(Or[Hash, Array], Bool, Nilor[Proc],
|
114
|
-
def process_block(assoc, autoload_children, to_dto,
|
109
|
+
contract(Or[Hash, Array], Bool, Nilor[Proc], Sequel::Dataset, Block => Any)
|
110
|
+
def process_block(assoc, autoload_children, to_dto, parent_dao, &block)
|
115
111
|
assoc_list = assoc.is_a?(Array) ? assoc : assoc.values.flatten
|
116
112
|
|
117
113
|
if to_dto
|
@@ -124,13 +120,12 @@ module ReeDao
|
|
124
120
|
parent.agg_caller,
|
125
121
|
assoc_list,
|
126
122
|
parent.local_vars,
|
127
|
-
|
123
|
+
parent_dao,
|
128
124
|
autoload_children,
|
129
125
|
**global_opts
|
130
126
|
)
|
131
|
-
parent_dao = find_dao(parent_dao_name, parent.agg_caller)
|
132
127
|
|
133
|
-
if
|
128
|
+
if parent_dao.db.in_transaction? || ReeDao::Associations.sync_mode?
|
134
129
|
associations.instance_exec(assoc_list, &block)
|
135
130
|
else
|
136
131
|
threads = associations.instance_exec(assoc_list, &block)
|
@@ -150,7 +145,7 @@ module ReeDao
|
|
150
145
|
end
|
151
146
|
|
152
147
|
contract(
|
153
|
-
|
148
|
+
Sequel::Dataset,
|
154
149
|
Symbol,
|
155
150
|
Array,
|
156
151
|
Kwargs[
|
@@ -162,7 +157,7 @@ module ReeDao
|
|
162
157
|
reverse: Bool
|
163
158
|
] => Or[Hash, Array]
|
164
159
|
)
|
165
|
-
def one_to_one(
|
160
|
+
def one_to_one(parent_dao, assoc_name, list, scope: nil, primary_key: :id, foreign_key: nil, setter: nil, to_dto: nil, reverse: true)
|
166
161
|
return {} if list.empty?
|
167
162
|
|
168
163
|
primary_key ||= :id
|
@@ -175,7 +170,7 @@ module ReeDao
|
|
175
170
|
if reverse
|
176
171
|
# has_one
|
177
172
|
if !foreign_key
|
178
|
-
foreign_key = "#{
|
173
|
+
foreign_key = "#{parent_dao.first_source_table.to_s.gsub(/s$/,'')}_id".to_sym
|
179
174
|
end
|
180
175
|
|
181
176
|
root_ids = list.map(&:id).uniq
|
@@ -211,7 +206,7 @@ module ReeDao
|
|
211
206
|
end
|
212
207
|
|
213
208
|
contract(
|
214
|
-
|
209
|
+
Sequel::Dataset,
|
215
210
|
Symbol,
|
216
211
|
Array,
|
217
212
|
Kwargs[
|
@@ -222,7 +217,7 @@ module ReeDao
|
|
222
217
|
to_dto: Nilor[Proc]
|
223
218
|
] => Or[Hash, Array]
|
224
219
|
)
|
225
|
-
def one_to_many(
|
220
|
+
def one_to_many(parent_dao, assoc_name, list, primary_key: nil, foreign_key: nil, scope: nil, setter: nil, to_dto: nil)
|
226
221
|
return {} if list.empty?
|
227
222
|
|
228
223
|
primary_key ||= :id
|
@@ -233,7 +228,7 @@ module ReeDao
|
|
233
228
|
assoc_dao = nil
|
234
229
|
assoc_dao = find_dao(assoc_name, parent, scope)
|
235
230
|
|
236
|
-
foreign_key ||= "#{
|
231
|
+
foreign_key ||= "#{parent_dao.first_source_table.to_s.gsub(/s$/, '')}_id".to_sym
|
237
232
|
|
238
233
|
root_ids = list.map(&:"#{primary_key}")
|
239
234
|
|
@@ -9,25 +9,20 @@ module ReeDao
|
|
9
9
|
end
|
10
10
|
|
11
11
|
module InstanceMethods
|
12
|
+
SUFFIXES = ["", "s", "es", "dao", "s_dao", "es_dao"].freeze
|
13
|
+
|
12
14
|
def find_dao(assoc_name, parent_caller, scope = nil)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
15
|
+
SUFFIXES.each do |suffix|
|
16
|
+
dao_from_name = parent_caller.instance_variable_get("@#{assoc_name}#{suffix}")
|
17
|
+
return dao_from_name if dao_from_name
|
18
|
+
end
|
19
|
+
|
20
|
+
if scope.is_a?(Sequel::Dataset)
|
21
|
+
return scope.unfiltered
|
22
|
+
end
|
23
|
+
|
23
24
|
raise ArgumentError, "can't find DAO for :#{assoc_name}, provide correct scope or association name"
|
24
25
|
end
|
25
|
-
|
26
|
-
def dao_in_transaction?(dao)
|
27
|
-
return false if dao.nil?
|
28
|
-
|
29
|
-
dao.db.in_transaction?
|
30
|
-
end
|
31
26
|
end
|
32
27
|
end
|
33
28
|
end
|
@@ -3,23 +3,23 @@ module ReeDao
|
|
3
3
|
include Ree::LinkDSL
|
4
4
|
include ReeDao::AssociationMethods
|
5
5
|
|
6
|
-
attr_reader :agg_caller, :list, :local_vars, :only, :except, :
|
6
|
+
attr_reader :agg_caller, :list, :local_vars, :only, :except, :parent_dao, :autoload_children, :global_opts
|
7
7
|
|
8
|
-
def initialize(agg_caller, list, local_vars,
|
8
|
+
def initialize(agg_caller, list, local_vars, parent_dao, autoload_children = false, **opts)
|
9
9
|
@agg_caller = agg_caller
|
10
10
|
@list = list
|
11
11
|
@local_vars = local_vars
|
12
12
|
@global_opts = opts || {}
|
13
13
|
@only = opts[:only] if opts[:only]
|
14
14
|
@except = opts[:except] if opts[:except]
|
15
|
-
@
|
15
|
+
@parent_dao = parent_dao
|
16
16
|
@autoload_children = autoload_children
|
17
17
|
|
18
18
|
if @only && @except
|
19
19
|
shared_keys = @only.intersection(@except)
|
20
20
|
|
21
21
|
if shared_keys.size > 0
|
22
|
-
raise ArgumentError.new("you can't use both :only and :except for #{shared_keys.map { "\"#{_1}\"" }.join(", ")} keys")
|
22
|
+
raise ArgumentError.new("you can't use both :only and :except for #{shared_keys.map { "\"#{_1}\"" }.join(", ")} keys")
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -87,12 +87,10 @@ module ReeDao
|
|
87
87
|
Optblock => Any
|
88
88
|
)
|
89
89
|
def association(assoc_type, assoc_name, __opts, &block)
|
90
|
-
parent_dao
|
91
|
-
|
92
|
-
if dao_in_transaction?(parent_dao) || self.class.sync_mode?
|
90
|
+
if parent_dao.db.in_transaction? || self.class.sync_mode?
|
93
91
|
return if association_is_not_included?(assoc_name) || list.empty?
|
94
92
|
|
95
|
-
association = Association.new(self,
|
93
|
+
association = Association.new(self, parent_dao, list, **global_opts)
|
96
94
|
|
97
95
|
if assoc_type == :field
|
98
96
|
association.handle_field(assoc_name, __opts)
|
@@ -104,7 +102,7 @@ module ReeDao
|
|
104
102
|
return { association_threads: @assoc_threads, field_threads: @field_threads }
|
105
103
|
end
|
106
104
|
|
107
|
-
association = Association.new(self,
|
105
|
+
association = Association.new(self, parent_dao, list, **global_opts)
|
108
106
|
|
109
107
|
if assoc_type == :field
|
110
108
|
field_proc = __opts
|
@@ -2,18 +2,15 @@
|
|
2
2
|
|
3
3
|
class ReeDao::Agg
|
4
4
|
include Ree::FnDSL
|
5
|
-
include ReeDao::AssociationMethods
|
6
5
|
|
7
6
|
fn :agg do
|
8
|
-
link :demodulize, from: :ree_string
|
9
|
-
link :underscore, from: :ree_string
|
10
7
|
link "ree_dao/associations", -> { Associations }
|
11
8
|
link "ree_dao/contract/dao_dataset_contract", -> { DaoDatasetContract }
|
12
9
|
link "ree_dao/contract/entity_contract", -> { EntityContract }
|
13
10
|
end
|
14
11
|
|
15
12
|
contract(
|
16
|
-
|
13
|
+
DaoDatasetContract,
|
17
14
|
Or[Sequel::Dataset, ArrayOf[Integer], ArrayOf[EntityContract], Integer],
|
18
15
|
Ksplat[
|
19
16
|
only?: ArrayOf[Symbol],
|
@@ -23,26 +20,16 @@ class ReeDao::Agg
|
|
23
20
|
],
|
24
21
|
Optblock => ArrayOf[Any]
|
25
22
|
)
|
26
|
-
def call(dao
|
23
|
+
def call(dao, ids_or_scope, **opts, &block)
|
27
24
|
scope = if ids_or_scope.is_a?(Array) && ids_or_scope.any? { _1.is_a?(Integer) }
|
28
|
-
raise ArgumentError.new("Dao should be provided") if dao.nil?
|
29
25
|
return [] if ids_or_scope.empty?
|
30
|
-
|
31
26
|
dao.where(id: ids_or_scope)
|
32
27
|
elsif ids_or_scope.is_a?(Integer)
|
33
|
-
raise ArgumentError.new("Dao should be provided") if dao.nil?
|
34
|
-
|
35
28
|
dao.where(id: ids_or_scope)
|
36
29
|
else
|
37
30
|
ids_or_scope
|
38
31
|
end
|
39
32
|
|
40
|
-
if dao
|
41
|
-
dao_name = dao.first_source_table
|
42
|
-
else
|
43
|
-
dao_name = underscore(demodulize(scope.first.class.name)).to_sym
|
44
|
-
end
|
45
|
-
|
46
33
|
list = scope.is_a?(Sequel::Dataset) ? scope.all : scope
|
47
34
|
|
48
35
|
if opts[:to_dto]
|
@@ -51,7 +38,7 @@ class ReeDao::Agg
|
|
51
38
|
end
|
52
39
|
end
|
53
40
|
|
54
|
-
load_associations(
|
41
|
+
load_associations(dao.unfiltered, list, **opts, &block) if block_given?
|
55
42
|
|
56
43
|
if ids_or_scope.is_a?(Array)
|
57
44
|
list.sort_by { ids_or_scope.index(_1.id) }
|
@@ -62,7 +49,7 @@ class ReeDao::Agg
|
|
62
49
|
|
63
50
|
private
|
64
51
|
|
65
|
-
def load_associations(
|
52
|
+
def load_associations(dao, list, **opts, &block)
|
66
53
|
return if list.empty?
|
67
54
|
|
68
55
|
local_vars = block.binding.eval(<<-CODE, __FILE__, __LINE__ + 1)
|
@@ -72,10 +59,9 @@ class ReeDao::Agg
|
|
72
59
|
|
73
60
|
agg_caller = block.binding.eval("self")
|
74
61
|
|
75
|
-
associations = Associations.new(agg_caller, list, local_vars,
|
76
|
-
dao = find_dao(dao_name, agg_caller)
|
62
|
+
associations = Associations.new(agg_caller, list, local_vars, dao, **opts).instance_exec(list, &block)
|
77
63
|
|
78
|
-
if
|
64
|
+
if dao.db.in_transaction? || ReeDao.load_sync_associations_enabled?
|
79
65
|
associations
|
80
66
|
else
|
81
67
|
associations[:association_threads].map do |association, assoc_type, assoc_name, opts, block|
|
@@ -16,8 +16,8 @@
|
|
16
16
|
"args": [
|
17
17
|
{
|
18
18
|
"arg": "dao",
|
19
|
-
"arg_type": "
|
20
|
-
"type": "
|
19
|
+
"arg_type": "req",
|
20
|
+
"type": "PackageName::DaoName::Dao: \"SELECT * FROM `table`\""
|
21
21
|
},
|
22
22
|
{
|
23
23
|
"arg": "ids_or_scope",
|
@@ -38,21 +38,6 @@
|
|
38
38
|
}
|
39
39
|
],
|
40
40
|
"links": [
|
41
|
-
{
|
42
|
-
"target": "demodulize",
|
43
|
-
"package_name": "ree_string",
|
44
|
-
"as": "demodulize",
|
45
|
-
"imports": [
|
46
41
|
|
47
|
-
]
|
48
|
-
},
|
49
|
-
{
|
50
|
-
"target": "underscore",
|
51
|
-
"package_name": "ree_string",
|
52
|
-
"as": "underscore",
|
53
|
-
"imports": [
|
54
|
-
|
55
|
-
]
|
56
|
-
}
|
57
42
|
]
|
58
43
|
}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'faker'
|
3
3
|
require 'benchmark'
|
4
4
|
|
5
|
-
RSpec.
|
5
|
+
RSpec.xdescribe :agg do
|
6
6
|
link :agg, from: :ree_dao
|
7
7
|
link :build_pg_connection, from: :ree_dao
|
8
8
|
|
@@ -115,7 +115,7 @@ RSpec.describe :agg do
|
|
115
115
|
|
116
116
|
aggregate :agg_users_benchmark do
|
117
117
|
link :users, from: :ree_dao_agg_test
|
118
|
-
link :
|
118
|
+
link :organizations_dao, from: :ree_dao_agg_test
|
119
119
|
link :user_passports, from: :ree_dao_agg_test
|
120
120
|
link :books, from: :ree_dao_agg_test
|
121
121
|
link :movies, from: :ree_dao_agg_test
|
@@ -151,7 +151,7 @@ RSpec.describe :agg do
|
|
151
151
|
|
152
152
|
fn :users_sync_fetcher do
|
153
153
|
link :users, from: :ree_dao_agg_test
|
154
|
-
link :
|
154
|
+
link :organizations_dao, from: :ree_dao_agg_test
|
155
155
|
link :user_passports, from: :ree_dao_agg_test
|
156
156
|
link :books, from: :ree_dao_agg_test
|
157
157
|
link :movies, from: :ree_dao_agg_test
|
@@ -183,7 +183,7 @@ RSpec.describe :agg do
|
|
183
183
|
return [] if list.empty?
|
184
184
|
|
185
185
|
if include.include?(:organization)
|
186
|
-
one_to_one(list,
|
186
|
+
one_to_one(list, organizations_dao.order(:id))
|
187
187
|
end
|
188
188
|
|
189
189
|
if include.include?(:books)
|
@@ -233,7 +233,7 @@ RSpec.describe :agg do
|
|
233
233
|
let(:agg_users) { ReeDaoAggTest::AggUsersBenchmark.new }
|
234
234
|
let(:users_sync_fetcher) { ReeDaoAggTest::UsersSyncFetcher.new }
|
235
235
|
|
236
|
-
let(:organizations) { ReeDaoAggTest::
|
236
|
+
let(:organizations) { ReeDaoAggTest::OrganizationsDao.new }
|
237
237
|
let(:users) { ReeDaoAggTest::Users.new }
|
238
238
|
let(:user_passports) { ReeDaoAggTest::UserPassports.new }
|
239
239
|
let(:books) { ReeDaoAggTest::Books.new }
|
@@ -18,7 +18,7 @@ RSpec.describe :agg do
|
|
18
18
|
connection.drop_table(:user_passports, cascade: true) if connection.table_exists?(:user_passports)
|
19
19
|
connection.drop_table(:books, cascade: true) if connection.table_exists?(:books)
|
20
20
|
connection.drop_table(:chapters, cascade: true) if connection.table_exists?(:chapters)
|
21
|
-
connection.drop_table(:
|
21
|
+
connection.drop_table(:avtorki, cascade: true) if connection.table_exists?(:avtorki)
|
22
22
|
connection.drop_table(:reviews, cascade: true) if connection.table_exists?(:reviews)
|
23
23
|
connection.drop_table(:review_authors, cascade: true) if connection.table_exists?(:review_authors)
|
24
24
|
|
@@ -71,7 +71,7 @@ RSpec.describe :agg do
|
|
71
71
|
column :name, 'varchar(256)'
|
72
72
|
end
|
73
73
|
|
74
|
-
connection.create_table :
|
74
|
+
connection.create_table :avtorki do
|
75
75
|
primary_key :id
|
76
76
|
|
77
77
|
foreign_key :book_id, :books, null: false, on_delete: :cascade
|
@@ -88,7 +88,7 @@ RSpec.describe :agg do
|
|
88
88
|
|
89
89
|
aggregate :agg_users do
|
90
90
|
link :users, from: :ree_dao_agg_test
|
91
|
-
link :
|
91
|
+
link :organizations_dao, from: :ree_dao_agg_test
|
92
92
|
link :user_passports, from: :ree_dao_agg_test
|
93
93
|
link :books, from: :ree_dao_agg_test
|
94
94
|
link :chapters, from: :ree_dao_agg_test
|
@@ -160,7 +160,7 @@ RSpec.describe :agg do
|
|
160
160
|
link :books, from: :ree_dao_agg_test
|
161
161
|
link :authors, from: :ree_dao_agg_test
|
162
162
|
link :chapters, from: :ree_dao_agg_test
|
163
|
-
link :
|
163
|
+
link :organizations_dao, from: :ree_dao_agg_test
|
164
164
|
link :agg, from: :ree_dao
|
165
165
|
end
|
166
166
|
|
@@ -268,7 +268,7 @@ RSpec.describe :agg do
|
|
268
268
|
|
269
269
|
aggregate :agg_users_block_test do
|
270
270
|
link :users, from: :ree_dao_agg_test
|
271
|
-
link :
|
271
|
+
link :organizations_dao, from: :ree_dao_agg_test
|
272
272
|
link :books, from: :ree_dao_agg_test
|
273
273
|
link :agg, from: :ree_dao
|
274
274
|
end
|
@@ -297,7 +297,7 @@ RSpec.describe :agg do
|
|
297
297
|
|
298
298
|
aggregate :agg_users_scope_method_test do
|
299
299
|
link :users, from: :ree_dao_agg_test
|
300
|
-
link :
|
300
|
+
link :organizations_dao, from: :ree_dao_agg_test
|
301
301
|
link :books, from: :ree_dao_agg_test
|
302
302
|
link :agg, from: :ree_dao
|
303
303
|
end
|
@@ -345,7 +345,7 @@ RSpec.describe :agg do
|
|
345
345
|
|
346
346
|
aggregate :agg_users_without_dao do
|
347
347
|
link :users, from: :ree_dao_agg_test
|
348
|
-
link :
|
348
|
+
link :organizations_dao, from: :ree_dao_agg_test
|
349
349
|
link :books, from: :ree_dao_agg_test
|
350
350
|
link :agg, from: :ree_dao
|
351
351
|
end
|
@@ -362,7 +362,7 @@ RSpec.describe :agg do
|
|
362
362
|
|
363
363
|
aggregate :agg_users_only_except_keys do
|
364
364
|
link :users, from: :ree_dao_agg_test
|
365
|
-
link :
|
365
|
+
link :organizations_dao, from: :ree_dao_agg_test
|
366
366
|
link :books, from: :ree_dao_agg_test
|
367
367
|
link :agg, from: :ree_dao
|
368
368
|
end
|
@@ -384,7 +384,7 @@ RSpec.describe :agg do
|
|
384
384
|
let(:agg_users_with_dto) { ReeDaoAggTest::AggUsersWithDto.new }
|
385
385
|
let(:agg_users_only_dataset) { ReeDaoAggTest::AggUsersOnlyDataset.new }
|
386
386
|
let(:user_agg_only_except_keys) { ReeDaoAggTest::AggUsersOnlyExceptCase.new }
|
387
|
-
let(:organizations) { ReeDaoAggTest::
|
387
|
+
let(:organizations) { ReeDaoAggTest::OrganizationsDao.new }
|
388
388
|
let(:users) { ReeDaoAggTest::Users.new }
|
389
389
|
let(:user_passports) { ReeDaoAggTest::UserPassports.new }
|
390
390
|
let(:books) { ReeDaoAggTest::Books.new }
|
@@ -179,7 +179,7 @@ class ReeDaoAggTest::Organization
|
|
179
179
|
id: Nilor[Integer],
|
180
180
|
name: String
|
181
181
|
)
|
182
|
-
|
182
|
+
|
183
183
|
contract(Array[ReeDaoAggTest::User] => nil)
|
184
184
|
def set_users(users)
|
185
185
|
@users = users; nil
|
@@ -354,10 +354,10 @@ class ReeDaoAggTest::Users
|
|
354
354
|
filter :by_name, -> (name) { where(name: name) }
|
355
355
|
end
|
356
356
|
|
357
|
-
class ReeDaoAggTest::
|
357
|
+
class ReeDaoAggTest::OrganizationsDao
|
358
358
|
include ReeDao::DSL
|
359
359
|
|
360
|
-
dao :
|
360
|
+
dao :organizations_dao do
|
361
361
|
link :db
|
362
362
|
end
|
363
363
|
|
@@ -538,7 +538,7 @@ class ReeDaoAggTest::Authors
|
|
538
538
|
link :db
|
539
539
|
end
|
540
540
|
|
541
|
-
table :
|
541
|
+
table :avtorki
|
542
542
|
|
543
543
|
schema ReeDaoAggTest::Author do
|
544
544
|
integer :id, null: true
|
data/lib/ree_lib/version.rb
CHANGED