Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 58 for updated (0.36 sec)

  1. tests/update_has_one_test.go

    	if lastUpdatedAt.Format(time.RFC3339) == user4.Account.UpdatedAt.Format(time.RFC3339) {
    		t.Fatalf("updated at should be updated, but not, old: %v, new %v", lastUpdatedAt.Format(time.RFC3339), user3.Account.UpdatedAt.Format(time.RFC3339))
    	} else {
    		user.Account.UpdatedAt = user4.Account.UpdatedAt
    		CheckUser(t, user4, user)
    	}
    
    	t.Run("Polymorphic", func(t *testing.T) {
    		pet := Pet{Name: "create"}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jul 14 06:55:54 GMT 2022
    - 3.6K bytes
    - Viewed (0)
  2. tests/connpool_test.go

    		expect: []string{
    			"SELECT VERSION()",
    			"INSERT INTO `users` (`created_at`,`updated_at`,`deleted_at`,`name`,`age`,`birthday`,`company_id`,`manager_id`,`active`) VALUES (?,?,?,?,?,?,?,?,?)",
    			"SELECT * FROM `users` WHERE name = ? AND `users`.`deleted_at` IS NULL ORDER BY `users`.`id` LIMIT ?",
    			"INSERT INTO `users` (`created_at`,`updated_at`,`deleted_at`,`name`,`age`,`birthday`,`company_id`,`manager_id`,`active`) VALUES (?,?,?,?,?,?,?,?,?)",
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Feb 06 02:54:40 GMT 2024
    - 5.5K bytes
    - Viewed (0)
  3. tests/upsert_test.go

    		t.Fatalf("failed to onconflict create user, got error %v", err)
    	} else {
    		var user3 User
    		DB.First(&user3, user.ID)
    		if user3.UpdatedAt.UnixNano() == user2.UpdatedAt.UnixNano() {
    			t.Fatalf("failed to update user's updated_at, old: %v, new: %v", user2.UpdatedAt, user3.UpdatedAt)
    		}
    	}
    }
    
    func TestUpsertSlice(t *testing.T) {
    	langs := []Language{
    		{Code: "upsert-slice1", Name: "Upsert-slice1"},
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Sep 05 07:39:19 GMT 2022
    - 11.4K bytes
    - Viewed (0)
  4. tests/customize_field_test.go

    		t.Fatalf("invalid create/update unix nano time: %#v", result)
    	}
    
    	result.FieldAllowUpdate = "field_allow_update_updated"
    	result.FieldReadonly = "field_readonly_updated"
    	result.FieldIgnore = "field_ignore_updated"
    	DB.Save(&result)
    
    	var result2 CustomizeFieldStruct
    	DB.Find(&result2, "name = ?", "create")
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Sep 11 09:33:31 GMT 2020
    - 6.9K bytes
    - Viewed (0)
  5. tests/associations_has_many_test.go

    		t.Fatalf("failed to create items, got error: %v", err)
    	}
    
    	// test Replace
    	if err := tx.Model(&item).Association("Contents").Unscoped().Replace([]ItemContent{
    		{Name: "updated name", LanguageCode: "en"},
    		{Name: "ar updated name", LanguageCode: "ar"},
    		{Name: "le nom", LanguageCode: "fr"},
    	}); err != nil {
    		t.Errorf("failed to replace item content, got error: %v", err)
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 15.6K bytes
    - Viewed (0)
  6. tests/update_test.go

    	if utils.AssertEqual(result.UpdatedAt, user.UpdatedAt) {
    		t.Fatalf("Update struct should update UpdatedAt, was %+v, got %+v", result.UpdatedAt, user.UpdatedAt)
    	}
    
    	AssertObjEqual(t, result, User{Name: "update_with_select"}, "Name", "Age")
    }
    
    func TestSelectWithUpdateWithMap(t *testing.T) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Dec 04 03:50:58 GMT 2023
    - 30.3K bytes
    - Viewed (0)
  7. tests/hooks_test.go

    	}
    
    	p2 := Product{Code: "update_callback", Price: 100}
    	DB.Save(&p2)
    
    	p2.Code = "dont_update"
    	if DB.Save(&p2).Error == nil {
    		t.Fatalf("An error from before update callbacks happened when update with invalid value")
    	}
    
    	if DB.Where("code = ?", "update_callback").First(&Product{}).Error != nil {
    		t.Fatalf("Record Should not be updated due to errors happened in before update callback")
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 15.9K bytes
    - Viewed (0)
  8. tests/create_test.go

    	curTime := now.MustParse("2016-01-01")
    	user.CreatedAt = curTime
    	user.UpdatedAt = curTime
    	DB.Save(&user)
    
    	AssertEqual(t, user.CreatedAt, curTime)
    	AssertEqual(t, user.UpdatedAt, curTime)
    
    	var newUser User
    	DB.First(&newUser, user.ID)
    
    	AssertEqual(t, newUser.CreatedAt, curTime)
    	AssertEqual(t, newUser.UpdatedAt, curTime)
    }
    
    func TestCreateWithNowFuncOverride(t *testing.T) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 26.4K bytes
    - Viewed (0)
  9. tests/table_test.go

    }
    
    func TestTableWithAllFields(t *testing.T) {
    	dryDB := DB.Session(&gorm.Session{DryRun: true, QueryFields: true})
    	userQuery := "SELECT .*user.*id.*user.*created_at.*user.*updated_at.*user.*deleted_at.*user.*name.*user.*age" +
    		".*user.*birthday.*user.*company_id.*user.*manager_id.*user.*active.* "
    
    	r := dryDB.Table("`user`").Find(&User{}).Statement
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Mar 09 09:31:28 GMT 2024
    - 10.6K bytes
    - Viewed (0)
  10. chainable_api.go

    	"gorm.io/gorm/utils"
    )
    
    // Model specify the model you would like to run db operations
    //
    //	// update all users's name to `hello`
    //	db.Model(&User{}).Update("name", "hello")
    //	// if user's primary key is non-blank, will use it as condition, then will only update that user's name to `hello`
    //	db.Model(&user).Update("name", "hello")
    func (db *DB) Model(value interface{}) (tx *DB) {
    	tx = db.getInstance()
    	tx.Statement.Model = value
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
Back to top