The data is stored as “numeric(8,2)” and shows correctly as numeric values in a sql query using PGAdmin.
Fetching the same query in Go the numeric values destroys and gets into [53 48 48 46 48 48] unless I cast the numeric values as “text”. I am using sqlx.
list := get(query)
tpl.ExecuteTemplate(w, "hrlist.html", list)
Allt text displays correct.
How do I translate numeric values in Go?
It looks like the data is being returned as
byte whereas it is actually a
You should be able to cast it into string and it will display properly
How do I do this using Go? In SQL I have to cast each and every of hundreds field. It must be a smarter way from within Go. Or?
What type is list in your example above? Assuming is is a slice you could iterate it creating a new list.
[map[hr_code:PM hr_date:2020-08-22 hr_id:34 hr_job:20-0001 hr_ppu:[49 48 48 48 46 48 48]]
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.