mirror of
https://github.com/Smaug123/gitea-repo-config
synced 2025-10-07 16:38:41 +00:00
21 lines
581 B
Forth
21 lines
581 B
Forth
namespace Gitea.Declarative
|
|
|
|
[<RequireQualifiedAccess>]
|
|
module internal List =
|
|
|
|
/// f takes a page number and a limit (i.e. a desired page size).
|
|
let getPaginated (f : int -> int -> 'a list Async) : 'a list Async =
|
|
let count = 30
|
|
|
|
let rec go (page : int) (acc : 'a list list) =
|
|
async {
|
|
let! result = f page count
|
|
|
|
if result.Length >= count then
|
|
return! go (page + 1) (result :: acc)
|
|
else
|
|
return (result :: acc) |> List.concat
|
|
}
|
|
|
|
go 1 []
|