sdk/hints: sqlite backend and tests.

This commit is contained in:
fiatjaf
2024-09-16 22:23:55 -03:00
parent 4c9ab850a5
commit 2c09338ecb
11 changed files with 380 additions and 34 deletions
+28
View File
@@ -0,0 +1,28 @@
//go:build !sqlite_math_functions
package test
import (
"os"
"testing"
"github.com/jmoiron/sqlx"
"github.com/nbd-wtf/go-nostr/sdk/hints/sqlite"
"github.com/stretchr/testify/require"
_ "github.com/tursodatabase/go-libsql"
)
func TestSQLiteHintsLibsql(t *testing.T) {
path := "/tmp/tmpsdkhintssqlite"
os.RemoveAll(path)
db, err := sqlx.Connect("libsql", "file://"+path)
require.NoError(t, err, "failed to create sqlitehints db")
db.SetMaxOpenConns(1)
sh, err := sqlite.NewSQLiteHints(db)
require.NoError(t, err, "failed to setup sqlitehints db")
runTestWith(t, sh)
}