Discover Packages
github.com/go-pay/util
iterator
package
Version:
v0.0.4
Opens a new window with list of versions in this module.
Published: Aug 27, 2024
License: Apache-2.0
Opens a new window with license information.
Imports: 0
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
type Step struct {
Head int
Tail int
}
func Steps(total, step int ) (steps []Step )
Steps calculates the steps.
example:
ids := []int{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}
for _, step := range iterator.Steps(len(ids), 10) {
cur := ids[step.Head:step.Tail]
// todo: do something
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.