MCPcopy
hub / github.com/go-gorm/gorm / Model

Method Model

chainable_api.go:18–22  ·  view source on GitHub ↗

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{})

Source from the content-addressed store, hash-verified

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")
18func (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//

Callers 15

FirstOrCreateMethod · 0.80
RawMethod · 0.80
ExecMethod · 0.80
getInstanceMethod · 0.80
UpdateMethod · 0.80
CountMethod · 0.80
ScanMethod · 0.80
RowMethod · 0.80
RowsMethod · 0.80
UpdateMethod · 0.80
CreateMethod · 0.80

Calls 1

getInstanceMethod · 0.95