Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCustomizedNanoId ¶
NewCustomizedNanoId 生成定制化的NanoId
@param alphabet 字母表(默认为"_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") @param size 生成NanoId字符串的长度
func NewNanoId ¶
NewNanoId 生成NanoId
NanoID 了解一下?比 UUID 更好用! - https://mp.weixin.qq.com/s/4muEuUkk3tq6iJXLwspQyQ
@param l 生成NanoId字符串的长度,不传参则默认长度为21(!!!:传参个数只能为0或1,且值>=0) @return 返回值的字母表为: "_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
e.g. () => ("4spQ-UdpjbhSjE046w1Ij", nil)
func NewSimpleUUID ¶
func NewSimpleUUID() string
NewSimpleUUID uuid v4 * @return e.g. "e28351058d0c446b85e3d7896c87078b"
func NewULID ¶
func NewULID() string
NewULID
PS: (1) Format: tttttttttteeeeeeeeeeeeeeee where t is time and e is entropy.(时间+随机数) (2) If you just want to generate a ULID and don't (yet) care about details like performance, cryptographic security, etc., use the ulid.Make helper function.
This function calls time.Now to get a timestamp, and uses a source of entropy which is process-global, pseudo-random, and monotonic.
@return 长度: 26(即ulid.EncodedSize)
e.g. () => "01GMSRXRWJPYSQQZ5Z6T832CSZ"
Types ¶
This section is empty.