Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for TestSaveWithHooks (0.09 sec)

  1. tests/update_test.go

    	UserID  int    `gorm:"primary_key"`
    	Content string `gorm:"type:varchar(100)"`
    }
    
    func (t *Token) BeforeSave(tx *gorm.DB) error {
    	t.Content += "_encrypted"
    	return nil
    }
    
    func TestSaveWithHooks(t *testing.T) {
    	DB.Migrator().DropTable(&Token{}, &TokenOwner{})
    	DB.AutoMigrate(&Token{}, &TokenOwner{})
    
    	saveTokenOwner := func(owner *TokenOwner) (*TokenOwner, error) {
    		var newOwner TokenOwner
    Registered: Sun Oct 27 09:35:08 UTC 2024
    - Last Modified: Mon Dec 04 03:50:58 UTC 2023
    - 30.3K bytes
    - Viewed (0)
Back to top