mirror of
https://github.com/EchoVault/SugarDB.git
synced 2025-10-15 12:30:38 +08:00

Created encoding functions for the following commands: ping, set, setnx, get, mget, incr, incrby, incrbyfloat. Created utils packages for shared utility functions.
17 lines
228 B
Go
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
|
|
}
|