panic when initializing already initialized database

This commit is contained in:
Timon Ringwald 2022-08-04 09:37:01 +02:00
parent 6d24df4153
commit 3f8e334dbb

4
db.go
View File

@ -15,6 +15,10 @@ type Database struct {
func InitDatabase(database *Database, conn *sql.DB) {
panicOnNil(database)
if database.db != nil {
panic("database is initialized already")
}
*database = Database{
db: conn,
stmts: map[string]*sql.Stmt{},