refactor(structure): move benchmarks, scenarios, adapters, utils to dedicated folders; update imports/project layout

This commit is contained in:
Sergey Penkovsky
2025-08-06 16:21:31 +03:00
parent 553dbb6539
commit b27a7df161
27 changed files with 332 additions and 327 deletions

View File

@@ -0,0 +1,42 @@
// === DI graph: A -> B -> C (factory/no singleton) ===
import 'package:cherrypick/cherrypick.dart';
import 'service.dart';
import 'service_impl.dart';
class ChainFactoryModule extends Module {
// количество независимых цепочек
final int chainCount;
// глубина вложенности
final int nestingDepth;
ChainFactoryModule({
required this.chainCount,
required this.nestingDepth,
});
@override
void builder(Scope currentScope) {
for (var chainIndex = 0; chainIndex < chainCount; chainIndex++) {
for (var levelIndex = 0; levelIndex < nestingDepth; levelIndex++) {
final chain = chainIndex + 1;
final level = levelIndex + 1;
final prevDepName = '${chain.toString()}_${(level - 1).toString()}';
final depName = '${chain.toString()}_${level.toString()}';
bind<Service>()
.toProvide(
() => ServiceImpl(
value: depName,
dependency: currentScope.tryResolve<Service>(
named: prevDepName,
),
),
)
.withName(depName);
}
}
}
}