-
Hi, My expertise: beginner - intermediate. In my local env, I simply replaced "github.com/mattn/go-sqlite3" with "github.com/ncruces/go-sqlite3" and things just worked well without any issues. Awesome job! Question though, does "github.com/ncruces/go-sqlite3" support custom functions yet? For example, I wasn't able to execute the following snippet which seems to work with "github.com/mattn/go-sqlite3"
I skimmed around the package and the closest was able to get to was sqlite_test.go. What is the current workaround to implement SQLite custom functions? Does it involve using gorm? Also please give some pointers to CONTRIBUTE for starters. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
SQLite does not support stored procedures ( You can create custom functions in Go (not in PL/SQL). There are a bunch of examples in the repo, like this one: Lines 80 to 82 in e2da469 This function receives a single SQLite documentation for this is here: https://sqlite.org/appfunc.html |
Beta Was this translation helpful? Give feedback.
-
Thanks for the clarification. I didn't know custom function was reserved for go. SQLite is new to me as well. That code snippet was generated by AI. I didn't test its functionality with |
Beta Was this translation helpful? Give feedback.
SQLite does not support stored procedures (
CREATE FUNCTION
) so I'm not sure what you mean when you saymattn
supports it.You can create custom functions in Go (not in PL/SQL).
There are a bunch of examples in the repo, like this one:
go-sqlite3/func_test.go
Lines 80 to 82 in e2da469
This function receives a single
TEXT
argument, uppercases it withbytes.ToUpper
, and returns it.SQLite documentation for this is here: https://sqlite.org/appfunc.html