doc: add go playground demo

This commit is contained in:
dudaodong
2023-08-25 10:49:16 +08:00
parent cf58542b4a
commit a69d886565
2 changed files with 2 additions and 1 deletions

View File

@@ -66,6 +66,7 @@ func GreaterOrEqual(left, right any) bool {
}
// 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 {
return float64(mathutil.Abs(left-right)) <= delta
}

View File

@@ -105,7 +105,7 @@ func HmacMd5(str, key string) string {
}
// HmacMd5WithBase64 return the hmac hash of string use md5 with base64.
// todo
// https://go.dev/play/p/UY0ng2AefFC
func HmacMd5WithBase64(data, key string) string {
h := hmac.New(md5.New, []byte(key))
h.Write([]byte(data))