improve configuration for gdb; add more unit test case for ghttp.Server

This commit is contained in:
John
2019-10-15 21:20:38 +08:00
parent b26330aee1
commit e1164e935b
9 changed files with 119 additions and 64 deletions

View File

@ -344,9 +344,9 @@ func (bs *dbBase) getSqlDb(master bool) (sqlDb *sql.DB, err error) {
}
if bs.maxConnLifetime > 0 {
sqlDb.SetConnMaxLifetime(time.Duration(bs.maxConnLifetime) * time.Second)
sqlDb.SetConnMaxLifetime(bs.maxConnLifetime * time.Second)
} else if node.MaxConnLifetime > 0 {
sqlDb.SetConnMaxLifetime(time.Duration(node.MaxConnLifetime) * time.Second)
sqlDb.SetConnMaxLifetime(node.MaxConnLifetime * time.Second)
}
return sqlDb
}, 0)

View File

@ -543,9 +543,7 @@ func (bs *dbBase) doUpdate(link dbLink, table string, data interface{}, conditio
}
params := []interface{}(nil)
switch kind {
case reflect.Map:
fallthrough
case reflect.Struct:
case reflect.Map, reflect.Struct:
var fields []string
for k, v := range structToMap(data) {
fields = append(fields, bs.db.quoteWord(k)+"=?")