Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for kingGo (0.19 sec)

  1. tests/joins_test.go

    		return
    	}
    }
    
    func TestJoinCount(t *testing.T) {
    	companyA := Company{Name: "A"}
    	companyB := Company{Name: "B"}
    	DB.Create(&companyA)
    	DB.Create(&companyB)
    
    	user := User{Name: "kingGo", CompanyID: &companyB.ID}
    	DB.Create(&user)
    
    	query := DB.Model(&User{}).Joins("Company")
    	// Bug happens when .Count is called on a query.
    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)
  2. tests/upsert_test.go

    	}
    }
    
    func TestUpdateWithMissWhere(t *testing.T) {
    	type User struct {
    		ID   uint   `gorm:"column:id;<-:create"`
    		Name string `gorm:"column:name"`
    	}
    	user := User{ID: 1, Name: "king"}
    	tx := DB.Session(&gorm.Session{DryRun: true}).Save(&user)
    
    	if err := tx.Error; err != nil {
    		t.Fatalf("failed to update user,missing where condition,err=%+v", err)
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Sep 05 07:39:19 GMT 2022
    - 11.4K bytes
    - Viewed (0)
Back to top