From 3f8e334dbbe23e88b66cd60175423e8744f38729 Mon Sep 17 00:00:00 2001 From: Timon Ringwald Date: Thu, 4 Aug 2022 09:37:01 +0200 Subject: [PATCH] panic when initializing already initialized database --- db.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/db.go b/db.go index 7d8bfb5..f931e15 100644 --- a/db.go +++ b/db.go @@ -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{},