Agniva De Sarker
2021-08-13 20:13:27 +05:30
коммит произвёл GitHub
родитель db80740414
Коммит 2711262729
2 изменённых файлов: 15 добавлений и 10 удалений

Просмотреть файл

@@ -249,19 +249,15 @@ func (me SqlSessionStore) UpdateDeviceId(id string, deviceId string, expiresAt i
}
func (me SqlSessionStore) UpdateProps(session *model.Session) error {
oldSession, err := me.Get(context.Background(), session.Id)
if err != nil {
return err
}
oldSession.Props = session.Props
count, err := me.GetMaster().Update(oldSession)
_, err := me.GetMaster().Exec(`UPDATE Sessions
SET Props=:Props
WHERE Id=:Id`, map[string]interface{}{
"Props": model.MapToJson(session.Props),
"Id": session.Id,
})
if err != nil {
return errors.Wrap(err, "failed to update Session")
}
if count != 1 {
return fmt.Errorf("updated Sessions were %d, expected 1", count)
}
return nil
}