problem.
var data []map[string]string
for rows.Next() {
// cv represents map created from db data
cv := funct_converting_row // returns proper map for db row
data = append(data, cv) // this works the way that each loop iteration has proper number of elements in slice but each element is exactly the same like last one added
}
why this happens ?
Tested with []int & []string and there is no problem.
Read through https://go.dev/blog/slices
Tried function Extend, no matter what I do, I have the same element in map.
I can not define type struct for it as I do not know number and names from db table.
I need agnostic solution for get actions for API.
Any idea how to solve that problem with append map ?
Not sure if it matters but I use go version go1.22.2 linux/amd64