continuum_store_memory 4.1.0 copy "continuum_store_memory: ^4.1.0" to clipboard
continuum_store_memory: ^4.1.0 copied to clipboard

In-memory EventStore implementation for the continuum event sourcing library.

Continuum Store Memory #

In-memory EventStore implementation for continuum. Events are stored in memory and lost when the application exits.

Installation #

dependencies:
  continuum: latest
  continuum_store_memory: latest

Usage #

import 'package:continuum/continuum.dart';
import 'package:continuum_store_memory/continuum_store_memory.dart';
import 'continuum.g.dart'; // Generated

void main() async {
  final store = EventSourcingStore(
    eventStore: InMemoryEventStore(),
    aggregates: $aggregateList,
  );

  // Use your aggregates
  final userId = StreamId('user-1');
  final session = store.openSession();
  session.startStream<User>(
    userId,
    UserRegistered(userId: userId.value, name: 'Alice', email: 'alice@example.com'),
  );
  await session.saveChangesAsync();

  final readSession = store.openSession();
  final user = await readSession.loadAsync<User>(userId);
}

When to Use #

Good for:

  • Unit tests and integration tests
  • Development and prototyping
  • Demos and examples
  • Short-lived processes

Not suitable for:

  • Production applications (data is not persisted)
  • Long-running applications that need durability

For production, use continuum_store_hive or implement your own EventStore.

API #

InMemoryEventStore() #

Creates a new in-memory event store.

final eventStore = InMemoryEventStore();

All events are stored in memory and will be lost when the instance is garbage collected or the application exits.

Example #

See example/lib/main.dart for a complete example.

License #

MIT

0
likes
160
points
446
downloads

Publisher

verified publisherzooper.dev

Weekly Downloads

In-memory EventStore implementation for the continuum event sourcing library.

Homepage
Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

continuum, zooper_flutter_core

More

Packages that depend on continuum_store_memory