Handle large and all entity queries (#3544)

* Remove upper page size limit
* Batch GetMany function
* Remove upper query limit from UI
This commit is contained in:
WithoutPants
2023-03-16 09:08:21 +11:00
committed by GitHub
parent ac67d640db
commit 58852f86fe
10 changed files with 130 additions and 75 deletions

20
pkg/sqlite/batch.go Normal file
View File

@@ -0,0 +1,20 @@
package sqlite
const defaultBatchSize = 1000
// batchExec executes the provided function in batches of the provided size.
func batchExec(ids []int, batchSize int, fn func(batch []int) error) error {
for i := 0; i < len(ids); i += batchSize {
end := i + batchSize
if end > len(ids) {
end = len(ids)
}
batch := ids[i:end]
if err := fn(batch); err != nil {
return err
}
}
return nil
}