This commit is contained in:
parent
aa2b056f8b
commit
d32818af09
8 changed files with 51 additions and 8 deletions
17
shared/ids.go
Normal file
17
shared/ids.go
Normal file
|
@ -0,0 +1,17 @@
|
|||
package shared
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"github.com/nrednav/cuid2"
|
||||
|
||||
"git.mstar.dev/mstar/linstrom/config"
|
||||
)
|
||||
|
||||
// Generate a new string ID
|
||||
func NewId() string {
|
||||
if config.GlobalConfig.Experimental.UseCuid2Ids {
|
||||
return cuid2.Generate()
|
||||
} else {
|
||||
return uuid.NewString()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue