Golang random IDs generator.
Change API to provide 4 functions:
New
- generates new IDMust
- generates new ID and panics on errorGenerate
- generates new ID with custom alphabet and lengthMustGenerate
- generates new ID with custom alphabet and length and panics on errorFurthermore some tests were changed/adjusted/added which revealed a bug with custom alphabet containing non-ascii characters.
Add MustID
and MustGenerate
functions. Similar to ID
and Generate
but panic on error.
ID(length)
function, shorthand for Nanoid()
.Nanoid()
function.