utils

package
v0.0.0-...-aa867a8 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bound

func Bound(min, val, max int) int

Bound returns min if val<min, max if val>max, val else.

func CalcPaginationStartEnd

func CalcPaginationStartEnd(page, pageSize, length int) (start, end int)

CalcPaginationStartEnd calculates the slice offsets needed to perform pagination for desired page, pageSize and length if page=0 it will return slice offsets 0:length-1 for a "get all entries" page.

func Max

func Max(a, b int) int

Max returns the maximal value of ints a and b

func Min

func Min(a, b int) int

Min returns the minimal value of ints a and b

func StrToIntDefault

func StrToIntDefault(str string, def int) (page int)

StrToIntDefault converts str to its equivalent int, falling back to def if str does not represent an int.

Types

This section is empty.

Jump to

Keyboard shortcuts

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