Skip to content

Instantly share code, notes, and snippets.

@Cibernomadas Cibernomadas/database.go
Last active Jun 5, 2018

Embed
What would you like to do?
package database
import (
"log"
"github.com/cibernomadas/goblog/webapp/models"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/sqlite"
)
var DB *gorm.DB
func Init() *gorm.DB {
db, err := gorm.Open("sqlite3", "./data/goblog.db")
if err != nil {
log.Fatal(err)
}
db.AutoMigrate(&models.User{})
return db
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.