forked from mirror/gorm
Update CONTRIBUTING.md executable script template
Change `db` to type `*gorm.DB` to reflect latest version of gorm. Remove re-declarations of `db, err`
This commit is contained in:
parent
041cd3dd31
commit
79a91d7548
|
@ -27,26 +27,26 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "github.com/mattn/go-sqlite3"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
_ "github.com/go-sql-driver/mysql"
|
"github.com/jinzhu/gorm"
|
||||||
_ "github.com/lib/pq"
|
_ "github.com/lib/pq"
|
||||||
"github.com/jinzhu/gorm"
|
_ "github.com/mattn/go-sqlite3"
|
||||||
)
|
)
|
||||||
|
|
||||||
var db gorm.DB
|
var db *gorm.DB
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
var err error
|
var err error
|
||||||
db, err = gorm.Open("sqlite3", "test.db")
|
db, err = gorm.Open("sqlite3", "test.db")
|
||||||
// db, err := gorm.Open("postgres", "user=username dbname=password sslmode=disable")
|
// db, err = gorm.Open("postgres", "user=username dbname=password sslmode=disable")
|
||||||
// db, err := gorm.Open("mysql", "user:password@/dbname?charset=utf8&parseTime=True")
|
// db, err = gorm.Open("mysql", "user:password@/dbname?charset=utf8&parseTime=True")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
db.LogMode(true)
|
db.LogMode(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Your code
|
// Your code
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue