2018-05-27 22:40:42 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import ()
|
|
|
|
|
2018-06-20 11:29:55 +08:00
|
|
|
func commenterSessionUpdate(commenterToken string, commenterHex string) error {
|
|
|
|
if commenterToken == "" || commenterHex == "" {
|
2018-05-27 22:40:42 +08:00
|
|
|
return errorMissingField
|
|
|
|
}
|
|
|
|
|
|
|
|
statement := `
|
2019-12-28 09:31:27 +08:00
|
|
|
UPDATE commenterSessions
|
|
|
|
SET commenterHex = $2
|
|
|
|
WHERE commenterToken = $1;
|
|
|
|
`
|
2018-06-20 11:29:55 +08:00
|
|
|
_, err := db.Exec(statement, commenterToken, commenterHex)
|
2018-05-27 22:40:42 +08:00
|
|
|
if err != nil {
|
2018-06-20 11:29:55 +08:00
|
|
|
logger.Errorf("error updating commenterHex: %v", err)
|
2018-05-27 22:40:42 +08:00
|
|
|
return errorInternal
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|