go banner

How to Add Multiple Tags to Go Struct

It is easy but always be forgotten, so write this post Incorrect type Page struct { PageId string `bson:"pageId",json:"pageId"` Meta map[string]interface{} `bson:"meta",json:"pageId"` } Correct type Page struct { PageId string `bson:"pageId" json:"pageId"` Meta map[string]interface{} `bson:"meta" json:"pageId"` } More tags Items []Item `gorm:"column:items,type:varchar(255);comment:'sample column'" json:"items"` Links StackOverflow - How to define multiple name tags in a struct

February 26, 2023 · Aimer Neige