Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 17 for Equals (0.08 sec)

  1. tests/soft_delete_test.go

    	}
    
    	if err := DB.Delete(&book).Error; err != nil {
    		t.Fatalf("No error should happen when soft delete user, but got %v", err)
    	}
    
    	zeroTime, _ := now.Parse("1970-01-01 00:00:01")
    	if book.DeletedAt.Time.Equal(zeroTime) {
    		t.Errorf("book's deleted at should not be zero, DeletedAt: %v", book.DeletedAt)
    	}
    
    	if DB.First(&SoftDeleteBook{}, "name = ?", book.Name).Error == nil {
    		t.Errorf("Can't find a soft deleted record")
    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/associations_belongs_to_test.go

    	}
    
    	if users[0].CompanyID == nil || users[1].CompanyID == nil || *users[0].CompanyID != *users[1].CompanyID {
    		t.Errorf("user's company id should exists and equal, but its: %v, %v", users[0].CompanyID, users[1].CompanyID)
    	}
    
    	DB.Model(&users[0]).Association("Company").Delete(&company)
    	AssertAssociationCount(t, users[0], "Company", 0, "After Delete")
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Mon Oct 30 09:15:49 UTC 2023
    - 9.3K bytes
    - Viewed (0)
  3. tests/sql_builder_test.go

    			Columns: []clause.OrderByColumn{{Column: clause.Column{Name: "id", Raw: true}, Desc: true}},
    		})
    	})
    	assertEqualSQL(t, `SELECT * FROM users ORDER BY id DESC`, sql)
    }
    
    // assertEqualSQL for assert that the sql is equal, this method will ignore quote, and dialect specials.
    func assertEqualSQL(t *testing.T, expected string, actually string) {
    	t.Helper()
    
    	// replace SQL quote, convert into postgresql like ""
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Fri Jan 12 08:42:21 UTC 2024
    - 16.7K bytes
    - Viewed (0)
  4. utils/utils_test.go

    		out      bool
    	}{
    		{"error equal", errors.New("1"), errors.New("1"), true},
    		{"error not equal", errors.New("1"), errors.New("2"), false},
    		{"driver.Valuer equal", ModifyAt{Time: now, Valid: true}, ModifyAt{Time: now, Valid: true}, true},
    		{"driver.Valuer not equal", ModifyAt{Time: now, Valid: true}, ModifyAt{Time: now.Add(time.Second), Valid: true}, false},
    		{"driver.Valuer equal (ptr to nil ptr)", (*ModifyAt)(nil), &ModifyAt{}, false},
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Mon Feb 19 03:42:25 UTC 2024
    - 3.6K bytes
    - Viewed (0)
  5. tests/helper_test.go

    			if pet == nil || expect.Pets[idx] == nil {
    				t.Errorf("pets#%v should equal, expect: %v, got %v", idx, expect.Pets[idx], pet)
    			} else {
    				doCheckPet(t, *pet, *expect.Pets[idx], unscoped)
    			}
    		}
    	})
    
    	t.Run("Toys", func(t *testing.T) {
    		if len(user.Toys) != len(expect.Toys) {
    			t.Fatalf("toys should equal, expect: %v, got %v", len(expect.Toys), len(user.Toys))
    		}
    
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Tue Mar 19 03:50:28 UTC 2024
    - 8K bytes
    - Viewed (0)
  6. schema/constraint_test.go

    		}
    
    		for _, name := range []string{"Name", "Constraint"} {
    			if reflect.ValueOf(result).FieldByName(name).Interface() != reflect.ValueOf(v).FieldByName(name).Interface() {
    				t.Errorf(
    					"check %v %v should equal, expects %v, got %v",
    					k, name, reflect.ValueOf(result).FieldByName(name).Interface(), reflect.ValueOf(v).FieldByName(name).Interface(),
    				)
    			}
    		}
    	}
    }
    
    func TestParseUniqueConstraints(t *testing.T) {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Sun Feb 04 07:49:19 UTC 2024
    - 2.2K bytes
    - Viewed (0)
  7. chainable_api.go

    //	db.Where("name = ?", "jinzhu").First(&user)
    //	// Find the first user with name jinzhu and age 20
    //	db.Where(&User{Name: "jinzhu", Age: 20}).First(&user)
    //	// Find the first user with name jinzhu and age not equal to 20
    //	db.Where("name = ?", "jinzhu").Where("age <> ?", "20").First(&user)
    //
    // [docs]: https://gorm.io/docs/query.html#Conditions
    func (db *DB) Where(query interface{}, args ...interface{}) (tx *DB) {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed Jun 12 09:47:34 UTC 2024
    - 14.5K bytes
    - Viewed (0)
  8. migrator/migrator.go

    	if !isSameType {
    		// check size
    		if length, ok := columnType.Length(); length != int64(field.Size) {
    			if length > 0 && field.Size > 0 {
    				alterColumn = true
    			} else {
    				// has size in data type and not equal
    				// Since the following code is frequently called in the for loop, reg optimization is needed here
    				matches2 := regFullDataType.FindAllStringSubmatch(fullDataType, -1)
    				if !field.PrimaryKey &&
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Fri Apr 26 07:15:49 UTC 2024
    - 29K bytes
    - Viewed (0)
  9. tests/query_test.go

    	var qs []QueryResetNullValue
    	err = DB.Joins("Item1").Joins("Item2").Find(&qs).Error
    	if err != nil {
    		t.Errorf("failed to find:%v", err)
    	}
    
    	if len(qs) != 2 {
    		t.Fatalf("find count not equal:%d", len(qs))
    	}
    
    	AssertEqual(t, q1, qs[0])
    	AssertEqual(t, q2, qs[1])
    }
    
    func TestQueryError(t *testing.T) {
    	type P struct{}
    	var p1 P
    	err := DB.Take(&p1, 1).Error
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed May 08 04:07:58 UTC 2024
    - 49.8K bytes
    - Viewed (0)
  10. clause/expression_test.go

    			if stmt.SQL.String() != result.Result {
    				t.Errorf("generated SQL is not equal, expects %v, but got %v", result.Result, stmt.SQL.String())
    			}
    
    			if !reflect.DeepEqual(result.ExpectedVars, stmt.Vars) {
    				t.Errorf("generated vars is not equal, expects %v, but got %v", result.ExpectedVars, stmt.Vars)
    			}
    		})
    	}
    }
    
    func TestExpression(t *testing.T) {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Thu Aug 10 05:34:33 UTC 2023
    - 8.4K bytes
    - Viewed (0)
Back to top