Documentation ¶
Overview ¶
Package uuidx 是 uuid 的升级版,用于生成全局唯一且趋势递增的ID 抛弃了云时代虚拟的机器码、IP地址、进程ID等元素,只使用时间+60位真随机数,简单可靠 10进制最长31数位,用Mysql的Decimal长度14字节,字符串使用36进制可压缩到20字符 可以生成以日期时间字面值开头的ID,适合人机交互的场景,如订单ID、日志ID等 使用方法: NewId().Bigint() 生成全局唯一且趋势递增的ID,如:1929739840127008107666424440799 NewId().Bigint().Text(36) 生成全局ID并压缩为36进制字符串,如:573aeu9097046yj2zgx0 NewId().TimeLike() 生成以日期时间字面值开头的ID,如:20230115200352645112789402627768
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Id ¶
type Id struct {
// contains filtered or unexported fields
}
func NewIdWithTime ¶
func ParseBigint ¶
func ParseTimeLike ¶
Click to show internal directories.
Click to hide internal directories.