comment_vote.go: clean up SQL
This commit is contained in:
parent
e0504a0c88
commit
e7a5e01379
@ -28,12 +28,12 @@ func commentVote(commenterHex string, commentHex string, direction int) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
statement = `
|
statement = `
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
votes (commentHex, commenterHex, direction, voteDate)
|
votes (commentHex, commenterHex, direction, voteDate)
|
||||||
VALUES ($1, $2, $3, $4 )
|
VALUES ($1, $2, $3, $4 )
|
||||||
ON CONFLICT (commentHex, commenterHex) DO
|
ON CONFLICT (commentHex, commenterHex) DO
|
||||||
UPDATE SET direction = $3;
|
UPDATE SET direction = $3;
|
||||||
`
|
`
|
||||||
_, err := db.Exec(statement, commentHex, commenterHex, direction, time.Now().UTC())
|
_, err := db.Exec(statement, commentHex, commenterHex, direction, time.Now().UTC())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorf("error inserting/updating votes: %v", err)
|
logger.Errorf("error inserting/updating votes: %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user