2018-07-25 02:34:42 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import ()
|
|
|
|
|
|
|
|
func commentDomainPathGet(commentHex string) (string, string, error) {
|
|
|
|
if commentHex == "" {
|
|
|
|
return "", "", errorMissingField
|
|
|
|
}
|
|
|
|
|
|
|
|
statement := `
|
2019-12-28 09:31:27 +08:00
|
|
|
SELECT domain, path
|
2018-07-25 02:34:42 +08:00
|
|
|
FROM comments
|
|
|
|
WHERE commentHex = $1;
|
|
|
|
`
|
|
|
|
row := db.QueryRow(statement, commentHex)
|
|
|
|
|
|
|
|
var domain string
|
|
|
|
var path string
|
|
|
|
var err error
|
|
|
|
if err = row.Scan(&domain, &path); err != nil {
|
|
|
|
return "", "", errorNoSuchDomain
|
|
|
|
}
|
|
|
|
|
|
|
|
return domain, path, nil
|
|
|
|
}
|