gophertype/pkg/models/models.go
2019-11-14 19:03:56 -08:00

13 lines
215 B
Go

package models
import "github.com/jinzhu/gorm"
// DB is the database handle for all the models.
var DB *gorm.DB
// UseDB registers a database driver.
func UseDB(db *gorm.DB) {
DB = db
DB.AutoMigrate(&User{})
}