diff --git a/sqlx-sqlite/src/options/mod.rs b/sqlx-sqlite/src/options/mod.rs index b0093f3d45..d3ed8b9f36 100644 --- a/sqlx-sqlite/src/options/mod.rs +++ b/sqlx-sqlite/src/options/mod.rs @@ -210,6 +210,10 @@ impl SqliteConnectOptions { } /// Sets the name of the database file. + /// + /// This is a low-level API, and SQLx will apply no special treatment for `":memory:"` as an + /// in-memory database using this method. Using [SqliteConnectOptions::from_str] may be + /// preferred for simple use cases. pub fn filename(mut self, filename: impl AsRef) -> Self { self.filename = Cow::Owned(filename.as_ref().to_owned()); self @@ -228,6 +232,14 @@ impl SqliteConnectOptions { self.pragma("foreign_keys", if on { "ON" } else { "OFF" }) } + /// Set the [`SQLITE_OPEN_MEMORY` flag](https://sqlite.org/c3ref/open.html). + /// + /// By default, this is disabled. + pub fn in_memory(mut self, in_memory: bool) -> Self { + self.in_memory = in_memory; + self + } + /// Set the [`SQLITE_OPEN_SHAREDCACHE` flag](https://sqlite.org/sharedcache.html). /// /// By default, this is disabled.