Skip to content

Commit

Permalink
General Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
alvanrahimli committed Aug 15, 2021
1 parent 4491f25 commit 75fda8d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
18 changes: 13 additions & 5 deletions database.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
package main

func InitializeDb() {
//setupCommand := `
// CREATE DATABASE DotsDb;
// CREATE TABLE
//`
import (
"database/sql"
"log"
"os"
)

func getDbInstance() *sql.DB {
db, dbErr := sql.Open("sqlite3", os.Getenv("DB_PATH"))
if dbErr != nil {
log.Fatal(dbErr)
}

return db
}
10 changes: 0 additions & 10 deletions server.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"database/sql"
"fmt"
"github.com/gorilla/mux"
_ "github.com/mattn/go-sqlite3"
Expand Down Expand Up @@ -47,12 +46,3 @@ func main() {
log.Fatal(err)
}
}

func getDbInstance() *sql.DB {
db, dbErr := sql.Open("sqlite3", os.Getenv("DB_PATH"))
if dbErr != nil {
log.Fatal(dbErr)
}

return db
}

0 comments on commit 75fda8d

Please sign in to comment.