Golang, MySQL, unable to append query data to list of structures
<p>When I try to parse the data into a struct and then append it to the slice, I get nothing. But if I use the query in MySQL Workbench, I get some values...</p>
<pre class="brush:php;toolbar:false;">query, err := db.Query("SELECT 'description','is_done' FROM tasks WHERE 'user_id' = ?;", userId)
if err != nil {
return nil, err
}
defer query.Close()
var tasks[]TodoUserDTO
var currentTask TodoUserDTO
for query.Next() {
err = query.Scan(¤tTask.Description, ¤tTask.IsDone)
if err != nil {
panic(err)
}
tasks = append(tasks, currentTask)
}</pre>
<p>The TodoDTO structure is as follows: </p>
<pre class="brush:php;toolbar:false;">type TodoUserDTO struct {
Description string `json:"desc"`
IsDone bool `json:"done"`
}</pre></p>