sqlite3.go引入条件编译
This commit is contained in:
1 parent
f2829bfd98
commit
26b29f801c
4 files changed
+24
-3
No files matched your search
+2
-3
@@ -5,7 +5,6 @@ import (
|
||||
"fmt"
|
||||
_ "github.com/go-sql-driver/mysql" //加载mysql
|
||||
"github.com/jinzhu/gorm"
|
||||
_ "github.com/jinzhu/gorm/dialects/sqlite"
|
||||
config2 "go-admin/config"
|
||||
"log"
|
||||
"strconv"
|
||||
@@ -58,9 +57,9 @@ func init() {
|
||||
|
||||
Eloquent.LogMode(true)
|
||||
if err != nil {
|
||||
log.Fatalln("%s connect error %v",dbType, err)
|
||||
log.Fatalln("%s connect error %v", dbType, err)
|
||||
} else {
|
||||
log.Println("%s connect success!",dbType)
|
||||
log.Println("%s connect success!", dbType)
|
||||
}
|
||||
|
||||
if Eloquent.Error != nil {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// +build sqlite3
|
||||
|
||||
package database
|
||||
|
||||
import (
|
||||
_ "github.com/jinzhu/gorm/dialects/sqlite"
|
||||
)
|
||||
Reference in new issue
Block a user