- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 20 for Updated (0.19 sec)
-
tests/associations_has_many_test.go
t.Fatalf("failed to create items, got error: %v", err) } // test Replace if err := tx.Model(&item).Association("Contents").Unscoped().Replace([]ItemContent{ {Name: "updated name", LanguageCode: "en"}, {Name: "ar updated name", LanguageCode: "ar"}, {Name: "le nom", LanguageCode: "fr"}, }); err != nil { t.Errorf("failed to replace item content, got error: %v", err) }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Dec 15 08:36:08 GMT 2023 - 15.6K bytes - Viewed (0) -
tests/upsert_test.go
if user6.Name != "find or create" || user6.ID == 0 || user6.Age != 44 { t.Errorf("user should be found and updated with assigned attrs") } DB.Where(&User{Name: "find or create"}).Find(&user7) if user7.Name != "find or create" || user7.ID == 0 || user7.Age != 44 { t.Errorf("user should be found and updated with assigned attrs") }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Mon Sep 05 07:39:19 GMT 2022 - 11.4K bytes - Viewed (0) -
tests/hooks_test.go
} p2 := Product{Code: "update_callback", Price: 100} DB.Save(&p2) p2.Code = "dont_update" if DB.Save(&p2).Error == nil { t.Fatalf("An error from before update callbacks happened when update with invalid value") } if DB.Where("code = ?", "update_callback").First(&Product{}).Error != nil { t.Fatalf("Record Should not be updated due to errors happened in before update callback") }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Sat Feb 18 01:20:29 GMT 2023 - 15.9K bytes - Viewed (0) -
tests/update_test.go
users := []*User{ GetUser("updates_01", Config{}), GetUser("updates_02", Config{}), } DB.Create(&users) lastUpdatedAt := users[0].UpdatedAt // update with map if res := DB.Model(users[0]).Updates(map[string]interface{}{"name": "updates_01_newname", "age": 100}); res.Error != nil || res.RowsAffected != 1 { t.Errorf("Failed to update users") } if users[0].Name != "updates_01_newname" || users[0].Age != 100 {
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Mon Dec 04 03:50:58 GMT 2023 - 30.3K bytes - Viewed (0) -
tests/create_test.go
} if user.CreatedAt.IsZero() { t.Errorf("user's created at should be not zero") } if user.UpdatedAt.IsZero() { t.Errorf("user's updated at should be not zero") } var newUser User if err := DB.Where("id = ?", user.ID).First(&newUser).Error; err != nil { t.Fatalf("errors happened when query: %v", err) } else { CheckUser(t, newUser, user) }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Tue Mar 19 03:50:28 GMT 2024 - 26.4K bytes - Viewed (0) -
tests/table_test.go
} func TestTableWithAllFields(t *testing.T) { dryDB := DB.Session(&gorm.Session{DryRun: true, QueryFields: true}) userQuery := "SELECT .*user.*id.*user.*created_at.*user.*updated_at.*user.*deleted_at.*user.*name.*user.*age" + ".*user.*birthday.*user.*company_id.*user.*manager_id.*user.*active.* " r := dryDB.Table("`user`").Find(&User{}).Statement
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Sat Mar 09 09:31:28 GMT 2024 - 10.6K bytes - Viewed (0) -
chainable_api.go
"gorm.io/gorm/utils" ) // 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") func (db *DB) Model(value interface{}) (tx *DB) { tx = db.getInstance() tx.Statement.Model = value
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Wed Apr 17 03:38:55 GMT 2024 - 14.3K bytes - Viewed (1) -
scan.go
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Apr 26 09:53:11 GMT 2024 - 9.8K bytes - Viewed (0) -
schema/field_test.go
ID uint Name string `gorm:"-"` Name2 string `gorm:"->"` Name3 string `gorm:"<-"` Name4 string `gorm:"<-:create"` Name5 string `gorm:"<-:update"` Name6 string `gorm:"<-:create,update"` Name7 string `gorm:"->:false;<-:create,update"` Name8 string `gorm:"->;-:migration"` } func TestParseFieldWithPermission(t *testing.T) {
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Sat Feb 19 09:02:53 GMT 2022 - 12.7K bytes - Viewed (0) -
finisher_api.go
} } } return tx.Model(dest).Updates(assigns) } return tx } // Update updates column with value using callbacks. Reference: https://gorm.io/docs/update.html#Update-Changed-Fields func (db *DB) Update(column string, value interface{}) (tx *DB) { tx = db.getInstance() tx.Statement.Dest = map[string]interface{}{column: value} return tx.callbacks.Update().Execute(tx) }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Jan 12 08:42:21 GMT 2024 - 22.7K bytes - Viewed (0)