diff --git a/gorm.go b/gorm.go index e5c4a8a4..affa8e69 100644 --- a/gorm.go +++ b/gorm.go @@ -117,6 +117,7 @@ func Open(dialector Dialector, config *Config) (db *DB, err error) { preparedStmt := &PreparedStmtDB{ ConnPool: db.ConnPool, Stmts: map[string]*sql.Stmt{}, + Mux: &sync.RWMutex{}, PreparedSQL: make([]string, 0, 100), } db.cacheStore.Store("preparedStmt", preparedStmt) diff --git a/prepare_stmt.go b/prepare_stmt.go index 14a6aaec..eddee1f2 100644 --- a/prepare_stmt.go +++ b/prepare_stmt.go @@ -9,7 +9,7 @@ import ( type PreparedStmtDB struct { Stmts map[string]*sql.Stmt PreparedSQL []string - Mux sync.RWMutex + Mux *sync.RWMutex ConnPool }