in_memory library
A working in-memory backend for this package: the reference to copy.
package:sku_catalog/sku_catalog.dart is the model and its operations. This is
the third thing — the storage a consumer otherwise writes themselves: one
in-memory store per repository contract, a unit of work that rolls back by
snapshot, and an InMemoryCatalog composition root that wires the model's
rules and operations over both.
It is not this package's persistence story. It is durable to nothing, indexes nothing, and is not safe across isolates: it exists so the contracts and the operations can be read as a running system, and so a consumer has a known-good shape to replace piece by piece.
import 'package:sku_catalog/in_memory.dart';
import 'package:sku_catalog/sku_catalog.dart';
final catalog = InMemoryCatalog();
await catalog.createInstance(instance: article).run(); // rules included
Classes
- InMemoryCatalog
- An in-memory catalog: every store, one transaction over all of them, and the model's rules and operations wired the way a composition root would.
- InMemoryImageRepository
- An in-memory IImageRepository — one row per image, tagged with its owner.
- InMemoryInstanceRepository
- An in-memory IInstanceRepository.
- InMemoryLocateRepository
- An in-memory ILocateRepository — the place tree.
- InMemoryManufacturerRepository
- An in-memory IManufacturerRepository.
- InMemoryMetaRepository
- An in-memory IMetaRepository — the catalog's own single record.
- InMemoryRowSource
- A store whose rows a transaction can snapshot and put back.
- InMemorySkuAssociationRepository
- An in-memory ISkuAssociationRepository — the labeled relationship edges.
- InMemorySkuComponentRepository
- An in-memory ISkuComponentRepository — the assembly edges.
- InMemorySkuRepository
- An in-memory ISkuRepository.
-
InMemoryTable<
T> - A map-backed table of records, keyed by id and stored as their JSON row.
- InMemoryTraitAttributeDefinitionRepository
- An in-memory ITraitAttributeDefinitionRepository.
- InMemoryTraitRepository
- An in-memory ITraitRepository.
- InMemoryUnitOfWork
-
A real transaction over in-memory tables: every table it was built over is
snapshotted before the body runs and put back when the body returns a
Left.
Mixins
-
InMemoryRowSourceBy<
T> - A repository backed by one InMemoryTable, exposing that table's rows — so a transaction snapshots the repository itself instead of reaching into it.