Last active
June 21, 2018 15:22
-
-
Save mohashari/0accd7221baa223b8c88aa57dba6a0ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "github.com/jinzhu/gorm" | |
| "github.com/gin-gonic/gin" | |
| _ "github.com/jinzhu/gorm/dialects/mysql" | |
| "net/http" | |
| ) | |
| var db *gorm.DB | |
| func init() { | |
| var err error | |
| db, err = | |
| gorm.Open("mysql", "root:welcome1@tcp(127.0.0.1:3306)/golang?charset=utf8&parseTime=True&loc=Local") | |
| if err != nil { | |
| panic("Gagal Conect Ke Database") | |
| } | |
| db.AutoMigrate(&student{}) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment