Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 30 for Hafner (0.19 sec)

  1. tests/associations_has_one_test.go

    		t.Fatalf("Error happened when delete account, got %v", err)
    	}
    	AssertAssociationCount(t, user2, "Account", 1, "after delete non-existing data")
    
    	if err := DB.Model(&user2).Association("Account").Delete(&account2); err != nil {
    		t.Fatalf("Error happened when delete Account, got %v", err)
    	}
    	AssertAssociationCount(t, user2, "Account", 0, "after delete")
    
    	// Prepare Data for Clear
    	account = Account{Number: "account-has-one-append"}
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 6.8K bytes
    - Viewed (0)
  2. tests/transaction_test.go

    		t.Fatalf("Should return the underlying sql.Tx")
    	}
    
    	tx.Rollback()
    
    	if err := DB.First(&User{}, "name = ?", "transaction").Error; err == nil {
    		t.Fatalf("Should not find record after rollback, but got %v", err)
    	}
    
    	txDB := DB.Where("fake_name = ?", "fake_name")
    	tx2 := txDB.Session(&gorm.Session{NewDB: true}).Begin()
    	user2 := *GetUser("transaction-2", Config{})
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  3. tests/update_test.go

    		t.Fatalf("user's updated at should be changed after reload, expects: %+v, got: %+v", user1UpdatedAt, result.UpdatedAt)
    	}
    
    	DB.First(&user2)
    	if user2UpdatedAt.Format(time.RFC1123Z) == user2.UpdatedAt.Format(time.RFC1123Z) {
    		t.Fatalf("user2's updated at should be changed after reload, expects: %+v, got: %+v", user2UpdatedAt, user2.UpdatedAt)
    	}
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Dec 04 03:50:58 GMT 2023
    - 30.3K bytes
    - Viewed (0)
  4. tests/scanner_valuer_test.go

    		ExampleStructPtr: &ExampleStruct{"name", "value2"},
    	}
    
    	var result ScannerValuerStruct
    	tx := DB.Where(data).FirstOrCreate(&result)
    
    	if tx.RowsAffected != 1 {
    		t.Errorf("RowsAffected should be 1 after create some record")
    	}
    
    	if tx.Error != nil {
    		t.Errorf("Should not raise any error, but got %v", tx.Error)
    	}
    
    	AssertObjEqual(t, result, data, "Name", "Gender", "Age")
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K bytes
    - Viewed (0)
  5. tests/multi_primary_keys_test.go

    		t.Fatalf("Blog should has three tags after Append")
    	}
    
    	if DB.Model(&blog).Association("SharedTags").Count() != 3 {
    		t.Fatalf("Blog should has three tags after Append")
    	}
    
    	if DB.Model(&blog2).Association("SharedTags").Count() != 3 {
    		t.Fatalf("Blog should has three tags after Append")
    	}
    
    	var tags []Tag
    	DB.Model(&blog).Association("SharedTags").Find(&tags)
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 12.8K bytes
    - Viewed (0)
  6. tests/associations_belongs_to_test.go

    	}
    
    	AssertAssociationCount(t, users, "Company", 2, "After Delete")
    
    	// Clear
    	DB.Model(&users).Association("Company").Clear()
    	AssertAssociationCount(t, users, "Company", 0, "After Clear")
    
    	DB.Model(&users).Association("Manager").Clear()
    	AssertAssociationCount(t, users, "Manager", 0, "After Clear")
    
    	// shared company
    	company := Company{Name: "shared"}
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 9.3K bytes
    - Viewed (0)
  7. callbacks/callbacks.go

    	createCallback.Register("gorm:save_before_associations", SaveBeforeAssociations(true))
    	createCallback.Register("gorm:create", Create(config))
    	createCallback.Register("gorm:save_after_associations", SaveAfterAssociations(true))
    	createCallback.Register("gorm:after_create", AfterCreate)
    	createCallback.Match(enableTransaction).Register("gorm:commit_or_rollback_transaction", CommitOrRollbackTransaction)
    	createCallback.Clauses = config.CreateClauses
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Wed Oct 27 23:56:55 GMT 2021
    - 3.3K bytes
    - Viewed (0)
  8. tests/named_polymorphic_test.go

    	}
    
    	if DB.Model(&hamster2).Association("PreferredToy").Count() != 1 {
    		t.Errorf("Hamster's toys count should be 1 after Append")
    	}
    
    	if DB.Model(&hamster2).Association("OtherToy").Count() != 1 {
    		t.Errorf("Hamster's toys count should be 1 after Append")
    	}
    
    	// Replace
    	DB.Model(&hamster).Association("PreferredToy").Replace(&Toy{
    		Name: "bike 3",
    	})
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Wed Jul 08 09:59:40 GMT 2020
    - 4.2K bytes
    - Viewed (0)
  9. tests/delete_test.go

    		t.Errorf("User can't be found after delete")
    	}
    
    	if err := DB.Delete(&User{}, "name = ?", user2.Name).Error; err != nil {
    		t.Errorf("No error should happen when delete a record, err=%s", err)
    	} else if err := DB.Where("name = ?", user2.Name).First(&User{}).Error; !errors.Is(err, gorm.ErrRecordNotFound) {
    		t.Errorf("User can't be found after delete")
    	}
    }
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Tue Oct 10 07:03:34 GMT 2023
    - 9.4K bytes
    - Viewed (0)
  10. README.md

    ## Overview
    
    * Full-Featured ORM
    * Associations (Has One, Has Many, Belongs To, Many To Many, Polymorphism, Single-table inheritance)
    * Hooks (Before/After Create/Save/Update/Delete/Find)
    * Eager loading with `Preload`, `Joins`
    * Transactions, Nested Transactions, Save Point, RollbackTo to Saved Point
    * Context, Prepared Statement Mode, DryRun Mode
    Plain Text
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Tue Nov 07 02:20:06 GMT 2023
    - 1.8K bytes
    - Viewed (0)
Back to top