Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for CreateInBatches (0.07 sec)

  1. tests/generics_test.go

    		{Name: "GenericsCreateInBatches1"},
    		{Name: "GenericsCreateInBatches2"},
    		{Name: "GenericsCreateInBatches3"},
    	}
    	ctx := context.Background()
    
    	if err := gorm.G[User](DB).CreateInBatches(ctx, &batch, 2); err != nil {
    		t.Fatalf("CreateInBatches failed: %v", err)
    	}
    
    	for _, u := range batch {
    		if u.ID == 0 {
    			t.Fatalf("no primary key found for %v", u)
    		}
    	}
    
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Sun Nov 02 14:09:18 UTC 2025
    - 33.7K bytes
    - Viewed (0)
  2. generics.go

    }
    
    func (c createG[T]) Create(ctx context.Context, r *T) error {
    	return c.g.apply(ctx).Create(r).Error
    }
    
    func (c createG[T]) CreateInBatches(ctx context.Context, r *[]T, batchSize int) error {
    	return c.g.apply(ctx).CreateInBatches(r, batchSize).Error
    }
    
    type chainG[T any] struct {
    	execG[T]
    }
    
    func (c chainG[T]) getInstance() *DB {
    	var r T
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Sun Nov 02 14:09:18 UTC 2025
    - 25.9K bytes
    - Viewed (0)
Back to top