Skip to content

Commit 982f5f1

Browse files
committed
chore: clean up new lines and doc comments
1 parent 216dde0 commit 982f5f1

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

crates/sqlx-sqlite-conn-mgr/src/database.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ use tracing::error;
1414

1515
/// SQLite database with connection pooling for concurrent reads and optional exclusive writes.
1616
///
17-
/// The database is opened in read-write mode but can be used for read-only operations
18-
/// by calling `read_pool()`. Write operations are available by calling `acquire_writer()`
19-
/// which lazily initializes WAL mode on first use.
17+
/// Once the database is opened it can be used for read-only operations by calling `read_pool()`.
18+
/// Write operations are available by calling `acquire_writer()` which lazily initializes WAL mode
19+
/// on first use.
2020
///
2121
/// # Example
2222
///
@@ -67,7 +67,7 @@ impl SqliteDatabase {
6767
/// If the database is already connected, returns the existing connection.
6868
/// Multiple calls with the same path will return the same database instance.
6969
///
70-
/// The database is created if it doesn't exist. WAL mode is optionally enabled when
70+
/// The database is created if it doesn't exist. WAL mode is enabled when
7171
/// `acquire_writer()` is first called.
7272
///
7373
/// # Arguments
@@ -132,7 +132,8 @@ impl SqliteDatabase {
132132
// Why do we need to manually create the database file? We could just let the connection
133133
// create it if it doesn't exist, using `create_if_missing(true)`, right? Not if we called
134134
// connect and then our very first query was a read-only query, like `PRAGMA user_version;`,
135-
// for example. That would fail because the read pool cannot create the file
135+
// for example. That would fail because the read pool connections are read-only and cannot
136+
// create the file
136137
if !db_exists && !is_memory_database(&path) {
137138
let create_options = SqliteConnectOptions::new()
138139
.filename(&path)
@@ -175,7 +176,7 @@ impl SqliteDatabase {
175176
.await
176177
}
177178

178-
/// Get a reference to the connection pool for executing SELECT queries
179+
/// Get a reference to the connection pool for executing read queries
179180
///
180181
/// Use this for concurrent read operations. Multiple readers can access
181182
/// the pool simultaneously.
@@ -367,6 +368,7 @@ mod tests {
367368
.fetch_one(db.read_pool().unwrap())
368369
.await
369370
.unwrap();
371+
370372
assert_eq!(count, 12);
371373
}));
372374
}
@@ -673,6 +675,7 @@ mod tests {
673675
.fetch_all(db_clone.read_pool().unwrap())
674676
.await
675677
.unwrap();
678+
676679
assert!(rows.len() > 0);
677680
}));
678681
}
@@ -700,6 +703,7 @@ mod tests {
700703
.fetch_one(db.read_pool().unwrap())
701704
.await
702705
.unwrap();
706+
703707
assert_eq!(count.0, 2);
704708

705709
db.remove().await.unwrap();

crates/sqlx-sqlite-conn-mgr/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
//! - Uses sqlx's `SqlitePoolOptions` for all pool configuration
5757
//! - Uses sqlx's `SqliteConnectOptions` for connection flags and configuration
5858
//! - Minimal custom logic - delegates to sqlx wherever possible
59-
//! - Global registry caches new database instances (with their pools) and returns existing ones
59+
//! - Global registry caches new database instances and returns existing ones
6060
//! - WAL mode is enabled lazily only when writes are needed
6161
//!
6262
mod config;

0 commit comments

Comments
 (0)