2
0

Move to Scan interface

Remove SelectValue
This commit is contained in:
Jack Christensen
2014-07-05 18:23:19 -05:00
parent 5b345e80e1
commit 43dcd47a92
10 changed files with 351 additions and 576 deletions
+3 -2
View File
@@ -44,8 +44,9 @@ func afterConnect(conn *pgx.Conn) (err error) {
}
func getUrlHandler(w http.ResponseWriter, req *http.Request) {
if url, err := pool.SelectValue("getUrl", req.URL.Path); err == nil {
http.Redirect(w, req, url.(string), http.StatusSeeOther)
var url string
if err := pool.QueryRow("getUrl", req.URL.Path).Scan(&url); err == nil {
http.Redirect(w, req, url, http.StatusSeeOther)
} else if _, ok := err.(pgx.NotSingleRowError); ok {
http.NotFound(w, req)
} else {