kvdb: add sqlite

This commit is contained in:
Elle Mouton
2022-12-15 18:13:13 +02:00
parent 3d91bb65f7
commit 74b9c9ce9a
16 changed files with 374 additions and 10 deletions

25
kvdb/kvdb_no_sqlite.go Normal file
View File

@ -0,0 +1,25 @@
//go:build !kvdb_sqlite || (windows && (arm || 386)) || (linux && (ppc64 || mips || mipsle || mips64))
package kvdb
import (
"fmt"
"runtime"
"github.com/btcsuite/btcwallet/walletdb"
)
var errSqliteNotAvailable = fmt.Errorf("sqlite backend not available either "+
"due to the `kvdb_sqlite` build tag not being set, or due to this "+
"OS(%s) and/or architecture(%s) not being supported", runtime.GOOS,
runtime.GOARCH)
// SqliteBackend is conditionally set to false when the kvdb_sqlite build tag is
// not defined. This will allow testing of other database backends.
const SqliteBackend = false
// StartSqliteTestBackend is a stub returning nil, and errSqliteNotAvailable
// error.
func StartSqliteTestBackend(path, name, table string) (walletdb.DB, error) {
return nil, errSqliteNotAvailable
}