mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-04 06:54:45 +08:00
优化数据与日志模块
This commit is contained in:
@@ -9,10 +9,13 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/duanhf2012/origin/service"
|
||||
)
|
||||
|
||||
// DBModule ...
|
||||
type DBModule struct {
|
||||
service.BaseModule
|
||||
db *sql.DB
|
||||
URL string
|
||||
UserName string
|
||||
@@ -31,6 +34,11 @@ type DBResult struct {
|
||||
blur bool
|
||||
}
|
||||
|
||||
//OnInit ...
|
||||
func (slf *DBModule) Init() {
|
||||
slf.Connect(100)
|
||||
}
|
||||
|
||||
// Next ...
|
||||
func (slf *DBResult) Next() bool {
|
||||
if slf.Err != nil {
|
||||
|
||||
@@ -50,7 +50,7 @@ func (slf *LogModule) CheckAndGenFile() {
|
||||
var err error
|
||||
slf.logFile, err = os.Create(slf.GetCurrentFileName())
|
||||
if err != nil {
|
||||
fmt.Print("create log file %s error!", slf.GetCurrentFileName())
|
||||
fmt.Printf("create log file %+v error!", slf.GetCurrentFileName())
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user