Bump github.com/gookit/config/v2 from 2.1.8 to 2.2.2

Bumps [github.com/gookit/config/v2](https://github.com/gookit/config) from 2.1.8 to 2.2.2.
- [Release notes](https://github.com/gookit/config/releases)
- [Commits](https://github.com/gookit/config/compare/v2.1.8...v2.2.2)

---
updated-dependencies:
- dependency-name: github.com/gookit/config/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot]
2023-06-13 10:54:58 +02:00
committed by Ralf Haferkamp
parent 03045c5ccc
commit 5ebc596352
190 changed files with 18970 additions and 4167 deletions
+49 -4
View File
@@ -1,10 +1,42 @@
// Package mathutil provide math(int, number) util functions. eg: convert, math calc, random
package mathutil
import "math"
import (
"math"
// MaxFloat compare and return max value
func MaxFloat(x, y float64) float64 {
return math.Max(x, y)
"github.com/gookit/goutil/comdef"
)
// Min compare two value and return max value
func Min[T comdef.XintOrFloat](x, y T) T {
if x < y {
return x
}
return y
}
// Max compare two value and return max value
func Max[T comdef.XintOrFloat](x, y T) T {
if x > y {
return x
}
return y
}
// SwapMin compare and always return [min, max] value
func SwapMin[T comdef.XintOrFloat](x, y T) (T, T) {
if x < y {
return x, y
}
return y, x
}
// SwapMax compare and always return [max, min] value
func SwapMax[T comdef.XintOrFloat](x, y T) (T, T) {
if x > y {
return x, y
}
return y, x
}
// MaxInt compare and return max value
@@ -38,3 +70,16 @@ func SwapMaxI64(x, y int64) (int64, int64) {
}
return y, x
}
// MaxFloat compare and return max value
func MaxFloat(x, y float64) float64 {
return math.Max(x, y)
}
// OrElse return s OR nv(new-value) on s is empty
func OrElse[T comdef.XintOrFloat](in, nv T) T {
if in != 0 {
return in
}
return nv
}