Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 14 for Hafner (0.2 sec)

  1. callbacks.go

    				}
    			} else if idx := getRIndex(names, c.after); idx != -1 {
    				// if after callback exists but haven't sorted
    				// set after callback's before callback to current callback
    				after := cs[idx]
    
    				if after.before == "" {
    					after.before = c.name
    				}
    
    				if err := sortCallback(after); err != nil {
    					return err
    				}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 26 03:33:36 GMT 2024
    - 8.6K bytes
    - Viewed (1)
  2. tests/connpool_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 May 05 09:35:13 GMT 2024
    - Last Modified: Tue Feb 06 02:54:40 GMT 2024
    - 5.5K bytes
    - Viewed (0)
  3. tests/count_test.go

    	}
    
    	tx := DB.Model(&User{}).Where("name = ?", user1.Name).Session(&gorm.Session{})
    	tx.Count(&count1)
    	tx.Or("name in ?", []string{user2.Name, user3.Name}).Count(&count2)
    	if count1 != 1 || count2 != 3 {
    		t.Errorf("count after new session should works")
    	}
    
    	var count3 int64
    	if err := DB.Model(&User{}).Where("name in ?", []string{user2.Name, user2.Name, user3.Name}).Group("id").Count(&count3).Error; err != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 6.9K bytes
    - Viewed (0)
  4. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 6.8K bytes
    - Viewed (0)
  5. tests/callbacks_test.go

    		},
    		{
    			callbacks: []callback{{h: c1, after: "c3"}, {h: c2, before: "c4", after: "c5"}, {h: c3, before: "c5"}, {h: c4}, {h: c5}},
    			results:   []string{"c3", "c1", "c5", "c2", "c4"},
    		},
    		{
    			callbacks: []callback{{h: c1, before: "c4", after: "c3"}, {h: c2, before: "c4", after: "c5"}, {h: c3, before: "c5"}, {h: c4}, {h: c5}},
    			results:   []string{"c3", "c1", "c5", "c2", "c4"},
    		},
    		{
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 26 03:33:36 GMT 2024
    - 7.2K bytes
    - Viewed (0)
  6. schema/utils_test.go

    		`gorm:"column:db" other:"before:value;column:db;after:value"`:                           `gorm:"" other:"before:value;column:db;after:value"`,
    		`gorm:"before:value;column:db ;after:value" other:"before:value;column:db;after:value"`: `gorm:"before:value;after:value" other:"before:value;column:db;after:value"`,
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jul 31 10:19:25 GMT 2020
    - 1.5K bytes
    - Viewed (0)
  7. tests/main_test.go

    		t.Errorf("No user should not be deleted by invalid SQL")
    	}
    }
    
    func TestSetAndGet(t *testing.T) {
    	if value, ok := DB.Set("hello", "world").Get("hello"); !ok {
    		t.Errorf("Should be able to get setting after set")
    	} else if value.(string) != "world" {
    		t.Errorf("Set value should not be changed")
    	}
    
    	if _, ok := DB.Get("non_existing"); ok {
    		t.Errorf("Get non existing key should return error")
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 24 01:31:58 GMT 2022
    - 1.4K bytes
    - Viewed (0)
  8. utils/tests/utils.go

    					t.Errorf("%v: expect: %v, got %v after time round", utils.FileWithLineNum(), expect.(time.Time), curTime)
    				}
    			} else if fmt.Sprint(got) != fmt.Sprint(expect) {
    				t.Errorf("%v: expect: %#v, got %#v", utils.FileWithLineNum(), expect, got)
    			}
    		}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Mar 10 09:21:56 GMT 2023
    - 3.9K bytes
    - Viewed (0)
  9. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 9.3K bytes
    - Viewed (0)
  10. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Wed Oct 27 23:56:55 GMT 2021
    - 3.3K bytes
    - Viewed (0)
Back to top