Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for OpenTestConnection (0.17 sec)

  1. tests/tests_test.go

    	sqlserverDSN = "sqlserver://sa:LoremIpsum86@localhost:9930?database=master"
    	tidbDSN      = "root:@tcp(localhost:9940)/test?charset=utf8&parseTime=True&loc=Local"
    )
    
    func init() {
    	var err error
    	if DB, err = OpenTestConnection(&gorm.Config{}); err != nil {
    		log.Printf("failed to connect database, got error %v", err)
    		os.Exit(1)
    	} else {
    		sqlDB, err := DB.DB()
    		if err != nil {
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Mon Sep 30 03:21:19 UTC 2024
    - 3.3K bytes
    - Viewed (0)
  2. tests/error_translator_test.go

    	}
    }
    
    func TestSupportedDialectorWithErrDuplicatedKey(t *testing.T) {
    	type City struct {
    		gorm.Model
    		Name string `gorm:"unique"`
    	}
    
    	db, err := OpenTestConnection(&gorm.Config{TranslateError: true})
    	if err != nil {
    		t.Fatalf("failed to connect database, got error %v", err)
    	}
    
    	dialectors := map[string]bool{"sqlite": true, "postgres": true, "mysql": true, "sqlserver": true}
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Wed Jul 12 13:21:22 UTC 2023
    - 3.1K bytes
    - Viewed (0)
  3. tests/prepared_stmt_test.go

    		t.Fatalf("Failed, got error: %v, rows affected: %v", result.Error, result.RowsAffected)
    	}
    	tx2.Commit()
    }
    
    func TestPreparedStmtDeadlock(t *testing.T) {
    	tx, err := OpenTestConnection(&gorm.Config{})
    	AssertEqual(t, err, nil)
    
    	sqlDB, _ := tx.DB()
    	sqlDB.SetMaxOpenConns(1)
    
    	tx = tx.Session(&gorm.Session{PrepareStmt: true})
    
    	wg := sync.WaitGroup{}
    	for i := 0; i < 100; i++ {
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Aug 22 11:02:05 UTC 2024
    - 8.5K bytes
    - Viewed (0)
  4. 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)
  5. 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)
  6. 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