I am doing a Golang query to the postgres database and the weird thing is that the query only works if I hard-code the value in for instance this query works
db.QueryRow("select json_build_object('Streams', array_to_json(array_agg(t))) from (select p.name FROM profiles as p INNER JOIN streams as s ON(s.profile_id =
p.id) WHERE s.latitudes >=28.1036 AND shared = false order by id desc limit 15)t").Scan(&result)
The only part that I now change is where the WHERE s.latitudes >=28.1036 instead of having that value hard-coded I Past it through a form and now have the query like this
db.QueryRow("select json_build_object('Streams', array_to_json(array_agg(t))) from (select p.name FROM profiles as p INNER JOIN streams as s ON(s.profile_id =
p.id) WHERE s.latitudes>=$1 AND shared = false order by id desc limit 15)t",LatMin).Scan(&result)
Now the query just comes back null and I do know for a fact that the LatMin variable is being populated correctly as this is my code
func Auto_Location(w http.ResponseWriter, r *http.Request) {
var result string
if r.Method == "GET" {
} else {
r.ParseForm() }
LatMin := r.Form["LatMin"]
db,err := sql.Open("Postgres Connects")
if err != nil {
log.Fatal(err)
println(err)
}
db.QueryRow("select json_build_object('Streams', array_to_json(array_agg(t))) from (select p.name FROM profiles as p INNER JOIN streams as s ON(s.profile_id =
p.id) WHERE s.latitudes>=$1 AND shared = false order by id desc limit 15)t",LatMin).Scan(&result)
defer db.Close()
w.Header().Set("Content-Type", "application/json")
fmt.Fprintf(w,result)
fmt.Println("Value:", LatMin)
}
Again as you can see from the code I am using FMT and the LatMin has the correct value of 28.1036 is there something that I am missing here.. The postgres package I am using is _ "github.com/lib/pq" . I am thinking it is an issue with float values because if I change LatMin to 28 it works but 28.1036 does not