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