Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for berate (0.15 sec)

  1. tests/associations_has_many_test.go

    import (
    	"testing"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestHasManyAssociation(t *testing.T) {
    	user := *GetUser("hasmany", Config{Pets: 2})
    
    	if err := DB.Create(&user).Error; err != nil {
    		t.Fatalf("errors happened when create: %v", err)
    	}
    
    	CheckUser(t, user, user)
    
    	// Find
    	var user2 User
    	DB.Find(&user2, "id = ?", user.ID)
    	DB.Model(&user2).Association("Pets").Find(&user2.Pets)
    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)
Back to top