- Sort Score
- Result 10 results
- Languages All
Results 1 - 2 of 2 for find_in_batches (0.06 sec)
-
generics.go
func (g execG[T]) Find(ctx context.Context) ([]T, error) { var r []T err := g.g.apply(ctx).Find(&r).Error return r, err } func (g execG[T]) FindInBatches(ctx context.Context, batchSize int, fc func(data []T, batch int) error) error { var data []T return g.g.apply(ctx).FindInBatches(&data, batchSize, func(tx *DB, batch int) error { return fc(data, batch) }).Error } func (g execG[T]) Row(ctx context.Context) *sql.Row {
Registered: Sun Sep 07 09:35:13 UTC 2025 - Last Modified: Thu Sep 04 13:13:16 UTC 2025 - 15.5K bytes - Viewed (0) -
tests/generics_test.go
} total := 0 err := gorm.G[User](DB).Where("name like ?", "GenericsFindBatch%").FindInBatches(ctx, 2, func(chunk []User, batch int) error { if len(chunk) > 2 { t.Errorf("batch size exceed 2: got %d", len(chunk)) } total += len(chunk) return nil }) if err != nil { t.Fatalf("FindInBatches failed: %v", err) } if total != len(users) {
Registered: Sun Sep 07 09:35:13 UTC 2025 - Last Modified: Thu Sep 04 13:13:16 UTC 2025 - 28K bytes - Viewed (0)