add limiter config

This commit is contained in:
Yuzuki616
2025-02-18 09:52:48 +09:00
parent f3551df1ca
commit 55f9b28869
3 changed files with 37 additions and 0 deletions

28
common/number/number.go Normal file
View File

@@ -0,0 +1,28 @@
package number
type Number interface {
~int | ~int8 | ~int16 | ~int32 | ~int64 |
~float32 | ~float64 |
~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64
}
func SelectBigger[T Number](num1 T, num2 T) T {
if num1 >= num2 {
return num1
}
return num2
}
func SelectSmaller[T Number](num1 T, num2 T) T {
if num1 <= num2 {
return num1
}
return num2
}
func SelectNotZero[T Number](num1 T, num2 T) T {
if num1 != 0 {
return num1
}
return num1
}