I have a problemwhen insert document in to redis.
I have a struct of data in Go:
type ArticleCovers struct {
ID int
Covers ArticleCovers
ArticleTypeID int
Address Address `gorm:"ForeignKey:AddressID"`
}
I want to add a data like this into Redis:
[ID:1 Cover:[http://chuabuuminh.vn/UserImages/2012/12/10/1/chinh_dien_jpg.jpg] ArticleTypeID:1 Address:map[Street: City:<nil> District:<nil> DistrictID:0 ID:0 Slug: Lat:0 Long:0 Ward:<nil> WardID:0 CityID:0]]
But when I run Redis.HMSet("test", structs.Map(ret))
it return the error: redis: can't marshal postgresql.ArticleCovers (consider implementing encoding.BinaryMarshaler)
.
Who can help me fix my problem, thks you so much!