diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-04-21 18:46:40 -0700 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-04-21 18:46:40 -0700 |
commit | d14605d1388aaa7cc9ef1c230eae5ba14c9cef44 (patch) | |
tree | 59fcda0fae7899ca577eed1f72d89bff17d5ad5d /utils | |
download | backup-notify-d14605d1388aaa7cc9ef1c230eae5ba14c9cef44.tar.gz backup-notify-d14605d1388aaa7cc9ef1c230eae5ba14c9cef44.zip |
initial commit
Diffstat (limited to 'utils')
-rw-r--r-- | utils/random_id.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/utils/random_id.go b/utils/random_id.go new file mode 100644 index 0000000..1b03ec8 --- /dev/null +++ b/utils/random_id.go @@ -0,0 +1,16 @@ +package utils + +import ( + "crypto/rand" + "fmt" +) + +func RandomId() string { + id := make([]byte, 16) + _, err := rand.Read(id) + if err != nil { + panic(err) + } + + return fmt.Sprintf("%x", id) +} |