Does GORM have a decimal datatype to store money values (-> Decimal(8,2)
)?
I could not find it on https://github.com/jinzhu/gorm#define-models-structs
Does GORM have a decimal datatype to store money values (-> Decimal(8,2)
)?
I could not find it on https://github.com/jinzhu/gorm#define-models-structs
If you're using AutoMigrate, you can give GORM SQL instructions (in your struct model) on how to build the table. Try something like the following:
type Product struct {
Id int
ProductName string `sql:"type:varchar(250);"`
Amount float32 `sql:"type:decimal(10,2);"`
}