Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for UpdateColumns (0.18 sec)

  1. association.go

    				}
    
    				for _, ref := range rel.References {
    					updateMap[ref.ForeignKey.DBName] = nil
    				}
    
    				association.Error = association.DB.UpdateColumns(updateMap).Error
    			}
    			if association.Unscope && oldBelongsToExpr != nil {
    				association.Error = association.DB.Model(nil).Where(oldBelongsToExpr).Delete(reflect.New(rel.FieldSchema.ModelType).Interface()).Error
    			}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu May 04 11:30:45 GMT 2023
    - 21.2K bytes
    - Viewed (0)
  2. tests/sql_builder_test.go

    	})
    	assertEqualSQL(t, `UPDATE "users" SET "name"='Foo bar' WHERE id = 100 AND "users"."deleted_at" IS NULL`, sql)
    
    	// UpdateColumns
    	sql = DB.ToSQL(func(tx *gorm.DB) *gorm.DB {
    		return tx.Model(&User{}).Where("id = ?", 100).UpdateColumns(User{Name: "Foo", Age: 100})
    	})
    	assertEqualSQL(t, `UPDATE "users" SET "name"='Foo',"age"=100 WHERE id = 100 AND "users"."deleted_at" IS NULL`, sql)
    
    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)
  3. tests/update_test.go

    		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/hooks_test.go

    	if product.Name != "Product New4" || product.Price != 320 || product.Code != "" {
    		t.Errorf("invalid data after update, got %+v", product)
    	}
    
    	DB.Model(&product).UpdateColumns(Product3{Code: "L1215"})
    	if product.Price != 320 || product.Code != "L1215" {
    		t.Errorf("invalid data after update, got %+v", product)
    	}
    
    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)
  5. finisher_api.go

    	tx = db.getInstance()
    	tx.Statement.Dest = map[string]interface{}{column: value}
    	tx.Statement.SkipHooks = true
    	return tx.callbacks.Update().Execute(tx)
    }
    
    func (db *DB) UpdateColumns(values interface{}) (tx *DB) {
    	tx = db.getInstance()
    	tx.Statement.Dest = values
    	tx.Statement.SkipHooks = true
    	return tx.callbacks.Update().Execute(tx)
    }
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
Back to top