mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-12-02 00:46:51 +01:00
sdk/hints: adapt sqlite to also support postgres.
This commit is contained in:
@@ -3,11 +3,11 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/jmoiron/sqlx"
|
||||
"github.com/nbd-wtf/go-nostr/sdk/hints/sqlite"
|
||||
"github.com/nbd-wtf/go-nostr/sdk/hints/sqlh"
|
||||
"github.com/stretchr/testify/require"
|
||||
_ "github.com/tursodatabase/go-libsql"
|
||||
)
|
||||
@@ -16,12 +16,12 @@ func TestSQLiteHintsLibsql(t *testing.T) {
|
||||
path := "/tmp/tmpsdkhintssqlite"
|
||||
os.RemoveAll(path)
|
||||
|
||||
db, err := sqlx.Connect("libsql", "file://"+path)
|
||||
db, err := sql.Open("libsql", "file://"+path)
|
||||
|
||||
require.NoError(t, err, "failed to create sqlitehints db")
|
||||
db.SetMaxOpenConns(1)
|
||||
|
||||
sh, err := sqlite.NewSQLiteHints(db)
|
||||
sh, err := sqlh.NewSQLHints(db, "sqlite3")
|
||||
require.NoError(t, err, "failed to setup sqlitehints db")
|
||||
|
||||
runTestWith(t, sh)
|
||||
|
||||
Reference in New Issue
Block a user