Documentation ¶
Index ¶
- Constants
- func BaseUUID() string
- func BytesUUID() []byte
- func HexUUID(upper bool) string
- func ShortID(n int) string
- func ShortIDWithDic(n int, dic string, headDicLen int) (string, error)
- func ShortIDWithError(n int) (string, error)
- func String(n int) string
- func StringUUID() string
- func UpperShortID(n int) string
- func WithPrefix(id string, prefix string) string
Constants ¶
const (
// DefaultShortNameLen is defult length of short name
DefaultShortNameLen = 8
)
Variables ¶
This section is empty.
Functions ¶
func ShortID ¶ added in v0.0.2
ShortID generate a random string with length n. If n<=0 it use n as default length(8). NOTE: we suggest n>=8, too short id with higher risk of collision.
func ShortIDWithDic ¶ added in v0.0.2
ShortIDWithDic generate a shortID with dictionary. headDicLen is the length of first byte use. NOTE: it will panic if dic is empty or headDicLen overflow dic.
func ShortIDWithError ¶ added in v0.0.2
ShortIDWithError generate a random string with length n
func StringUUID ¶ added in v0.0.2
func StringUUID() string
StringUUID generate google/uuid as string
func UpperShortID ¶ added in v0.0.2
UpperShortID generate a random string with length n. If n<=0 it use n as default length(8). NOTE: we suggest n>=8, too short id with higher risk of collision. NOTE: it with much more probability to duplicate compare to ShortID.
func WithPrefix ¶ added in v0.0.2
WithPrefix add prefix to id if prefix is not empty
Types ¶
This section is empty.