Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for 50 (0.11 sec)

  1. tests/associations_has_many_test.go

    	type ItemContent struct {
    		gorm.Model
    		ItemID       uint   `gorm:"not null"`
    		Name         string `gorm:"not null;type:varchar(50)"`
    		LanguageCode string `gorm:"not null;type:varchar(2)"`
    	}
    	type Item struct {
    		gorm.Model
    		Logo     string        `gorm:"not null;type:varchar(50)"`
    		Contents []ItemContent `gorm:"foreignKey:ItemID"`
    	}
    
    	tx := DB.Session(&gorm.Session{})
    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)
  2. tests/update_test.go

    	}
    
    	if users[1].Age != 19 {
    		t.Errorf("user 2's name should be updated, but got %v", users[1].Age)
    	}
    
    	DB.Model(users[1]).UpdateColumn("age", gorm.Expr("age + 100 - 50"))
    	var user3 User
    	DB.First(&user3, users[1].ID)
    
    	users[1].Age += 50
    	CheckUser(t, user3, *users[1])
    
    	// update with struct
    	DB.Model(users[1]).UpdateColumns(User{Name: "update_column_02_newnew2", Age: 200})
    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)
  3. tests/sql_builder_test.go

    	// update
    	sql = DB.ToSQL(func(tx *gorm.DB) *gorm.DB {
    		return tx.Model(&User{}).Where("id = ?", 100).Update("name", "Foo bar")
    	})
    	assertEqualSQL(t, `UPDATE "users" SET "name"='Foo bar',"updated_at"='2021-10-18 19:50:09.438' WHERE id = 100 AND "users"."deleted_at" IS NULL`, sql)
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 16.7K bytes
    - Viewed (0)
Back to top