fasten-onprem/backend/pkg/utils/paginate.go

17 lines
363 B
Go
Raw Normal View History

package utils
2023-10-03 20:12:54 -06:00
import "github.com/fastenhealth/fasten-onprem/backend/pkg/models"
func PaginateResourceList(resourceList []models.ResourceBase, skip int, size int) []models.ResourceBase {
if skip > len(resourceList) {
skip = len(resourceList)
}
end := skip + size
if end > len(resourceList) {
end = len(resourceList)
}
return resourceList[skip:end]
}