docker-compose up -d cargo run --bin web- Install sqlx-cli
cargo install sqlx-cli- To migrate, run below command
cargo sqlx migrate run --database-url postgres://frustacean:abc123@localhost:5434/community
- After adding queries, run below command
cargo sqlx prepare --database-url postgres://frustacean:abc123@localhost:5434/community - EventStoreDB doesn't support snapshotting.
- Events are appended to the stream
post-123 - Every nth event, a snapshot is appended to the stream e.g.
post_snapshot-123- use
_instead of-in the suffix_snapshot,-is used by the system projection
- use
- Read backwards a single result from
post_snapshot-123streamReadStreamOptions options = ReadStreamOptions.get() .backwards() .fromEnd(); ReadResult result = client.readStream("post_snapshot-123", 1 /*maxCount*/, options) .get(); List<ResolvedEvent> events = result.getEvents();
- Read forwards from nth revisino from
post-123streamReadStreamOptions options = ReadStreamOptions.get() .forwards() .fromRevision(n); ReadResult result = client.readStream("post-123", options) .get(); List<ResolvedEvent> events = result.getEvents();