commento/api/comment_domain_get.go
Adhityaa a090770b73 api: Add go files
I know this is a huge commit, but I can't be bothered to check
this in part by part.
2018-05-27 23:40:46 +05:30

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
}