UUID4.jl
Usage
pkg> registry add https://github.com/0h7z/0hjl.git
pkg> add UUID4
julia> using UUID4
help?> UUID4
help?> uuid
API reference
UUID4.UUID4
— ModuleUUID4
This module provides universally unique identifier (UUID) version 4, along with related functions.
Types
UUID4.Maybe
— TypeMaybe{T} -> Union{Nothing, T}
UUID4.UUID
— TypeUUID -> Base.UUID
Functions
UUID4.uuid
— Functionuuid(rng::Random.AbstractRNG = Random.RandomDevice()) -> UUID
Generate a version 4 (random or pseudo-random) universally unique identifier (UUID), as specified by RFC 4122.
Examples
julia> rng = Random.MersenneTwister(42);
julia> uuid(rng)
UUID("bc8f8f98-a497-45c4-817b-b034d1a24a0e")
UUID4.uuid4
— Functionuuid4 -> uuid
UUID4.uuid_formats
— Methoduuid_formats() -> Vector{Int}
Return all 7 supported UUID string formats.
# case-sensitive
22 # (base62) 22
24 # (base62) 7-7-8
# case-insensitive
25 # (base36) 25
29 # (base36) 5-5-5-5-5
32 # (base16) 32
36 # (base16) 8-4-4-4-12
39 # (base16) 4-4-4-4-4-4-4-4
UUID4.uuid_parse
— Functionuuid_parse(str::AbstractString; fmt::Int = ncodeunits(str)) -> Tuple{Int, UUID}
UUID4.uuid_string
— Functionuuid_string(id::UUID = uuid()) -> Dict{Int, String}
uuid_string(id::UUID = uuid(), T) -> T{Int, String} where T <: AbstractDict
uuid_string(id::UUID = uuid(), fmt::Int) -> String
Examples
julia> uuid_string(OrderedDict, "123e4567-e89b-12d3-a456-426614174000")
OrderedDict{Int64, String} with 7 entries:
22 => "0YQJpYwUwvbaLOwTUr4thA"
24 => "0YQJpYw-UwvbaLO-wTUr4thA"
25 => "12vqjrnxk8whv3i8qi6qgrlz4"
29 => "12vqj-rnxk8-whv3i-8qi6q-grlz4"
32 => "123e4567e89b12d3a456426614174000"
36 => "123e4567-e89b-12d3-a456-426614174000"
39 => "123e-4567-e89b-12d3-a456-4266-1417-4000"
UUID4.uuid_tryparse
— Functionuuid_tryparse(s::AbstractString) -> Maybe{Union{UInt128, UUID}}
UUID4.uuid_version
— Functionuuid_version(id::AbstractString) -> Int
uuid_version(id::UUID) -> Int
Inspect the given UUID or UUID string and return its version (see RFC 4122).
Examples
julia> uuid_version(uuid())
4