pub struct DatabaseConfig {
pub name: String,
pub version: Option<u32>,
pub cache_size: Option<usize>,
pub page_size: Option<usize>,
pub auto_vacuum: Option<bool>,
pub journal_mode: Option<String>,
pub max_export_size_bytes: Option<u64>,
}Fields§
§name: String§version: Option<u32>§cache_size: Option<usize>§page_size: Option<usize>§auto_vacuum: Option<bool>§journal_mode: Option<String>Journal mode for SQLite transactions
Options:
- “MEMORY” (default): Fast in-memory journaling, optimal browser performance
- “WAL”: Write-Ahead Logging with full shared memory support.
Set
journal_mode: Some("WAL".to_string())to enable. Note: WAL has overhead in concurrent operations but provides better crash recovery and allows concurrent reads. - “DELETE”: Traditional rollback journal
Example enabling WAL:
use absurder_sql::DatabaseConfig;
let config = DatabaseConfig {
name: "mydb".to_string(),
journal_mode: Some("WAL".to_string()),
..Default::default()
};max_export_size_bytes: Option<u64>Maximum database size for export operations (in bytes). Default: 2GB (2_147_483_648 bytes) Rationale: Balances IndexedDB capacity (10GB+) with browser memory limits (~2-4GB/tab) Set to None for no limit (not recommended - may cause OOM errors)
Implementations§
Source§impl DatabaseConfig
impl DatabaseConfig
Sourcepub fn mobile_optimized(name: impl Into<String>) -> Self
pub fn mobile_optimized(name: impl Into<String>) -> Self
Create mobile-optimized database configuration
Optimizations:
- WAL mode: Better concurrency, crash recovery, and write performance
- Larger cache: 20K pages (~80MB with 4KB pages) for better read performance
- 4KB pages: Optimal for mobile storage
- Auto vacuum: Keeps database size manageable
Use this for React Native, Flutter, or other mobile applications.
§Examples
use absurder_sql::types::DatabaseConfig;
let config = DatabaseConfig::mobile_optimized("myapp.db");
assert_eq!(config.journal_mode, Some("WAL".to_string()));Trait Implementations§
Source§impl Clone for DatabaseConfig
impl Clone for DatabaseConfig
Source§fn clone(&self) -> DatabaseConfig
fn clone(&self) -> DatabaseConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DatabaseConfig
impl Debug for DatabaseConfig
Source§impl Default for DatabaseConfig
impl Default for DatabaseConfig
Source§impl<'de> Deserialize<'de> for DatabaseConfig
impl<'de> Deserialize<'de> for DatabaseConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl FromWasmAbi for DatabaseConfigwhere
Self: DeserializeOwned,
impl FromWasmAbi for DatabaseConfigwhere
Self: DeserializeOwned,
Source§impl IntoWasmAbi for DatabaseConfigwhere
Self: Serialize,
impl IntoWasmAbi for DatabaseConfigwhere
Self: Serialize,
Source§impl OptionFromWasmAbi for DatabaseConfigwhere
Self: DeserializeOwned,
impl OptionFromWasmAbi for DatabaseConfigwhere
Self: DeserializeOwned,
Source§impl OptionIntoWasmAbi for DatabaseConfigwhere
Self: Serialize,
impl OptionIntoWasmAbi for DatabaseConfigwhere
Self: Serialize,
Source§impl Serialize for DatabaseConfig
impl Serialize for DatabaseConfig
Source§impl Tsify for DatabaseConfig
impl Tsify for DatabaseConfig
const DECL: &'static str = "export interface DatabaseConfig {\n name: string;\n version: number | null;\n cache_size: number | null;\n page_size: number | null;\n auto_vacuum: boolean | null;\n journal_mode: string | null;\n max_export_size_bytes: number | null;\n}"
type JsType = JsType
fn into_js(&self) -> Result<Self::JsType, Error>where
Self: Serialize,
fn from_js<T>(js: T) -> Result<Self, Error>
Auto Trait Implementations§
impl Freeze for DatabaseConfig
impl RefUnwindSafe for DatabaseConfig
impl Send for DatabaseConfig
impl Sync for DatabaseConfig
impl Unpin for DatabaseConfig
impl UnwindSafe for DatabaseConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.