Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for AfterAppendSlice (0.1 sec)

  1. tests/associations_has_many_test.go

    		pet := pet
    		if pet.ID == 0 {
    			t.Fatalf("Pet's ID should be created")
    		}
    
    		user.Pets = append(user.Pets, &pet)
    	}
    
    	CheckUser(t, user2, user)
    
    	AssertAssociationCount(t, user, "Pets", 5, "AfterAppendSlice")
    
    	// Replace
    	pet2 := Pet{Name: "pet-has-many-replace"}
    
    	if err := DB.Model(&user2).Association("Pets").Replace(&pet2); err != nil {
    		t.Fatalf("Error happened when append pet, got %v", err)
    	}
    
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Wed Jun 12 10:49:45 UTC 2024
    - 16K bytes
    - Viewed (0)
Back to top