gorm: How to scan ignored field gorm:"-" ?
I have struct like this
type Menu struct {
Name string `json:"name" gorm:"type:varchar(150);"`
WebsiteName string `json:"websiteName" gorm:"-"`
}
I want the WebsiteName to be able to scan but I do not want this field to be created in the Database. But when I add - the field does not get created in DB that’s good but when I Scan(&menu) the field is not getting scanned.
How do I make this work ?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (4 by maintainers)
@khanakia I haven’t tried, but I think it might help you
<-:falseno write permission,->read permission, and-:migrationignore migration. https://github.com/go-gorm/gorm/pull/4028