iterator

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Step

type Step struct {
	Head int
	Tail int
}

func Steps

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL