1234567891011121314151617181920 |
- package session
- import (
- "time"
- )
- // Update 更新对应字段数据
- func (session *Session) Update(updateCols []string) (err error) {
- err = getDb().Model(session).Select(updateCols).Updates(*session).Error
- return
- }
- // UpdateSession 更新session
- func (session *Session) UpdateSession(userId int64, expireTime time.Time) (err error) {
- session.UserID = userId
- session.ExpireTime = expireTime
- var updateCols = []string{"UserID", "ExpireTime"}
- err = session.Update(updateCols)
- return
- }
|