a090770b73
I know this is a huge commit, but I can't be bothered to check this in part by part.
25 lines
397 B
Go
25 lines
397 B
Go
package main
|
|
|
|
import ()
|
|
|
|
func commentDomainGet(commentHex string) (string, error) {
|
|
if commentHex == "" {
|
|
return "", errorMissingField
|
|
}
|
|
|
|
statement := `
|
|
SELECT domain
|
|
FROM comments
|
|
WHERE commentHex = $1;
|
|
`
|
|
row := db.QueryRow(statement, commentHex)
|
|
|
|
var domain string
|
|
var err error
|
|
if err = row.Scan(&domain); err != nil {
|
|
return "", errorNoSuchDomain
|
|
}
|
|
|
|
return domain, nil
|
|
}
|