gitlab.com/evatix-go/core@v1.3.55/pagingutil/GetPagesSize.go (about)

     1  package pagingutil
     2  
     3  import (
     4  	"math"
     5  )
     6  
     7  // GetPagesSize returns ceiling int for pages possible
     8  func GetPagesSize(
     9  	eachPageSize,
    10  	totalLength int,
    11  ) int {
    12  	pagesPossibleFloat := float64(totalLength) / float64(eachPageSize)
    13  	pagesPossibleCeiling := int(math.Ceil(pagesPossibleFloat))
    14  
    15  	return pagesPossibleCeiling
    16  }