Documentation
¶
Overview ¶
Package cmp can compare two numbers of any type. In addition, you can also compare two version using this package.
Index ¶
- func CompareEQ(lhs, rhs any) bool
- func CompareGE(lhs, rhs any) bool
- func CompareGT(lhs, rhs any) bool
- func CompareLE(lhs, rhs any) bool
- func CompareLT(lhs, rhs any) bool
- func Max[T cmp.Ordered](x, y T) T
- func Min[T cmp.Ordered](x, y T) T
- func VerGEVer(v0, v1 string) (bool, error)
- func VerGTVer(v0, v1 string) (bool, error)
- func VerLEVer(v0, v1 string) (bool, error)
- func VerLTVer(v0, v1 string) (bool, error)
- type CMPRSLT
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareGE ¶
CompareGE reports left hand side value whether greater than or equal right hand side value.
func CompareLE ¶
CompareLE reports left hand side value whether less than or equal right hand side value.
func VerGEVer ¶
VerGEVer checks whether one version is greater than or equal to another version. Version like MAJOR.MINOR.PATCH, e.g. 2.1.1 > 2.1.0 > 2.0.0 > 1.0.0.
func VerGTVer ¶
VerGTVer checks whether one version is greater than another version. Version like MAJOR.MINOR.PATCH, e.g. 2.1.1 > 2.1.0 > 2.0.0 > 1.0.0.
Types ¶
type CMPRSLT ¶
type CMPRSLT int8
func Cmp ¶
Cmp compares two numeric values or strings size. Deprecated: as of Go 1.21, plz use standard lib func cmp.Compare.