First table is working

This commit is contained in:
2022-09-17 00:35:39 +02:00
parent 2485133661
commit 9df45cf83a
13 changed files with 264 additions and 187 deletions
+11
View File
@@ -0,0 +1,11 @@
package util
import "log"
func Must[T any](value T, err error) T {
if err != nil {
log.Fatal(err)
}
return value
}
+3 -3
View File
@@ -2,11 +2,11 @@ package util
import (
"crypto/rand"
"encoding/base64"
"encoding/hex"
"log"
)
// GenerateRandomString generates a random base64 string from a random array of "n" bytes (to prevent padding let n be a multiple of 3)
// GenerateRandomString generates a random hex string from a random array of "n" bytes
func GenerateRandomString(n int) string {
b := make([]byte, n)
@@ -15,5 +15,5 @@ func GenerateRandomString(n int) string {
log.Fatal(err)
}
return base64.URLEncoding.EncodeToString(b)
return hex.EncodeToString(b)
}