Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for AfterAppendSlice (0.08 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)
  2. tests/associations_many2many_test.go

    		t.Fatalf("Error happened when append language, got %v", err)
    	}
    
    	user.Languages = append(user.Languages, languages...)
    
    	CheckUser(t, user2, user)
    
    	AssertAssociationCount(t, user, "Languages", 5, "AfterAppendSlice")
    
    	// Replace
    	language2 := Language{Code: "language-many2many-replace", Name: "language-many2many-replace"}
    	DB.Create(&language2)
    
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Sat Jun 10 13:05:19 UTC 2023
    - 13.2K bytes
    - Viewed (0)
Back to top