Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 14 for Meleti (0.17 sec)

  1. tests/associations_has_many_test.go

    	// Delete
    	if err := DB.Model(&user2).Association("Pets").Delete(&Pet{}); err != nil {
    		t.Fatalf("Error happened when delete pet, got %v", err)
    	}
    	AssertAssociationCount(t, user2, "Pets", 1, "after delete non-existing data")
    
    	if err := DB.Model(&user2).Association("Pets").Delete(&pet2); err != nil {
    		t.Fatalf("Error happened when delete Pets, got %v", err)
    	}
    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/joins_test.go

    	}
    
    	// Account should empty
    	DB.Delete(&user1.Account)
    
    	var user2 User
    	DB.Model(&User{}).Joins("NamedPet").Joins("Account").First(&user2, user.ID)
    	if user2.NamedPet == nil || user2.Account.ID != 0 {
    		t.Fatalf("joins Account should not empty:%v", user2)
    	}
    
    	// NamedPet should empty
    	DB.Delete(&user1.NamedPet)
    
    	var user3 User
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 26 14:19:32 GMT 2023
    - 13.5K bytes
    - Viewed (1)
  3. tests/hooks_test.go

    	}
    
    	p3 := Product{Code: "dont_delete", Price: 100}
    	DB.Save(&p3)
    	if DB.Delete(&p3).Error == nil {
    		t.Fatalf("An error from before delete callbacks happened when delete")
    	}
    
    	if DB.Where("Code = ?", "dont_delete").First(&p3).Error != nil {
    		t.Fatalf("An error from before delete callbacks happened")
    	}
    
    	p4 := Product{Code: "after_save_error", Price: 100}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 15.9K bytes
    - Viewed (0)
  4. finisher_api.go

    	tx.Statement.SkipHooks = true
    	return tx.callbacks.Update().Execute(tx)
    }
    
    // Delete deletes value matching given conditions. If value contains primary key it is included in the conditions. If
    // value includes a deleted_at field, then Delete performs a soft delete instead by setting deleted_at with the current
    // time if null.
    func (db *DB) Delete(value interface{}, conds ...interface{}) (tx *DB) {
    	tx = db.getInstance()
    	if len(conds) > 0 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  5. callbacks/create.go

    	default:
    		var (
    			selectColumns, restricted = stmt.SelectAndOmitColumns(true, false)
    			_, updateTrackTime        = stmt.Get("gorm:update_track_time")
    			isZero                    bool
    		)
    		stmt.Settings.Delete("gorm:update_track_time")
    
    		values = clause.Values{Columns: make([]clause.Column, 0, len(stmt.Schema.DBNames))}
    
    		for _, db := range stmt.Schema.DBNames {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 12.5K bytes
    - Viewed (0)
  6. tests/transaction_test.go

    		// callMethod do
    		tx2 := tx1.Find(&User{}).Session(&gorm.Session{NewDB: true})
    		// trx in hooks
    		return tx2.Transaction(func(tx3 *gorm.DB) error {
    			return tx3.Where("user_id", user.ID).Delete(&Account{}).Error
    		})
    	})
    
    	if err != nil {
    		t.Error(err)
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  7. tests/multi_primary_keys_test.go

    	}
    
    	// Delete
    	DB.Model(&blog).Association("Tags").Delete(tag5)
    	var tags3 []Tag
    	DB.Model(&blog).Association("Tags").Find(&tags3)
    	if !compareTags(tags3, []string{"tag6"}) {
    		t.Fatalf("Should find 1 tags after Delete")
    	}
    
    	if DB.Model(&blog).Association("Tags").Count() != 1 {
    		t.Fatalf("Blog should has three tags after Delete")
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 12.8K bytes
    - Viewed (0)
  8. tests/preload_test.go

    	}
    	sort.Slice(users3, func(i, j int) bool {
    		return users2[i].ID < users2[j].ID
    	})
    
    	for i, u := range users3 {
    		CheckUser(t, u, users[i])
    	}
    
    	var user4 User
    	DB.Delete(&users3[0].Account)
    
    	if err := DB.Preload(clause.Associations).Take(&user4, "id = ?", users3[0].ID).Error; err != nil || user4.Account.ID != 0 {
    		t.Errorf("failed to query, got error %v, account: %#v", err, user4.Account)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 14.9K bytes
    - Viewed (0)
  9. tests/associations_many2many_test.go

    	// Delete
    	if err := DB.Model(&user2).Association("Languages").Delete(&Language{}); err != nil {
    		t.Fatalf("Error happened when delete language, got %v", err)
    	}
    	AssertAssociationCount(t, user2, "Languages", 1, "after delete non-existing data")
    
    	if err := DB.Model(&user2).Association("Languages").Delete(&language2); err != nil {
    		t.Fatalf("Error happened when delete Languages, got %v", err)
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 13.2K bytes
    - Viewed (0)
  10. tests/associations_test.go

    	var err error
    	// belongs to
    	err = DB.Model(&emptyUser).Association("Company").Delete(&user1.Company)
    	AssertEqual(t, err, gorm.ErrPrimaryKeyRequired)
    	// has many
    	err = DB.Model(&emptyUser).Association("Pets").Delete(&user1.Pets)
    	AssertEqual(t, err, gorm.ErrPrimaryKeyRequired)
    	// has one
    	err = DB.Model(&emptyUser).Association("Account").Delete(&user1.Account)
    	AssertEqual(t, err, gorm.ErrPrimaryKeyRequired)
    	// many to many
    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)
Back to top