Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 57 for Page (0.16 sec)

  1. tests/scan_test.go

    	doubleAgeRes := &result{}
    	if err := DB.Table("users").Select("age + age as age").Where("id = ?", user3.ID).Scan(&doubleAgeRes).Error; err != nil {
    		t.Errorf("Scan to pointer of pointer")
    	}
    
    	if doubleAgeRes.Age != int(res.Age)*2 {
    		t.Errorf("Scan double age as age, expect: %v, got %v", res.Age*2, doubleAgeRes.Age)
    	}
    
    	var results []result
    	DB.Table("users").Select("name, age").Where("id in ?", []uint{user2.ID, user3.ID}).Scan(&results)
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat May 28 14:18:07 GMT 2022
    - 8.2K bytes
    - Viewed (0)
  2. clause/where_test.go

    			}},
    			"SELECT * FROM `users` WHERE `age` = ? OR `name` <> ?",
    			[]interface{}{18, "jinzhu"},
    		},
    		{
    			[]clause.Interface{clause.Select{}, clause.From{}, clause.Where{
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Apr 25 12:22:53 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  3. tests/update_test.go

    	if err := DB.Model(&results[1]).Clauses(clause.Returning{Columns: []clause.Column{{Name: "age"}}}).Updates(map[string]interface{}{"age": gorm.Expr("age + ?", 100)}).Error; err != nil {
    		t.Errorf("Not error should happen when updating with gorm expr, but got %v", err)
    	}
    
    	if results[1].Age-results[0].Age != 100 {
    		t.Errorf("failed to return updated age column")
    	}
    }
    
    func TestUpdateWithDiffSchema(t *testing.T) {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Dec 04 03:50:58 GMT 2023
    - 30.3K bytes
    - Viewed (0)
  4. tests/scanner_valuer_test.go

    	}
    
    	AssertObjEqual(t, result, data, "Name", "Gender", "Age")
    
    	if err := DB.Where(data).Assign(ScannerValuerStruct{Age: sql.NullInt64{Int64: 18, Valid: true}}).FirstOrCreate(&result).Error; err != nil {
    		t.Errorf("Should not raise any error, but got %v", err)
    	}
    
    	if result.Age.Int64 != 18 {
    		t.Errorf("should update age to 18")
    	}
    
    	var result2 ScannerValuerStruct
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K bytes
    - Viewed (0)
  5. schema/index_test.go

    	Name4        string `gorm:"uniqueIndex"`
    	Name5        int64  `gorm:"index:,class:FULLTEXT,comment:hello \\, world,where:age > 10"`
    	Name6        int64  `gorm:"index:profile,comment:hello \\, world,where:age > 10"`
    	Age          int64  `gorm:"index:profile,expression:ABS(age),option:WITH PARSER parser_name"`
    	OID          int64  `gorm:"index:idx_id;index:idx_oid,unique"`
    	MemberNumber string `gorm:"index:idx_id,priority:1"`
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 8K bytes
    - Viewed (0)
  6. tests/helper_test.go

    		} else {
    			AssertObjEqual(t, newUser, user, "ID", "CreatedAt", "UpdatedAt", "DeletedAt", "Name", "Age", "Birthday",
    				"CompanyID", "ManagerID", "Active")
    		}
    	}
    
    	AssertObjEqual(t, user, expect, "ID", "CreatedAt", "UpdatedAt", "DeletedAt", "Name", "Age", "Birthday", "CompanyID",
    		"ManagerID", "Active")
    
    	t.Run("Account", func(t *testing.T) {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 8K bytes
    - Viewed (0)
  7. internal/s3select/select_benchmark_test.go

    		b[i] = charset[randSrc.Intn(len(charset))]
    	}
    	return string(b)
    }
    
    func genSampleCSVData(count int) []byte {
    	buf := &bytes.Buffer{}
    	csvWriter := csv.NewWriter(buf)
    	csvWriter.Write([]string{"id", "name", "age", "city"})
    
    	for i := 0; i < count; i++ {
    		csvWriter.Write([]string{
    			strconv.Itoa(i),
    			newRandString(10),
    			newRandString(5),
    			newRandString(10),
    		})
    	}
    
    	csvWriter.Flush()
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Thu Apr 14 13:54:47 GMT 2022
    - 5K bytes
    - Viewed (0)
  8. internal/s3select/sql/analysis.go

    // row. They have an output for each input row.
    //
    // Some types of a queries are not valid. For example, an aggregation
    // function combined with a row function is meaningless ("AVG(s.Age) +
    // s.Salary"). Analysis determines if such a scenario exists so an
    // error can be returned.
    
    var (
    	// Fatal error for query processing.
    	errNestedAggregation      = errors.New("Cannot nest aggregations")
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Sat Dec 23 07:19:11 GMT 2023
    - 8.5K bytes
    - Viewed (0)
  9. tests/upsert_test.go

    	}
    
    	DB.Where(&User{Name: "find or init"}).Assign("age", 44).FirstOrInit(&user4)
    	if user4.Name != "find or init" || user4.ID != 0 || user4.Age != 44 {
    		t.Errorf("user should be initialized with search value and assign attrs")
    	}
    
    	DB.Save(&User{Name: "find or init", Age: 33})
    	DB.Where(&User{Name: "find or init"}).Attrs("age", 44).FirstOrInit(&user5)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Sep 05 07:39:19 GMT 2022
    - 11.4K bytes
    - Viewed (0)
  10. tests/distinct_test.go

    	var results []User
    	if err := DB.Distinct("name", "age").Where("name like ?", "distinct%").Order("name, age desc").Find(&results).Error; err != nil {
    		t.Errorf("failed to query users, got error: %v", err)
    	}
    
    	expects := []User{
    		{Name: "distinct", Age: 20},
    		{Name: "distinct", Age: 18},
    		{Name: "distinct-2", Age: 18},
    		{Name: "distinct-3", Age: 18},
    	}
    
    	if len(results) != 4 {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 2.5K bytes
    - Viewed (0)
Back to top