How use in electron + better-sqlite3 #424
-
Hello everyone, first of all, thank you for developing this cool application. I really want to use it in my own project, https://meogic.com. It is a project with a tech stack that uses electron as the client tool, knex for SQL encapsulation and migration, and objectionjs for ORM. I tried reading the official documentation at https://vlcn.io/docs/cr-sqlite/js/nodejs, then looked at https://vlcn.io/docs/cr-sqlite/js/reactivity, which led me to the following code: import SQLiteDB from 'better-sqlite3'
import { extensionPath } from "@vlcn.io/crsqlite";
const db = new SQLiteDB(pathToDb)
db.loadExtension(extensionPath)
const rx = tblrx(db)
const disposable = rx.onRange(["posts"], (updateTypes) => {
console.log("posts changed", updateTypes);
}); Then I got an error,
I have no idea how to handle it, please help me. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Thanks for reporting. We could craft a subscription implementation that uses triggers (as suggested here: WiseLibs/better-sqlite3#62) or expose the update_hook in better-sqlite3 and hope they take the PR. |
Beta Was this translation helpful? Give feedback.
Thanks for reporting.
better-sqlite3
doesn't expose the sqlite update hook :(We could craft a subscription implementation that uses triggers (as suggested here: WiseLibs/better-sqlite3#62) or expose the update_hook in better-sqlite3 and hope they take the PR.