Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for OpenTestConnection (0.14 sec)

  1. tests/associations_many2many_test.go

    	AssertEqual(t, nil, err)
    	AssertEqual(t, user2, findUser2)
    }
    
    func TestConcurrentMany2ManyAssociation(t *testing.T) {
    	db, err := OpenTestConnection(&gorm.Config{})
    	if err != nil {
    		t.Fatalf("open test connection failed, err: %+v", err)
    	}
    
    	count := 3
    
    	var languages []Language
    	for i := 0; i < count; i++ {
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Sat Jun 10 13:05:19 UTC 2023
    - 13.2K bytes
    - Viewed (0)
  2. tests/transaction_test.go

    	}
    
    	if err := DB.First(&User{}, "name = ?", user2.Name).Error; err != nil {
    		t.Fatalf("Should find saved record")
    	}
    }
    
    func TestTransactionOnClosedConn(t *testing.T) {
    	DB, err := OpenTestConnection(&gorm.Config{})
    	if err != nil {
    		t.Fatalf("failed to connect database, got error %v", err)
    	}
    	rawDB, _ := DB.DB()
    	rawDB.Close()
    
    	if err := DB.Transaction(func(tx *gorm.DB) error {
    		return nil
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Sat Sep 14 12:58:29 UTC 2024
    - 12.9K bytes
    - Viewed (0)
  3. tests/hooks_test.go

    func (p *Product6) BeforeDelete(tx *gorm.DB) error {
    	if err := tx.Delete(&p.Item).Error; err != nil {
    		return err
    	}
    	return nil
    }
    
    func TestPropagateUnscoped(t *testing.T) {
    	_DB, err := OpenTestConnection(&gorm.Config{
    		PropagateUnscoped: true,
    	})
    	if err != nil {
    		log.Printf("failed to connect database, got error %v", err)
    		os.Exit(1)
    	}
    
    	_DB.Migrator().DropTable(&Product6{}, &ProductItem2{})
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Mon Jun 17 03:59:06 UTC 2024
    - 16.7K bytes
    - Viewed (0)
Back to top