https://github.com/rs/xid零配置,可排序
Features:
Size: 12 bytes (96 bits), smaller than UUID, larger than snowflake
Base32 hex encoded by default (20 chars when transported as printable string, still sortable)
Non configured, you don't need set a unique machine and/or data center id
K-ordered
Embedded time with 1 second precision
Unicity guaranteed for 16,777,216 (24 bits) unique ids per second and per host/process
Lock-free (i.e.: unlike UUIDv1 and v2)
Name Binary Size String Size Features
UUID 16 bytes 36 chars configuration free, not sortable
shortuuid 16 bytes 22 chars configuration free, not sortable
Snowflake 8 bytes up to 20 chars needs machine/DC configuration, needs central server, sortable
MongoID 12 bytes 24 chars configuration free, sortable
xid 12 bytes 20 chars configuration free, sortable