INNER CODE UNIT · Rust

fmt

Trow-Registry/trow · src/repositories/mod.rs:33

    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("Repositories").finish_non_exhaustive()
    }
}

impl Repositories {
    /// Opens (or creates) the SQLite database at `db_file`, runs migrations,
    /// and returns a ready-to-use `Repositories` instance.
    pub async fn new(db_file: &str) -> Result<Self, MigrateError> {
        let options = SqliteConnectOptions::new()
            .filename(db_file)
            .synchronous(sqlx::sqlite::SqliteSynchronous::Normal)
            .journal_mode(sqlx::sqlite::SqliteJournalMode::Wal)
            .foreign_keys(true);

        let db_rw = SqlitePoolOptions::new()
            .max_connections(1)
            .connect_with(options.clone().create_if_missing(true))

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…