package common import ( "log" "github.com/jinzhu/gorm" // This is line from GORM documentation that imports database dialect _ "github.com/jinzhu/gorm/dialects/sqlite" ) var db *gorm.DB func init() { var err error db, err = gorm.Open("sqlite3", "/var/lib/node-api/rosti.db") if err != nil { log.Fatalln(err) } } // GetDBConnection returns opened connection to the database func GetDBConnection() *gorm.DB { return db }