wasm32-unknown-unknown bindings to the libsqlite3 library
https://noz.cx/blog/sqlite-wasm-rs โ โ 51
HEALTH 94 / Healthy
// momentum
// why it's here
- Active: last commit today
- Health 94/100 with only 97 stars
// how to help
// readme
wasm32-unknown-unknown bindings to the libsqlite3 library. Try it in the playground.
Usage
[dependencies]
sqlite-wasm-rs = { version = "0.6", features = ["wasm-bindgen"] }
[dependencies]
# Encryption is supported by SQLite3MultipleCiphers
# See <https://utelle.github.io/SQLite3MultipleCiphers>
sqlite-wasm-rs = { version = "0.6", features = ["wasm-bindgen", "sqlite3mc"] }
[dependencies]
# Encryption is supported by SQLCipher
# See <https://www.zetetic.net/sqlcipher/>
sqlite-wasm-rs = { version = "0.6", features = ["wasm-bindgen", "sqlcipher"] }
use sqlite_wasm_rs as ffi;
fn open_db() {
// open with memory vfs
let mut db = std::ptr::null_mut();
let ret = unsafe {
ffi::sqlite3_open_v2(
c"mem.db".as_ptr().cast(),
&mut db as *mut _,
ffi::SQLITE_OPEN_READWRITE | ffi::SQLITE_OPEN_CREATE,
std::ptr::null()
)
};
assert_eq!(ffi::SQLITE_OK, ret);
assert_eq!(unsafe { ffi::sqlite3_close(db) }, ffi::SQLITE_OK);
}
About VFS
[dependencies]
sqlite-wasm-vfs = { version = "0.3", features = ["sahpool"] }