<commit_before>package helpers

import (
	"taap_project/models"

	"database/sql"
	"github.com/go-gorp/gorp"
	_ "github.com/go-sql-driver/mysql"
	"net/http"
)

var db *sql.DB
var dbmap *gorp.DbMap

func InitDatabase() {
	db, _ = sql.Open("mysql", "root:#54nFr4nc15c0@/taap")
	dbmap = &gorp.DbMap{Db: db, Dialect: gorp.MySQLDialect{}}

	dbmap.AddTable(models.Drill{}).SetKeys(false, "Title")
}

func VerifyMySQLConnection(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
	db, _ = sql.Open("mysql", "root:#54nFr4nc15c0@/taap")
	if err := db.Ping(); err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
	}
	next(w, r)
}
<commit_msg>added getDatabase method to the helper database class<commit_after>package helpers

import (
	"taap_project/models"

	"database/sql"
	"github.com/go-gorp/gorp"
	_ "github.com/go-sql-driver/mysql"
	"net/http"
)

var db *sql.DB
var dbmap *gorp.DbMap

func getDatabase() *sql.DB {
	return db
}

func InitDatabase() {
	db, _ = sql.Open("mysql", "root:#54nFr4nc15c0@/taap")
	dbmap = &gorp.DbMap{Db: db, Dialect: gorp.MySQLDialect{}}

	dbmap.AddTable(models.Drill{}).SetKeys(false, "Title")
}

func VerifyMySQLConnection(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
	db, _ = sql.Open("mysql", "root:#54n<PASSWORD>nc15c0@/taap")
	if err := db.Ping(); err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
	}
	next(w, r)
}

{'fraction_non_alphanumeric': 0.17183098591549295, 'fraction_numerical': 0.01619718309859155, 'mean_word_length': 4.871900826446281, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2314471', 'n_tokens_mistral': 608, 'n_tokens_neox': 591, 'n_words': 104}