package model import ( "time" "gorm.io/gorm" ) type User struct { ID uint64 `json:"id"` Login string `json:"login"` Password string `json:"-"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` } func (*User) TableName() string { return "users" } func (u *User) BeforeUpdate(*gorm.DB) error { u.UpdatedAt = time.Now() return nil }