style(cache): 格式化代码注释中的空格并添加 DISTINCT 选项
- 修复了缓存相关文件中注释开头缺少空格的问题 - 在 db/hotimedb.go 中为 vcond 数组添加了 "DISTINCT" 选项 - 注释掉了 session.go 中的并发控制代码以简化实现
This commit is contained in:
parent
5bb9ed77b8
commit
3455fb0a1c
@ -891,7 +891,7 @@ func (that *HoTimeDB) Count(table string, qu ...interface{}) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var condition = []string{"AND", "OR"}
|
var condition = []string{"AND", "OR"}
|
||||||
var vcond = []string{"GROUP", "ORDER", "LIMIT"}
|
var vcond = []string{"GROUP", "ORDER", "LIMIT", "DISTINCT"}
|
||||||
|
|
||||||
// Count 计数
|
// Count 计数
|
||||||
func (that *HoTimeDB) Sum(table string, column string, qu ...interface{}) float64 {
|
func (that *HoTimeDB) Sum(table string, column string, qu ...interface{}) float64 {
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package hotime
|
|||||||
import (
|
import (
|
||||||
. "code.hoteas.com/golang/hotime/cache"
|
. "code.hoteas.com/golang/hotime/cache"
|
||||||
. "code.hoteas.com/golang/hotime/common"
|
. "code.hoteas.com/golang/hotime/common"
|
||||||
|
//"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
// session对象
|
// session对象
|
||||||
@ -11,6 +12,7 @@ type SessionIns struct {
|
|||||||
SessionId string
|
SessionId string
|
||||||
Map
|
Map
|
||||||
ContextBase
|
ContextBase
|
||||||
|
//mutex sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
func (that *SessionIns) set() {
|
func (that *SessionIns) set() {
|
||||||
@ -25,10 +27,14 @@ func (that *SessionIns) Session(key string, data ...interface{}) *Obj {
|
|||||||
|
|
||||||
if len(data) != 0 {
|
if len(data) != 0 {
|
||||||
if data[0] == nil {
|
if data[0] == nil {
|
||||||
|
//that.mutex.Lock()
|
||||||
delete(that.Map, key)
|
delete(that.Map, key)
|
||||||
|
//that.mutex.Unlock()
|
||||||
that.set()
|
that.set()
|
||||||
} else {
|
} else {
|
||||||
|
//that.mutex.Lock()
|
||||||
that.Map[key] = data[0]
|
that.Map[key] = data[0]
|
||||||
|
//that.mutex.Unlock()
|
||||||
that.set()
|
that.set()
|
||||||
}
|
}
|
||||||
return &Obj{Data: nil}
|
return &Obj{Data: nil}
|
||||||
@ -52,5 +58,6 @@ func (that *SessionIns) get() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (that *SessionIns) Init(cache *HoTimeCache) {
|
func (that *SessionIns) Init(cache *HoTimeCache) {
|
||||||
|
//that.mutex=sync.Mutex{}
|
||||||
that.HoTimeCache = cache
|
that.HoTimeCache = cache
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user