Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for TestSetColumn (0.06 sec)

  1. tests/hooks_test.go

    		tx.Statement.SetColumn("Price", s.Price+10)
    	}
    
    	if tx.Statement.Changed("Code") {
    		s.Price += 20
    		tx.Statement.SetColumn("Price", s.Price+30)
    	}
    	return nil
    }
    
    func TestSetColumn(t *testing.T) {
    	DB.Migrator().DropTable(&Product3{})
    	DB.AutoMigrate(&Product3{})
    
    	product := Product3{Name: "Product", Price: 0}
    	DB.Create(&product)
    
    	if product.Price != 100 {
    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