diff options
author | Thomas Voss <mail@thomasvoss.com> | 2025-08-07 12:56:57 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2025-08-07 12:59:43 +0200 |
commit | c442ce5ea604731991a71baae08b6d6fa03b9e35 (patch) | |
tree | 7ef84ca8fe2531ffdf3283916484bd0aa6f8e1da /src/dbx/db.go | |
parent | 8172618ca902f71688702d720c4f5a3b31af5866 (diff) |
Support C_() in SQL scripts
Diffstat (limited to 'src/dbx/db.go')
-rw-r--r-- | src/dbx/db.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/dbx/db.go b/src/dbx/db.go index b839531..5ee3782 100644 --- a/src/dbx/db.go +++ b/src/dbx/db.go @@ -1,6 +1,7 @@ package dbx import ( + "context" "fmt" "io/fs" "log" @@ -20,6 +21,16 @@ var ( func Init(sqlDir fs.FS) { db = sqlx.MustConnect("sqlite3", DBName) atexit.Register(Close) + + conn := Try2(db.Conn(context.Background())) + Try(conn.Raw(func(driverConn any) error { + return driverConn.(*sqlite3.SQLiteConn).RegisterFunc("C_", + func(s, _ string) string { + return s + }, true) + })) + conn.Close() + Try(applyMigrations(sqlDir)) /* TODO: Remove debug code */ |