gophertype/pkg/models/models.go

14 lines
246 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(&AppSetting{})
DB.AutoMigrate(&User{})
}