Updated could automatically add a timestamp on the record when you insert or update one record. You have to add one updated tag on xorm tag section. The field type could be time.Time, type MyTime time.Time or int, int64. For example,

type User struct {
    Id int64
    Name string
    UpdatedAt time.Time `xorm:"updated"`

When methods Insert(), InsertOne(), Update() are invoked, updated field will be filled as current time or timestamp. For example:

var user User
// SELECT * FROM user WHERE id = ?
// UPDATE user SET ..., updated_at = ? WHERE id = ?

If you will temporarilly stop filling the time, use NoAutoTime():


This feature is useful when you want to copy one record from one table to another.