Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for pluck_with_select_2 (0.08 sec)

  1. tests/query_test.go

    	}
    }
    
    func TestPluckWithSelect(t *testing.T) {
    	users := []User{
    		{Name: "pluck_with_select_1", Age: 25},
    		{Name: "pluck_with_select_2", Age: 26},
    	}
    
    	DB.Create(&users)
    
    	var userAges []int
    	err := DB.Model(&User{}).Where("name like ?", "pluck_with_select%").Select("age + 1 as user_age").Pluck("user_age", &userAges).Error
    	if err != nil {
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Mon Jun 24 09:42:59 UTC 2024
    - 50.4K bytes
    - Viewed (0)
Back to top