Skip to main content

Module connection

Module connection 

Source
Expand description

Typed wrappers around sea_orm::DatabaseConnection.

Splits a connection into DbReadConnection and DbWriteConnection so the type system enforces which pool a given operation hits. SQLite is single-writer system-wide; routing every write through a dedicated single-connection write pool turns intra-process contention into an in-process queue rather than SQLITE_BUSY retries.

Both types implement sea_orm::ConnectionTrait, so existing query builders (Entity::find().all(db), Entity::insert(...).exec(db), etc.) work without source changes — callers just pick the right type for the operation.

Structs§

DbReadConnection
Read pool. Multi-connection; concurrent reads enabled by WAL mode.
DbWriteConnection
Write pool. Single connection; serialises in-process writes so the SQLite writer lock is never contested from within one process.