Expand description
§RouchDB
A local-first document database with CouchDB replication protocol support.
RouchDB is the Rust equivalent of PouchDB — it provides a local document store that can sync bidirectionally with CouchDB and compatible servers.
§Quick Start
use rouchdb::Database;
// In-memory database (for testing)
let db = Database::memory("mydb");
// Persistent database (redb)
let db = Database::open("path/to/mydb.redb", "mydb")?;
// Put a document
let result = db.put("doc1", serde_json::json!({"name": "Alice"})).await?;
// Get a document
let doc = db.get("doc1").await?;
// Replicate to/from CouchDB
let remote = Database::http("http://localhost:5984/mydb");
db.replicate_to(&remote).await?;Structs§
- AllDocs
Options - AllDocs
Response - AllDocs
Row - AllDocs
RowValue - Attachment
Meta - Auth
Client - A client that handles CouchDB authentication.
- Built
Index - A built in-memory index: sorted entries of (composite_key, doc_id).
- Bulk
Docs Options - Bulk
GetDoc - Bulk
GetError - Bulk
GetItem - Bulk
GetResponse - Bulk
GetResult - Change
Event - Change
Receiver - A receiver for change notifications.
- Change
Rev - Change
Sender - A sender for change notifications. Adapters use this to notify listeners when documents are written.
- Changes
Handle - Handle for a live changes stream. Dropping or cancelling stops the stream.
- Changes
Options - Changes
Response - Changes
Stream Options - Configuration for a changes stream.
- Create
Index Response - Result of creating an index.
- Database
- A high-level database handle that wraps any adapter implementation.
- DbInfo
- Design
Document - A CouchDB design document.
- DocMetadata
- Internal metadata stored per document in the adapter.
- DocResult
- Document
- A CouchDB-compatible document.
- Explain
Index - Description of the index used by a query.
- Explain
Response - Response from
explain()describing how a query would be executed. - Find
Options - Options for a Mango find query.
- Find
Response - Result of a find query.
- GetAttachment
Options - GetOptions
- Http
Adapter - HTTP adapter that talks to a remote CouchDB instance.
- Index
Definition - Definition of a Mango index.
- Index
Fields - The fields portion of an index definition.
- Index
Info - Information about an existing index.
- Live
Changes Stream - A live changes stream that yields change events as they happen.
- Memory
Adapter - In-memory adapter for RouchDB. All data is held in RAM.
- Partition
- A partitioned view of a database.
- Persistent
View Index - A persistent view index that is incrementally updated.
- Purge
Response - PutResponse
- Redb
Adapter - Persistent adapter backed by
redb. - Replication
Handle - Handle for a live replication task. Dropping this cancels the replication.
- Replication
Options - Replication configuration.
- Replication
Result - Result of a completed replication.
- RevInfo
- Revision info entry returned when
revs_infois requested. - Revision
- A CouchDB revision identifier:
{pos}-{hash}. - Revs
Diff Response - Revs
Diff Result - Security
Document - Security
Group - Session
- A CouchDB session response.
- User
Context - User context from a session response.
- ViewDef
- A view definition containing map and optional reduce functions.
- View
Engine - Engine for building and querying persistent views.
- View
Query Options - Options for querying a view.
- View
Result - Result of querying a view.
Enums§
- Changes
Event - Lifecycle events emitted by a live changes stream.
- Changes
Style - Controls which revisions appear in each change event.
- Open
Revs - Reduce
Fn - Built-in reduce functions matching CouchDB’s built-ins.
- Replication
Event - Events emitted during replication for progress tracking.
- Replication
Filter - Filter for selective replication.
- Rouch
Error - All errors that RouchDB can produce.
- Seq
- A database sequence identifier.
- Sort
Field - A single sort field with direction.
- Stale
Option - Controls whether the index is rebuilt before querying.
Traits§
- Adapter
- The trait all storage adapters must implement.
- Plugin
- Plugin trait for extending Database behavior.
Functions§
- build_
index - Build an index from all documents in an adapter.
- find
- Execute a Mango find query against an adapter.
- is_
deleted - Check if the document’s winning revision is deleted.
- live_
changes - Start a live changes stream that sends events through an mpsc channel.
- live_
changes_ events - Start a live changes stream that emits lifecycle events.
- matches_
selector - Check if a document matches a Mango selector.
- query_
view - Run a temporary (ad-hoc) map/reduce query.
- replicate
- Run a one-shot replication from source to target.
- replicate_
live - Run continuous (live) replication from source to target.
- replicate_
with_ events - Run a one-shot replication with event streaming.
- winning_
rev - Determine the winning revision of a document.
Type Aliases§
- Changes
Filter - A filter function for changes events.
- Result