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 config := GetConfig() db, err = gorm.Open("sqlite3", config.DatabasePath) if err != nil { log.Fatalln(err) } } // GetDBConnection returns opened connection to the database func GetDBConnection() *gorm.DB { return db }