- Sort Score
- Result 10 results
- Languages All
Results 31 - 37 of 37 for Save (0.12 sec)
-
tests/associations_test.go
child := Child{ParentID: &parent.ID, Parent: &parent} DB.Create(&child) parent.FavChildID = child.ID parent.FavChild = &child DB.Save(&parent) var parent1 Parent DB.First(&parent1, parent.ID) AssertObjEqual(t, parent, parent1, "ID", "FavChildID") // Save and Updates is the same DB.Updates(&parent) DB.First(&parent1, parent.ID) AssertObjEqual(t, parent, parent1, "ID", "FavChildID") }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Wed Feb 08 08:29:09 GMT 2023 - 10.9K bytes - Viewed (0) -
tests/query_test.go
} } func TestSelect(t *testing.T) { user := User{Name: "SelectUser1"} DB.Save(&user) var result User DB.Where("name = ?", user.Name).Select("name").Find(&result) if result.ID != 0 { t.Errorf("Should not have ID because only selected name, %+v", result.ID) } if user.Name != result.Name { t.Errorf("Should have user Name when selected it") } var result2 User
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Thu Apr 25 12:22:53 GMT 2024 - 49.8K bytes - Viewed (0) -
association.go
if association.Error == nil { reflectValue := association.DB.Statement.ReflectValue rel := association.Relationship var oldBelongsToExpr clause.Expression // we have to record the old BelongsTo value if association.Unscope && rel.Type == schema.BelongsTo { var foreignFields []*schema.Field for _, ref := range rel.References { if !ref.OwnPrimaryKey {
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Thu May 04 11:30:45 GMT 2023 - 21.2K bytes - Viewed (0) -
tests/associations_many2many_test.go
{Code: "TestDuplicateMany2ManyAssociation-language-3"}, }} users := []*User{&user1, &user2} var err error err = DB.Session(&gorm.Session{FullSaveAssociations: true}).Save(users).Error AssertEqual(t, nil, err) var findUser1 User err = DB.Preload("Languages").Where("id = ?", user1.ID).First(&findUser1).Error AssertEqual(t, nil, err) AssertEqual(t, user1, findUser1)
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Sat Jun 10 13:05:19 GMT 2023 - 13.2K bytes - Viewed (0) -
gorm.go
// You can disable it by setting `SkipDefaultTransaction` to true SkipDefaultTransaction bool // NamingStrategy tables, columns naming strategy NamingStrategy schema.Namer // FullSaveAssociations full save associations FullSaveAssociations bool // Logger Logger logger.Interface // NowFunc the function to be used when creating a new timestamp NowFunc func() time.Time // DryRun generate sql without execute
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Sun Aug 20 11:46:56 GMT 2023 - 11.6K bytes - Viewed (0) -
tests/joins_table_test.go
} if err := DB.Model(&person).Association("Addresses").Delete(&person.Addresses[0]); err != nil { t.Fatalf("Failed to delete address, got error %v", err) } if len(person.Addresses) != 1 { t.Fatalf("Should have one address left") } if DB.Find(&[]PersonAddress{}, "person_id = ?", person.ID).RowsAffected != 1 { t.Fatalf("Should found one address") } var addresses2 []Address
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Thu Sep 10 13:46:18 GMT 2020 - 3.5K bytes - Viewed (1) -
tests/associations_belongs_to_test.go
user = User{Name: "invalid-user-with-invalid-belongs-to-foreign-key", CompanyID: &unexistCompanyID} if err := DB.Create(&user).Error; err == nil { tidbSkip(t, "not support the foreign key feature") t.Errorf("should have gotten foreign key violation error") } } func TestBelongsToAssociationForSlice(t *testing.T) { users := []User{ *GetUser("slice-belongs-to-1", Config{Company: true, Manager: true}),
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Mon Oct 30 09:15:49 GMT 2023 - 9.3K bytes - Viewed (0)