Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for Tx (0.16 sec)

  1. tests/query_test.go

    		results    []User
    		totalBatch int
    	)
    
    	if result := DB.Table("users as u").Where("name = ?", users[0].Name).FindInBatches(&results, 2, func(tx *gorm.DB, batch int) error {
    		totalBatch += batch
    
    		if tx.RowsAffected != 2 {
    			t.Errorf("Incorrect affected rows, expects: 2, got %v", tx.RowsAffected)
    		}
    
    		if len(results) != 2 {
    			t.Errorf("Incorrect users length, expects: 2, got %v", len(results))
    		}
    
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Mon Jun 24 09:42:59 UTC 2024
    - 50.4K bytes
    - Viewed (0)
  2. tests/migrate_test.go

    	}
    
    	var err error
    	_ = DB.Migrator().DropTable(&RelationModel1{}, &RelationModel2{}, &RelationModel3{})
    
    	tx := DB.Session(&gorm.Session{})
    	tx.IgnoreRelationshipsWhenMigrating = true
    
    	err = tx.AutoMigrate(&RelationModel3{})
    	if err != nil {
    		t.Errorf("AutoMigrate err:%v", err)
    	}
    
    	// RelationModel3 should be existed
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Mon Mar 18 11:24:16 UTC 2024
    - 56.2K bytes
    - Viewed (0)
Back to top