Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 3 of 3 for WithResult (0.06 seconds)

  1. tests/generics_test.go

    	ctx := context.Background()
    	users := []User{{Name: "TestGenericsWithResult", Age: 18}, {Name: "TestGenericsWithResult2", Age: 18}}
    
    	result := gorm.WithResult()
    	err := gorm.G[User](DB, result).CreateInBatches(ctx, &users, 2)
    	if err != nil {
    		t.Errorf("failed to create users WithResult")
    	}
    
    	if result.RowsAffected != 2 {
    		t.Errorf("failed to get affected rows, got %d, should be %d", result.RowsAffected, 2)
    	}
    }
    
    Created: Sun Apr 05 09:35:12 GMT 2026
    - Last Modified: Tue Dec 30 08:11:14 GMT 2025
    - 34.9K bytes
    - Click Count (0)
  2. generics_withresult_test.go

    	}
    	if err := db.AutoMigrate(&withResultUser{}); err != nil {
    		t.Fatalf("migrate failed: %v", err)
    	}
    
    	ctx := context.Background()
    
    	u := withResultUser{Name: "with-result-ok"}
    	r := gorm.WithResult()
    	if err := gorm.G[withResultUser](db, r).Create(ctx, &u); err != nil {
    		t.Fatalf("create failed: %v", err)
    	}
    	if u.ID == 0 {
    		t.Fatalf("expected ID to be set")
    	}
    	if r.Error != nil {
    Created: Sun Apr 05 09:35:12 GMT 2026
    - Last Modified: Sat Mar 21 11:34:24 GMT 2026
    - 1.2K bytes
    - Click Count (0)
  3. generics.go

    	info.Result = nil
    	info.RowsAffected = 0
    	info.Error = nil
    	stmt.Result = info
    }
    
    // Build implements clause.Expression interface
    func (result) Build(clause.Builder) {
    }
    
    func WithResult() *result {
    	return &result{}
    }
    
    type Interface[T any] interface {
    	Raw(sql string, values ...interface{}) ExecInterface[T]
    	Exec(ctx context.Context, sql string, values ...interface{}) error
    	CreateInterface[T]
    Created: Sun Apr 05 09:35:12 GMT 2026
    - Last Modified: Sat Mar 21 11:34:24 GMT 2026
    - 26K bytes
    - Click Count (0)
Back to Top