add scraping the torrent topics rss files

This commit is contained in:
2024-09-09 08:54:29 +03:00
parent 20c4f25c55
commit e587e645fc
26 changed files with 714 additions and 22 deletions

24
internal/db/connector.go Normal file
View File

@@ -0,0 +1,24 @@
package db
import (
"github.com/jmoiron/sqlx"
"github.com/spf13/viper"
)
func New() *sqlx.DB {
drv := viper.GetString("db.driver")
dsn := viper.GetString("db.data_source_name")
db, err := sqlx.Connect(drv, dsn)
if err != nil {
panic("Failed to connect to the database: " + err.Error())
}
// Verify the connection to the database is still alive
err = db.Ping()
if err != nil {
panic("Failed to ping the database: " + err.Error())
}
return db
}