initial commit on github

This commit is contained in:
2021-05-02 16:04:45 +03:00
commit 7babade475
37 changed files with 3271 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
package v1
import (
"fmt"
"github.com/getsentry/sentry-go"
"github.com/jmoiron/sqlx"
_ "github.com/lib/pq"
"log"
)
var database *sqlx.DB
func ConnectToDB() {
var err error
conf := privateConfig.Database
url := fmt.Sprintf("host=%s port=5432 user=%s password=%s dbname=%s", conf.URL, conf.User, conf.Password, conf.Name)
database, err = sqlx.Open("postgres", url)
if err != nil {
sentry.CaptureException(err)
log.Fatalln(err)
}
log.Printf("Connected to DB with name %v as %v on %v\n", conf.Name, conf.User, conf.URL)
}