for test
This commit is contained in:
parent
1685ff59ff
commit
5f27051688
6
logdb.go
6
logdb.go
|
@ -40,6 +40,11 @@ func NewLogDB(filename string) *LogDB {
|
|||
return &logdb
|
||||
}
|
||||
|
||||
// Ping 是否Ping通数据库
|
||||
func (logdb *LogDB) Ping() error {
|
||||
return logdb.driver.Ping()
|
||||
}
|
||||
|
||||
// Connect 重连
|
||||
func (logdb *LogDB) Connect() {
|
||||
defer func() {
|
||||
|
@ -67,5 +72,6 @@ func (logdb *LogDB) Connect() {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
db.Ping()
|
||||
logdb.driver = db
|
||||
}
|
||||
|
|
|
@ -14,7 +14,8 @@ import (
|
|||
// user: spider
|
||||
|
||||
func TestSelect(t *testing.T) {
|
||||
|
||||
logdb := NewLogDB("logdb.yaml")
|
||||
t.Error(logdb)
|
||||
logdb.Connect()
|
||||
t.Error(logdb)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user