photoprism/pkg/rnd/ppid.go
Michael Mayer f8a45b14d9 Backend: Move reusable packages to pkg/
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-01-12 14:00:56 +01:00

16 lines
343 B
Go

package rnd
import (
"strconv"
"time"
)
// PPID returns a unique id with prefix as string.
func PPID(prefix rune) string {
result := make([]byte, 0, 17)
result = append(result, byte(prefix))
result = append(result, strconv.FormatInt(time.Now().UTC().Unix(), 36)[0:6]...)
result = append(result, Token(10)...)
return string(result)
}