res,err:=tx.Exec("UPDATE user_edge SET state = 0, updated_at = $3 WHERE source_id = $1 AND destination_id = $2 AND state = 2",friendIDBytes,session.userID.Bytes(),updatedAt)
// Mark an invite as accepted, if one was in place.
res,err:=tx.Exec(`
UPDATE user_edge SET state = 0, updated_at = $3
WHERE (source_id = $1 AND destination_id = $2 AND state = 2)
OR (source_id = $2 AND destination_id = $1 AND state = 1)
`,friendIDBytes,session.userID.Bytes(),updatedAt)
iferr!=nil{
return
}
state:=2
rowsAffected,_:=res.RowsAffected()
ifrowsAffected==1{
state=0
// If both edges were updated, it was accepting an invite was successful.