© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
Application-defined functions/UDF in LibSQL - Drizzle Team
DT
Drizzle Team
•
3y ago
•
2 replies
brynthrax
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
better-sqlite3/docs/api.md at master · WiseLibs/better-sqlite3
The fastest and simplest library for SQLite3 in Node
.js
.
- WiseLibs
/better
-sqlite3
Drizzle Team
Join
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,959
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Recent Announcements
Similar Threads
Migrations with User-Defined Functions
DT
Drizzle Team / help
15mo ago
Deno + libSQL
DT
Drizzle Team / help
12mo ago
libsql + Neutralinojs
DT
Drizzle Team / help
15mo ago
Libsql mapHranaError
DT
Drizzle Team / help
3y ago