Documentation
¶
Overview ¶
Package paginate provides a thin generic skeleton for SDK pagination loops.
It removes the "for { call API; append; advance cursor; break-on-last }" boilerplate that every provider's region enumerator re-implements. The caller owns everything SDK-specific (cursor type, end-of-stream detection, item mapping); this package just drives the loop.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fetch ¶
func Fetch[Item, Cursor any]( ctx context.Context, fn func(ctx context.Context, cursor Cursor) (Page[Item, Cursor], error), ) ([]Item, error)
Fetch calls fn repeatedly starting from the zero value of Cursor, appending each page's Items to the result. It stops when fn returns Done=true, returns an error, or ctx is cancelled (already-collected items are returned, err nil on cancellation — matches the partial-failure convention used elsewhere).
Types ¶
Click to show internal directories.
Click to hide internal directories.