Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wildart/scru128.jl
SCRU128 Julia Implementation
https://github.com/wildart/scru128.jl
guid identifier uuid
Last synced: 20 days ago
JSON representation
SCRU128 Julia Implementation
- Host: GitHub
- URL: https://github.com/wildart/scru128.jl
- Owner: wildart
- License: mit
- Created: 2022-05-16T22:45:05.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-06-27T01:04:25.000Z (over 2 years ago)
- Last Synced: 2024-10-11T07:08:13.921Z (about 1 month ago)
- Topics: guid, identifier, uuid
- Language: Julia
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SCRU128: Sortable, Clock and Random number-based Unique identifier
SCRU128 ID is a supersede [UUID] that has the following features:
- 128-bit unsigned integer type
- Sortable by generation time (as integer and as text)
- 25-digit case-insensitive textual representation (Base36)
- 48-bit millisecond Unix timestamp that ensures useful life until year 10889
- Up to 281 trillion time-ordered but unpredictable unique IDs per millisecond
- 80-bit three-layer randomness for global uniqueness```julia
julia> using SCRU128julia> id = SCRU128Id()
SCRU128Id(0x0180cf01d7e41f149affea220e4508d2)julia> string(id) # convert id to string
"037BY37CNY3426KUV0W41B0LU"julia> UInt128(id) # conver id to UInt128
0x0180cf01d7e41f149affea220e4508d2julia> string.(Iterators.take(scru128(), 5)) # using generator
5-element Vector{String}:
"037BY3BUQ8S8MJGZTTYTEAZQ7"
"037BY3BUQ633D5J0F29AKK9N8"
"037BY3BUQ633D5J0F2AFNCYDD"
"037BY3BUQ633D5J0F2D872JKS"
"037BY3BUQ633D5J0F2EZS5UY4"julia> SCRU128Id("037BY3BUQ633D5J0F2EZS5UY4") # convert string to id
SCRU128Id(0x0180cf032af79b0eca5bd659931a5d7b)
```See [SCRU128 Specification] for details.
[uuid]: https://en.wikipedia.org/wiki/Universally_unique_identifier
[scru128 specification]: https://github.com/scru128/spec