Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for call_method (0.2 sec)

  1. tests/transaction_test.go

    			return tx2.Scan(&User{}).Error
    		})
    	})
    
    	if err != nil {
    		t.Error(err)
    	}
    
    	// method with hooks
    	err = DB.Transaction(func(tx1 *gorm.DB) error {
    		// callMethod do
    		tx2 := tx1.Find(&User{}).Session(&gorm.Session{NewDB: true})
    		// trx in hooks
    		return tx2.Transaction(func(tx3 *gorm.DB) error {
    			return tx3.Where("user_id", user.ID).Delete(&Account{}).Error
    		})
    	})
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 10.9K bytes
    - Viewed (0)
Back to top