Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for Blank (0.46 sec)

  1. tests/update_test.go

    		t.Errorf("account number should not been changed, expects: %v, got %v", user.Account.Number, result.Account.Number)
    	}
    }
    
    func TestUpdatesWithBlankValues(t *testing.T) {
    	user := *GetUser("updates_with_blank_value", Config{})
    	DB.Save(&user)
    
    	var user2 User
    	user2.ID = user.ID
    	DB.Model(&user2).Updates(&User{Age: 100})
    
    	var result User
    	DB.First(&result, user.ID)
    
    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. tests/postgres_test.go

    		t.Fatalf("Failed to migrate for uuid default value, got error: %v", err)
    	}
    
    	harumph := Harumph{}
    	if err := DB.Create(&harumph).Error; err == nil {
    		t.Fatalf("should failed to create data, name can't be blank")
    	}
    
    	harumph = Harumph{Name: "jinzhu"}
    	if err := DB.Create(&harumph).Error; err != nil {
    		t.Fatalf("should be able to create data, but got %v", err)
    	}
    
    	var result Harumph
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Oct 08 09:16:32 GMT 2022
    - 6.4K bytes
    - Viewed (3)
  3. 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)
  4. tests/non_std_test.go

    		t.Errorf("Update a filed with a default value should occur. But got %v\n", animal.Name)
    	}
    
    	// When changing a field with a default value with blank value
    	animal.Name = ""
    	DB.Save(&animal)
    	DB.First(&animal, animal.Counter)
    	if animal.Name != "" {
    		t.Errorf("Update a filed to blank with a default value should occur. But got %v\n", animal.Name)
    	}
    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)
  5. schema/field.go

    		field.Precision, _ = strconv.Atoi(p)
    	}
    
    	if s, ok := field.TagSettings["SCALE"]; ok {
    		field.Scale, _ = strconv.Atoi(s)
    	}
    
    	// default value is function or null or blank (primary keys)
    	field.DefaultValue = strings.TrimSpace(field.DefaultValue)
    	skipParseDefaultValue := strings.Contains(field.DefaultValue, "(") &&
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 32K bytes
    - Viewed (1)
Back to top