func makeConnection(db *mysql.DB) error { if db == nil { return fmt.Errorf("Can not make connection to database because of db is nil") } err := db.Ping() //TODO: retry if err != nil { log.Errorf("makeConnection error msg:%s", err.Error()) } return err }
func setDBProperty(db *mysql.DB, nodeCfg *config.NodeConfig) { db.SetMaxOpenConns(nodeCfg.MaxConnections) db.SetMaxIdleConns(nodeCfg.MaxConnectionPoolSize) db.SetDbAliveStatus(true) }