Files
SugarDB/utils/utils.go
Kelvin Clement Mwinuka 40be716513 Added resp package for encoding and decoding resp messages.
Created encoding functions for the following commands: ping, set, setnx, get, mget, incr, incrby, incrbyfloat.
Created utils packages for shared utility functions.
2023-06-24 05:38:59 +08:00

17 lines
228 B
Go

package utils
import "math"
func Contains[T comparable](arr []T, elem T) bool {
for _, v := range arr {
if v == elem {
return true
}
}
return false
}
func IsInteger(n float64) bool {
return math.Mod(n, 1.0) == 0
}