package models import ( "time" "github.com/jinzhu/gorm" ) // DB is the database handle for all the models. var DB *gorm.DB // BaseModel is the base column set for all models. type BaseModel struct { ID int `gorm:"primary_key"` CreatedAt time.Time UpdatedAt time.Time } // UseDB registers a database driver. func UseDB(db *gorm.DB) { DB = db DB.AutoMigrate(&User{}, &Post{}, &TaggedPost{}, &Comment{}, &Question{}) }