DatabaseConfig

Struct DatabaseConfig 

Source
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

Source

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

Source§

fn clone(&self) -> DatabaseConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DatabaseConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DatabaseConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for DatabaseConfig

Source§

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 DatabaseConfig
where Self: DeserializeOwned,

Source§

type Abi = <JsType as FromWasmAbi>::Abi

The Wasm ABI type that this converts from when coming back out from the ABI boundary.
Source§

unsafe fn from_abi(js: Self::Abi) -> Self

Recover a Self from Self::Abi. Read more
Source§

impl IntoWasmAbi for DatabaseConfig
where Self: Serialize,

Source§

type Abi = <JsType as IntoWasmAbi>::Abi

The Wasm ABI type that this converts into when crossing the ABI boundary.
Source§

fn into_abi(self) -> Self::Abi

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
Source§

impl OptionFromWasmAbi for DatabaseConfig
where Self: DeserializeOwned,

Source§

fn is_none(js: &Self::Abi) -> bool

Tests whether the argument is a “none” instance. If so it will be deserialized as None, and otherwise it will be passed to FromWasmAbi.
Source§

impl OptionIntoWasmAbi for DatabaseConfig
where Self: Serialize,

Source§

fn none() -> Self::Abi

Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more
Source§

impl Serialize for DatabaseConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Tsify for DatabaseConfig

Source§

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}"

Source§

type JsType = JsType

Source§

fn into_js(&self) -> Result<Self::JsType, Error>
where Self: Serialize,

Source§

fn from_js<T>(js: T) -> Result<Self, Error>
where T: Into<JsValue>, Self: DeserializeOwned,

Source§

impl WasmDescribe for DatabaseConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ReturnWasmAbi for T
where T: IntoWasmAbi,

Source§

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi
Source§

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.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,