mirror of
https://github.com/navidrome/navidrome.git
synced 2026-02-14 17:01:17 -05:00
17 lines
317 B
Go
17 lines
317 B
Go
package number
|
|
|
|
import (
|
|
"strconv"
|
|
)
|
|
|
|
// Integer is a constraint that permits any integer type.
|
|
type Integer interface {
|
|
~int | ~int8 | ~int16 | ~int32 | ~int64 |
|
|
~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
|
|
}
|
|
|
|
func ParseInt[T Integer](s string) T {
|
|
r, _ := strconv.ParseInt(s, 10, 64)
|
|
return T(r)
|
|
}
|