Your Question

I have two fields

Created   time.Time   `gorm:"column:created;<-:false" json:"created"`
Modified   time.Time   `gorm:"column:modified;<-:false" json:"modified"`

And in db it is

 `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

Now after a record is created, I can't get the default value from db, Is there any way to get the value?

Expected answer

Comment From: ivila

No, you can't, the return value from your db server is last insert id, if you want to update other value, just fetch the record from the db server and update yourself.

You may just check the design of golang official pkg database/sql as well.