Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 94 for Errorf (0.56 sec)

  1. tests/soft_delete_test.go

    		t.Errorf("Table with escape character, got %v", sql)
    	}
    
    	if DB.First(&User{}, "name = ?", user.Name).Error == nil {
    		t.Errorf("Can't find a soft deleted record")
    	}
    
    	count = 0
    	if DB.Model(&User{}).Where("name = ?", user.Name).Count(&count).Error != nil || count != 0 {
    		t.Errorf("Count soft deleted record, expects: %v, got: %v", 0, count)
    	}
    
    	age = 0
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed Feb 01 06:40:55 UTC 2023
    - 5.7K bytes
    - Viewed (0)
  2. tests/upsert_test.go

    	if err := DB.Save(&lang).Error; err != nil {
    		t.Errorf("Failed to create, got error %v", err)
    	}
    
    	var result Language
    	if err := DB.First(&result, "code = ?", lang.Code).Error; err != nil {
    		t.Errorf("Failed to query lang, got error %v", err)
    	} else {
    		AssertEqual(t, result, lang)
    	}
    
    	lang.Name += "_new"
    	if err := DB.Save(&lang).Error; err != nil {
    		t.Errorf("Failed to create, got error %v", err)
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Mon Sep 05 07:39:19 UTC 2022
    - 11.4K bytes
    - Viewed (0)
  3. tests/associations_belongs_to_test.go

    		t.Errorf("failed to find item parent, got error: %v", err)
    	}
    	if len(parents) != 1 {
    		t.Errorf("expected %d parents, got %d", 1, len(parents))
    	}
    
    	// test delete
    	if err := tx.Model(&item).Association("ItemParent").Unscoped().Delete(&parents); err != nil {
    		t.Errorf("failed to delete item parent, got error: %v", err)
    	}
    	if err := tx.Find(&parents).Error; err != nil {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Mon Oct 30 09:15:49 UTC 2023
    - 9.3K bytes
    - Viewed (0)
  4. tests/non_std_test.go

    	DB.First(&animal, animal.Counter)
    	if animal.Name != "amazing horse" {
    		t.Errorf("Update a filed with a default value should occur. But got %v\n", animal.Name)
    	}
    
    	// When changing a field with a default value with blank value
    	animal.Name = ""
    	DB.Save(&animal)
    	DB.First(&animal, animal.Counter)
    	if animal.Name != "" {
    		t.Errorf("Update a filed to blank with a default value should occur. But got %v\n", animal.Name)
    	}
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed May 08 04:07:58 UTC 2024
    - 1.9K bytes
    - Viewed (0)
  5. tests/sql_builder_test.go

    	if err != nil {
    		t.Errorf("Not error should happen, got %v", err)
    	}
    
    	count := 0
    	for rows.Next() {
    		var name string
    		var age int64
    		rows.Scan(&name, &age)
    		count++
    	}
    
    	if count != 2 {
    		t.Errorf("Should found two records")
    	}
    }
    
    func TestRaw(t *testing.T) {
    	user1 := User{Name: "ExecRawSqlUser1", Age: 1}
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Fri Jan 12 08:42:21 UTC 2024
    - 16.7K bytes
    - Viewed (0)
  6. statement_test.go

    				Exprs: s.BuildCondition("FINAL2"),
    			})
    
    			if reflect.DeepEqual(s1.Clauses["WHERE"], s2.Clauses["WHERE"]) {
    				t.Errorf("Where conditions should be different")
    			}
    		})
    	}
    }
    
    func TestNilCondition(t *testing.T) {
    	s := new(Statement)
    	if len(s.BuildCondition(nil)) != 0 {
    		t.Errorf("Nil condition should be empty")
    	}
    }
    
    func TestNameMatcher(t *testing.T) {
    	for k, v := range map[string][]string{
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Sat Dec 23 13:19:41 UTC 2023
    - 1.9K bytes
    - Viewed (0)
  7. schema/relationship.go

    	}
    
    	if relation.Polymorphic.PolymorphicType == nil {
    		schema.err = fmt.Errorf("invalid polymorphic type %v for %v on field %s, missing field %s",
    			relation.FieldSchema, schema, field.Name, polymorphic+"Type")
    	}
    
    	if relation.Polymorphic.PolymorphicID == nil {
    		schema.err = fmt.Errorf("invalid polymorphic type %v for %v on field %s, missing field %s",
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed Jun 12 03:46:59 UTC 2024
    - 22.7K bytes
    - Viewed (0)
  8. tests/main_test.go

    	if DB.Where("sdsd.zaaa = ?", "sd;;;aa").Pluck("aaa", &columns).Error == nil {
    		t.Errorf("Should got error with invalid SQL")
    	}
    
    	if DB.Model(&User{}).Where("sdsd.zaaa = ?", "sd;;;aa").Pluck("aaa", &columns).Error == nil {
    		t.Errorf("Should got error with invalid SQL")
    	}
    
    	if DB.Where("sdsd.zaaa = ?", "sd;;;aa").Find(&User{}).Error == nil {
    		t.Errorf("Should got error with invalid SQL")
    	}
    
    	var count1, count2 int64
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Thu Mar 24 01:31:58 UTC 2022
    - 1.4K bytes
    - Viewed (0)
  9. tests/hooks_test.go

    	if err := DB.Create(&product).Error; err == nil {
    		t.Errorf("should got failed to save, but error is nil")
    	}
    
    	if DB.First(&Product4{}, "name = ?", product.Name).Error == nil {
    		t.Errorf("should got RecordNotFound, but got nil")
    	}
    
    	product = Product4{Name: "Product-2", Price: 100, Item: ProductItem{Code: "valid"}}
    	if err := DB.Create(&product).Error; err != nil {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Sat Feb 18 01:20:29 UTC 2023
    - 15.9K bytes
    - Viewed (0)
  10. tests/named_argument_test.go

    		t.Errorf("should return record not found error, but got %v", err)
    	}
    
    	DB.Delete(&namedUser)
    
    	var result8 NamedUser
    	if err := DB.Where("name1 = @name OR name2 = @name", map[string]interface{}{"name": "jinzhu-new"}).First(&result8).Error; err == nil || !errors.Is(err, gorm.ErrRecordNotFound) {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Tue Dec 21 11:50:00 UTC 2021
    - 2.7K bytes
    - Viewed (0)
Back to top