gophertype/pkg/models/models.go

15 lines
271 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{})
DB.AutoMigrate(&Post{})
DB.AutoMigrate(&TaggedPost{})
}