Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 55 for Updated (0.86 sec)

  1. tests/update_test.go

    	users := []*User{
    		GetUser("updates_01", Config{}),
    		GetUser("updates_02", Config{}),
    	}
    
    	DB.Create(&users)
    	lastUpdatedAt := users[0].UpdatedAt
    
    	// update with map
    	if res := DB.Model(users[0]).Updates(map[string]interface{}{"name": "updates_01_newname", "age": 100}); res.Error != nil || res.RowsAffected != 1 {
    		t.Errorf("Failed to update users")
    	}
    
    	if users[0].Name != "updates_01_newname" || users[0].Age != 100 {
    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)
  2. .github/workflows/invalid_question.yml

            stale-issue-label: "status:stale"
            days-before-stale: 0
            days-before-close: 30
            remove-stale-when-updated: true
    Others
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Apr 11 02:27:05 GMT 2023
    - 1.2K bytes
    - Viewed (0)
  3. schema/field_test.go

    	ID    uint
    	Name  string `gorm:"-"`
    	Name2 string `gorm:"->"`
    	Name3 string `gorm:"<-"`
    	Name4 string `gorm:"<-:create"`
    	Name5 string `gorm:"<-:update"`
    	Name6 string `gorm:"<-:create,update"`
    	Name7 string `gorm:"->:false;<-:create,update"`
    	Name8 string `gorm:"->;-:migration"`
    }
    
    func TestParseFieldWithPermission(t *testing.T) {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Feb 19 09:02:53 GMT 2022
    - 12.7K bytes
    - Viewed (0)
  4. tests/upsert_test.go

    	if user6.Name != "find or create" || user6.ID == 0 || user6.Age != 44 {
    		t.Errorf("user should be found and updated with assigned attrs")
    	}
    
    	DB.Where(&User{Name: "find or create"}).Find(&user7)
    	if user7.Name != "find or create" || user7.ID == 0 || user7.Age != 44 {
    		t.Errorf("user should be found and updated with assigned attrs")
    	}
    
    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)
  5. 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 Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 15.9K bytes
    - Viewed (0)
  6. 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 Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Sep 11 09:33:31 GMT 2020
    - 6.9K bytes
    - Viewed (0)
  7. tests/associations_belongs_to_test.go

    		t.Fatalf("failed to create items, got error: %v", err)
    	}
    
    	// test replace
    	if err := tx.Model(&item).Association("ItemParent").Unscoped().Replace(&ItemParent{
    		Logo: "updated logo",
    	}); err != nil {
    		t.Errorf("failed to replace item parent, got error: %v", err)
    	}
    
    	var parents []ItemParent
    	if err := tx.Find(&parents).Error; err != nil {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 9.3K bytes
    - Viewed (0)
  8. tests/update_many2many_test.go

    	if err := DB.Save(&user).Error; err != nil {
    		t.Fatalf("errors happened when update: %v", err)
    	}
    
    	var user3 User
    	DB.Preload("Languages").Preload("Friends").Find(&user3, "id = ?", user.ID)
    	CheckUser(t, user2, user3)
    
    	if err := DB.Session(&gorm.Session{FullSaveAssociations: true}).Save(&user).Error; err != nil {
    		t.Fatalf("errors happened when update: %v", err)
    	}
    
    	var user4 User
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.3K bytes
    - Viewed (0)
  9. 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 Apr 28 09:35:09 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  10. schema/schema_test.go

    		{Name: "CreatedAt", DBName: "created_at", BindNames: []string{"Model", "CreatedAt"}, DataType: schema.Time},
    		{Name: "UpdatedAt", DBName: "updated_at", BindNames: []string{"Model", "UpdatedAt"}, DataType: schema.Time},
    		{Name: "DeletedAt", DBName: "deleted_at", BindNames: []string{"Model", "DeletedAt"}, Tag: `gorm:"index"`, DataType: schema.Time},
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 12.9K bytes
    - Viewed (0)
Back to top