panic when initializing already initialized database
This commit is contained in:
parent
6d24df4153
commit
3f8e334dbb
4
db.go
4
db.go
@ -15,6 +15,10 @@ type Database struct {
|
|||||||
func InitDatabase(database *Database, conn *sql.DB) {
|
func InitDatabase(database *Database, conn *sql.DB) {
|
||||||
panicOnNil(database)
|
panicOnNil(database)
|
||||||
|
|
||||||
|
if database.db != nil {
|
||||||
|
panic("database is initialized already")
|
||||||
|
}
|
||||||
|
|
||||||
*database = Database{
|
*database = Database{
|
||||||
db: conn,
|
db: conn,
|
||||||
stmts: map[string]*sql.Stmt{},
|
stmts: map[string]*sql.Stmt{},
|
||||||
|
Loading…
Reference in New Issue
Block a user