From 34adb3a7e676a43cd692b4da14398a7d1b0be822 Mon Sep 17 00:00:00 2001 From: Andinus Date: Wed, 8 Apr 2020 01:44:15 +0530 Subject: Prepare for next rewrite --- storage/storage.go | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 storage/storage.go (limited to 'storage/storage.go') diff --git a/storage/storage.go b/storage/storage.go deleted file mode 100644 index 9aa1a57..0000000 --- a/storage/storage.go +++ /dev/null @@ -1,44 +0,0 @@ -package storage - -import ( - "database/sql" - "fmt" - "log" - "sync" -) - -// DB holds the database connection, mutex & path. -type DB struct { - Path string - Mu *sync.RWMutex - Conn *sql.DB -} - -// Init initializes the database. -func Init() *DB { - db := DB{ - Mu: new(sync.RWMutex), - } - - initDB(&db) - return &db -} - -// InitConn initializes database connection. -func InitConn() *DB { - var err error - db := DB{ - Mu: new(sync.RWMutex), - } - - db.Path = fmt.Sprintf("%s/grus.db", GetDir()) - - db.Conn, err = sql.Open("sqlite3", db.Path) - if err != nil { - log.Printf("storage/init.go: %s\n", - "Failed to open database connection") - initErr(&db, err) - } - - return &db -} -- cgit 1.4.1-2-gfad0