mirror of
https://github.com/tursodatabase/libsql.git
synced 2024-12-15 14:29:44 +00:00
954029e31f
This adds a new `Builder` type that can now be used to construct the `Database` type. This will scale better as we add more varied options. This commit also deprecates the old builder types and will produce a warning that will push users to using the new `Builder` type. This will then allow us to remove the old deprecated constructors at some point in the future.
30 lines
559 B
Rust
30 lines
559 B
Rust
use wasm_bindgen::prelude::*;
|
|
|
|
#[wasm_bindgen]
|
|
#[allow(unused)]
|
|
pub struct Database {
|
|
inner: libsql::Database,
|
|
}
|
|
|
|
#[wasm_bindgen]
|
|
impl Database {
|
|
#[wasm_bindgen(constructor)]
|
|
#[allow(deprecated)]
|
|
pub fn new() -> Database {
|
|
Database {
|
|
inner: libsql::Database::open(":memory:").unwrap(),
|
|
}
|
|
}
|
|
|
|
pub fn all(&self, _sql: String, f: &js_sys::Function) {
|
|
let this = JsValue::null();
|
|
let _ = f.call0(&this);
|
|
}
|
|
}
|
|
|
|
impl Default for Database {
|
|
fn default() -> Self {
|
|
Self::new()
|
|
}
|
|
}
|