mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-14 09:42:28 +08:00
doc: add go playground demo
This commit is contained in:
@@ -66,6 +66,7 @@ func GreaterOrEqual(left, right any) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// InDelta checks if two values are equal or not within a delta.
|
// InDelta checks if two values are equal or not within a delta.
|
||||||
|
// Play: https://go.dev/play/p/TuDdcNtMkjo
|
||||||
func InDelta[T constraints.Integer | constraints.Float](left, right T, delta float64) bool {
|
func InDelta[T constraints.Integer | constraints.Float](left, right T, delta float64) bool {
|
||||||
return float64(mathutil.Abs(left-right)) <= delta
|
return float64(mathutil.Abs(left-right)) <= delta
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ func HmacMd5(str, key string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// HmacMd5WithBase64 return the hmac hash of string use md5 with base64.
|
// HmacMd5WithBase64 return the hmac hash of string use md5 with base64.
|
||||||
// todo
|
// https://go.dev/play/p/UY0ng2AefFC
|
||||||
func HmacMd5WithBase64(data, key string) string {
|
func HmacMd5WithBase64(data, key string) string {
|
||||||
h := hmac.New(md5.New, []byte(key))
|
h := hmac.New(md5.New, []byte(key))
|
||||||
h.Write([]byte(data))
|
h.Write([]byte(data))
|
||||||
|
|||||||
Reference in New Issue
Block a user