mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
bind/js: Close Database connection when it is garbage collected
This commit is contained in:
parent
787de5e2b3
commit
f0a08612b0
1 changed files with 8 additions and 0 deletions
|
@ -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)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue