Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 55 for udpate (0.2 sec)

  1. tests/delete_test.go

    	}
    
    	if err := DB.Session(&gorm.Session{AllowGlobalUpdate: true}).Delete(&User{}).Error; err != nil {
    		t.Errorf("should returns no error while enable global update, but got err %v", err)
    	}
    }
    
    func TestDeleteWithAssociations(t *testing.T) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Oct 10 07:03:34 GMT 2023
    - 9.4K bytes
    - Viewed (0)
  2. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 12.9K bytes
    - Viewed (0)
  3. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 09 09:07:00 GMT 2020
    - 737 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 May 05 09:35:13 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 May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 2K bytes
    - Viewed (0)
  6. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.9K bytes
    - Viewed (0)
  7. tests/associations_test.go

    	parent.FavChild = &child
    	DB.Save(&parent)
    
    	var parent1 Parent
    	DB.First(&parent1, parent.ID)
    	AssertObjEqual(t, parent, parent1, "ID", "FavChildID")
    
    	// Save and Updates is the same
    	DB.Updates(&parent)
    	DB.First(&parent1, parent.ID)
    	AssertObjEqual(t, parent, parent1, "ID", "FavChildID")
    }
    
    func TestSaveHasManyCircularReference(t *testing.T) {
    	parent := Parent{}
    	DB.Create(&parent)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Feb 08 08:29:09 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  8. tests/query_test.go

    	}
    }
    
    func TestScanNullValue(t *testing.T) {
    	user := GetUser("scan_null_value", Config{})
    	DB.Create(&user)
    
    	if err := DB.Model(&user).Update("age", nil).Error; err != nil {
    		t.Fatalf("failed to update column age for struct, got error %v", err)
    	}
    
    	var result User
    	if err := DB.First(&result, "id = ?", user.ID).Error; err != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:22:53 GMT 2024
    - 49.8K bytes
    - Viewed (0)
  9. clause/locking_test.go

    			"SELECT * FROM `users` FOR UPDATE NOWAIT", nil,
    		},
    		{
    			[]clause.Interface{clause.Select{}, clause.From{}, clause.Locking{Strength: clause.LockingStrengthUpdate, Options: clause.LockingOptionsSkipLocked}},
    			"SELECT * FROM `users` FOR UPDATE SKIP LOCKED", nil,
    		},
    	}
    
    	for idx, result := range results {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:32:56 GMT 2023
    - 1.2K bytes
    - Viewed (0)
  10. gorm.go

    	"gorm.io/gorm/schema"
    )
    
    // for Config.cacheStore store PreparedStmtDB key
    const preparedStmtDBKey = "preparedStmt"
    
    // Config GORM config
    type Config struct {
    	// GORM perform single create, update, delete operations in transactions by default to ensure database data integrity
    	// You can disable it by setting `SkipDefaultTransaction` to true
    	SkipDefaultTransaction bool
    	// NamingStrategy tables, columns naming strategy
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Aug 20 11:46:56 GMT 2023
    - 11.6K bytes
    - Viewed (0)
Back to top