paddockpass/db/main.go
2020-02-04 20:19:25 +01:00

19 lines
285 B
Go

package db
import (
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/sqlite"
)
// InitDB load the database and the models
func InitDB() {
db, err := gorm.Open("sqlite3", "test.db")
if err != nil {
panic(err.Error())
}
defer db.Close()
db.AutoMigrate(&User{})
}