summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-06-06 18:04:09 -0400
committerBen Morrison <ben@gbmor.dev>2019-06-08 02:29:21 -0400
commit5fa9ec1b63acc6ac9dc0a8b5d2f8f044c27ea45e (patch)
treedb8be704869171895bf1702cb8504e1f08717a99
parente9d4a6b0e8624c6425d467f0efe14be1bc683bd9 (diff)
downloadgetwtxt-5fa9ec1b63acc6ac9dc0a8b5d2f8f044c27ea45e.tar.gz
working on adding sqlite
-rw-r--r--svc/db.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/svc/db.go b/svc/db.go
index e0c2690..f5e8678 100644
--- a/svc/db.go
+++ b/svc/db.go
@@ -8,6 +8,7 @@ import (
 	"time"
 
 	"github.com/getwtxt/registry"
+	_ "github.com/mattn/go-sqlite3"
 	"github.com/syndtr/goleveldb/leveldb"
 )
 
@@ -43,6 +44,12 @@ func initDatabase() {
 
 	case "sqlite":
 		var lite *sql.DB
+		lite, err := sql.Open("sqlite3", confObj.DBPath)
+		errFatal(err)
+		litePrep, err := lite.Prepare("CREATE TABLE IF NOT EXISTS getwtxt (urlKey TEXT PRIMARY KEY, isUser BOOL, blobKey TEXT, data BLOB)")
+		errFatal(err)
+		_, err = litePrep.Exec()
+		errFatal(err)
 		db = &dbSqlite{db: lite}
 
 	case "postgres":