Model specify the model you would like to run db operations // update all users's name to `hello` db.Model(&User{}).Update("name", "hello") // if user's primary key is non-blank, will use it as condition, then will only update that user's name to `hello` db.Model(&user).Update("name", "hello")
(value interface{})
| 16 | // // if user's primary key is non-blank, will use it as condition, then will only update that user's name to `hello` |
| 17 | // db.Model(&user).Update("name", "hello") |
| 18 | func (db *DB) Model(value interface{}) (tx *DB) { |
| 19 | tx = db.getInstance() |
| 20 | tx.Statement.Model = value |
| 21 | return |
| 22 | } |
| 23 | |
| 24 | // Clauses Add clauses |
| 25 | // |