Answer the question
In order to leave comments, you need to log in
How to pass html from sql query to structure with type template.HTML?
There is a structure
type NewsData struct {
Id int // id новости
Uid int
Pt int
Title string // заголовок новости
Post template.HTML // текст новости
Time time.Time // время создания или изменения
}
var n NewsData
err := rows.Scan(&n.Id, &n.Uid, &n.Pt, &n.Title, &n.Post, &n.Time)
Scan error on column index 4: unsupported Scan, storing driver.Value type []uint8 into type *template.HTML
Answer the question
In order to leave comments, you need to log in
Describe the structure, implement Scan and Value for it.
The format of the structure is something like template.HTML + Valid bool, but I don’t know if it will work.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question