I am new to Gorp and golang.
https://github.com/go-gorp/gorp
I have a mysql table like
Table: product
Column: id(int), name(string), category1(string), category2(string)
and I created an embedded struct like
type (
Product struct {
Id int
Name Names `db:"name"`
Categories Categories
}
Categories struct {
Category1 string `db:"category1"`
Category2 string `db:"category2"`
}
)
And I executed the following script
.......
product := &Product{-1,"foobar", Categories{"sample1", "sample2"}}
err := dbmap.Insert(product)
fmt.Println(err)
But I got this error message below
converting Exec argument $2 type: unsupported type main.Categories, a struct
I thought I had followed the manual of Struct Embedding.
https://github.com/go-gorp/gorp#struct-embedding
Please help me understand why I am still getting this error.