Application-defined functions/UDF in LibSQL

Is there a way to define JS functions within libsql's sqlite database just like in better-sqlite? (see ref below)

db.function('add2', (a, b) => a + b);

db.prepare('SELECT add2(?, ?)').pluck().get(12, 4); // => 16
db.prepare('SELECT add2(?, ?)').pluck().get('foo', 'bar'); // => "foobar"
db.prepare('SELECT add2(?, ?, ?)').pluck().get(12, 4, 18); // => Error: wrong number of arguments

https://github.com/WiseLibs/better-sqlite3/blob/master/docs/api.md#functionname-options-function---this
GitHub
The fastest and simplest library for SQLite3 in Node.js. - WiseLibs/better-sqlite3
Was this page helpful?