mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 06:10:55 +00:00
all: simplify boolean expressions
- !(a == b) => a != b - !(a != b) => a == b Signed-off-by: Iskander Sharipov <quasilyte@gmail.com>
This commit is contained in:
parent
26a6b426f1
commit
67666dbe0f
2
cache/memcache/memcache.go
vendored
2
cache/memcache/memcache.go
vendored
@ -146,7 +146,7 @@ func (rc *Cache) IsExist(key string) bool {
|
||||
}
|
||||
}
|
||||
_, err := rc.conn.Get(key)
|
||||
return !(err != nil)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// ClearAll clear all cached in memcache.
|
||||
|
@ -133,7 +133,7 @@ func (lp *Provider) SessionRead(sid string) (session.Store, error) {
|
||||
// SessionExist check ledis session exist by sid
|
||||
func (lp *Provider) SessionExist(sid string) bool {
|
||||
count, _ := c.Exists([]byte(sid))
|
||||
return !(count == 0)
|
||||
return count != 0
|
||||
}
|
||||
|
||||
// SessionRegenerate generate new sid for ledis session
|
||||
|
@ -170,7 +170,7 @@ func (mp *Provider) SessionExist(sid string) bool {
|
||||
row := c.QueryRow("select session_data from "+TableName+" where session_key=?", sid)
|
||||
var sessiondata []byte
|
||||
err := row.Scan(&sessiondata)
|
||||
return !(err == sql.ErrNoRows)
|
||||
return err != sql.ErrNoRows
|
||||
}
|
||||
|
||||
// SessionRegenerate generate new sid for mysql session
|
||||
|
@ -184,7 +184,7 @@ func (mp *Provider) SessionExist(sid string) bool {
|
||||
row := c.QueryRow("select session_data from session where session_key=$1", sid)
|
||||
var sessiondata []byte
|
||||
err := row.Scan(&sessiondata)
|
||||
return !(err == sql.ErrNoRows)
|
||||
return err != sql.ErrNoRows
|
||||
}
|
||||
|
||||
// SessionRegenerate generate new sid for postgresql session
|
||||
|
Loading…
Reference in New Issue
Block a user