- Sort Score
- Result 10 results
- Languages All
Results 1 - 2 of 2 for FirstOrInit (0.05 sec)
-
chainable_api.go
// db.Where(User{Name: "jinzhu"}).Attrs(User{Email: "******@****.***"}).FirstOrInit(&user) // // user -> User{Name: "jinzhu", Age: 20} // // [FirstOrCreate]: https://gorm.io/docs/advanced_query.html#FirstOrCreate // [FirstOrInit]: https://gorm.io/docs/advanced_query.html#FirstOrInit func (db *DB) Attrs(attrs ...interface{}) (tx *DB) { tx = db.getInstance() tx.Statement.attrs = attrs return }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 24 09:42:59 UTC 2024 - 14.8K bytes - Viewed (0) -
finisher_api.go
// // user -> User{Name: "non_existing", Email: "******@****.***"} // // // assign email regardless of if record is found // db.Where(User{Name: "jinzhu"}).Assign(User{Email: "******@****.***"}).FirstOrInit(&user) // // user -> User{Name: "jinzhu", Age: 20, Email: "******@****.***"} func (db *DB) FirstOrInit(dest interface{}, conds ...interface{}) (tx *DB) {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Sat Sep 14 12:58:29 UTC 2024 - 22.8K bytes - Viewed (0)