Add auth, rest api, svelte frontend, build structure
This commit is contained in:
@@ -3,6 +3,7 @@ package repository
|
||||
import (
|
||||
"database/sql"
|
||||
"log/slog"
|
||||
"os"
|
||||
"sync"
|
||||
)
|
||||
|
||||
@@ -21,6 +22,11 @@ func Connect(dsnURI string) {
|
||||
}
|
||||
|
||||
repo = New(dbConn)
|
||||
err = checkDBVersion(dbConn)
|
||||
if err != nil {
|
||||
slog.Error("DB Connection: Failed DB version check", "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -32,10 +38,11 @@ func GetConnection() (*sql.DB, error) {
|
||||
return dbConn, nil
|
||||
}
|
||||
|
||||
func GetRepository() (*Queries, error) {
|
||||
func GetRepository() *Queries {
|
||||
if repo == nil {
|
||||
slog.Error("Database connection not initialized!")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
return repo, nil
|
||||
return repo
|
||||
}
|
||||
|
Reference in New Issue
Block a user