Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 277 for udpate (0.19 sec)

  1. clause/update.go

    package clause
    
    type Update struct {
    	Modifier string
    	Table    Table
    }
    
    // Name update clause name
    func (update Update) Name() string {
    	return "UPDATE"
    }
    
    // Build build update clause
    func (update Update) Build(builder Builder) {
    	if update.Modifier != "" {
    		builder.WriteString(update.Modifier)
    		builder.WriteByte(' ')
    	}
    
    	if update.Table.Name == "" {
    		builder.WriteQuoted(currentTable)
    	} else {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Mar 09 09:07:00 GMT 2020
    - 737 bytes
    - Viewed (0)
  2. callbacks/update.go

    				if i, ok := value.(BeforeUpdateInterface); ok {
    					called = true
    					db.AddError(i.BeforeUpdate(tx))
    				}
    			}
    
    			return called
    		})
    	}
    }
    
    // Update update hook
    func Update(config *Config) func(db *gorm.DB) {
    	supportReturning := utils.Contains(config.UpdateClauses, "RETURNING")
    
    	return func(db *gorm.DB) {
    		if db.Error != nil {
    			return
    		}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 05:44:55 GMT 2024
    - 9.4K bytes
    - Viewed (1)
  3. tests/update_test.go

    	users := []*User{
    		GetUser("update_column_01", Config{}),
    		GetUser("update_column_02", Config{}),
    	}
    
    	DB.Create(&users)
    	lastUpdatedAt := users[1].UpdatedAt
    
    	// update with map
    	DB.Model(users[1]).UpdateColumns(map[string]interface{}{"name": "update_column_02_newname", "age": 100})
    	if users[1].Name != "update_column_02_newname" || users[1].Age != 100 {
    		t.Errorf("user 2 should be updated with update column")
    	}
    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/sql_builder_test.go

    	// updates
    	user = &User{Name: "bar", Age: 22}
    	user.CreatedAt = date
    	user.UpdatedAt = date
    	sql = DB.ToSQL(func(tx *gorm.DB) *gorm.DB {
    		return tx.Model(&User{}).Where("id = ?", 100).Updates(user)
    	})
    	assertEqualSQL(t, `UPDATE "users" SET "created_at"='2021-10-18 00:00:00',"updated_at"='2021-10-18 19:50:09.438',"name"='bar',"age"=22 WHERE id = 100 AND "users"."deleted_at" IS NULL`, sql)
    
    	// update
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 16.7K bytes
    - Viewed (0)
  5. tests/update_has_many_test.go

    )
    
    func TestUpdateHasManyAssociations(t *testing.T) {
    	user := *GetUser("update-has-many", Config{})
    
    	if err := DB.Create(&user).Error; err != nil {
    		t.Fatalf("errors happened when create: %v", err)
    	}
    
    	user.Pets = []*Pet{{Name: "pet1"}, {Name: "pet2"}}
    	if err := DB.Save(&user).Error; err != nil {
    		t.Fatalf("errors happened when update: %v", err)
    	}
    
    	var user2 User
    	DB.Preload("Pets").Find(&user2, "id = ?", user.ID)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 2K bytes
    - Viewed (0)
  6. cmd/erasure.go

    					}
    				}
    				// Collect updates.
    				updates := make(chan dataUsageEntry, 1)
    				var wg sync.WaitGroup
    				wg.Add(1)
    				go func(name string) {
    					defer wg.Done()
    					for update := range updates {
    						select {
    						case <-ctx.Done():
    						case bucketResults <- dataUsageEntryInfo{
    							Name:   name,
    							Parent: dataUsageRoot,
    							Entry:  update,
    						}:
    						}
    					}
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Fri Apr 26 06:32:14 GMT 2024
    - 16K bytes
    - Viewed (1)
  7. 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)
  8. cmd/update_test.go

    	utcLoc, _ := time.LoadLocation("")
    	testCases := []struct {
    		t      time.Time
    		tag    string
    		errStr string
    	}{
    		{
    			time.Date(2017, time.September, 29, 19, 16, 56, 0, utcLoc),
    			"RELEASE.2017-09-29T19-16-56Z", "",
    		},
    		{
    			time.Date(2017, time.August, 5, 0, 0, 53, 0, utcLoc),
    			"RELEASE.2017-08-05T00-00-53Z", "",
    		},
    		{
    			time.Now().UTC(), "2017-09-29T19:16:56Z",
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Sat Mar 09 03:07:08 GMT 2024
    - 10.7K bytes
    - Viewed (0)
  9. tests/non_std_test.go

    	DB.Save(&animal)
    	updatedAt1 := animal.UpdatedAt
    
    	DB.Save(&animal).Update("name", "Francis")
    	if updatedAt1.Format(time.RFC3339Nano) == animal.UpdatedAt.Format(time.RFC3339Nano) {
    		t.Errorf("UpdatedAt should be updated")
    	}
    
    	var animals []Animal
    	DB.Find(&animals)
    	if count := DB.Model(Animal{}).Where("1=1").Update("CreatedAt", time.Now().Add(2*time.Hour)).RowsAffected; count != int64(len(animals)) {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.9K bytes
    - Viewed (0)
  10. cmd/metacache-bucket.go

    	}
    }
    
    // updateCacheEntry will update a cache.
    // Returns the updated status.
    func (b *bucketMetacache) updateCacheEntry(update metacache) (metacache, error) {
    	b.mu.Lock()
    	defer b.mu.Unlock()
    	existing, ok := b.caches[update.id]
    	if !ok {
    		return update, errFileNotFound
    	}
    	existing.update(update)
    	b.caches[update.id] = existing
    	b.updated = true
    	return existing, nil
    }
    
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 6.6K bytes
    - Viewed (0)
Back to top