mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-05 17:24:21 +01:00
bind/js: Close Database connection when it is garbage collected
This commit is contained in:
@@ -34,6 +34,14 @@ pub struct Database {
|
||||
conn: Rc<limbo_core::Connection>,
|
||||
}
|
||||
|
||||
impl ObjectFinalize for Database {
|
||||
// TODO: check if something more is required
|
||||
fn finalize(self, _env: Env) -> napi::Result<()> {
|
||||
self.conn.close().map_err(into_napi_error)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[napi]
|
||||
impl Database {
|
||||
#[napi(constructor)]
|
||||
|
||||
Reference in New Issue
Block a user