Skip to content

Instantly share code, notes, and snippets.

@chrisfauerbach
Created February 2, 2018 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisfauerbach/45275f1d234b935c9b3ff650ecf215ed to your computer and use it in GitHub Desktop.
Save chrisfauerbach/45275f1d234b935c9b3ff650ecf215ed to your computer and use it in GitHub Desktop.
func nameExists(name string) {
retval boolean := false
database, err = sql.Open("postgres", "postgres://chris@localhost")
if err != nil {
log.Fatal(err)
}
r, _ := database.Query("SELECT EMAIL FROM BLACKLIST WHERE EMAIL = $1", name)
for r.Next() {
var curName string
r.Scan(&curName)
retval = true
}
r.Close()
writeJSON(rw, 200, namesInDb)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment