CualerID

Documentation for CualerID.

CualerID.BASE30_ALPHABET — Constant
BASE30_ALPHABET::Vector{UInt8}

An alphabet designed for unambiguous representation of values in either upper- or lower-case. The alphabet was formed by taking the numbers 0-9 and the Latin alphabet and removing characters that are considered easy to confuse. Excluded characters are

  • $I$ => easily confused for lowercase $L$ or the digit $1$
  • $L$ => easily confused for uppercase $I$ or the digit $1$
  • $O$ => easily confused for the digit $0$
  • $Q$ => easily confused with uppercase $O$ or lowercase $g$
  • $V$ => easily confused with $U$

This array contains the ASCII index of the characters included in the base30 alphabet starting with 0 at position BASE30_ALPHABET[1]. Use String() to convert an array of these indices to a base30 string.

source
CualerID.ResultCode — Type
ResultCode::UInt8

Encodes a result of attempting to correct a CualerID

The valid codes are

  • D: duplicate
  • F: fixed
  • N: not fixable
  • V: valid (no need for correction)
source
CualerID.ResultCodeOption — Type
ResultCodeOption

Encodes potential corrected id codes.

The valid codes are

  • D: duplicate
  • F: fixed
  • N: not fixable
  • V: valid (no need for correction)

The codes are implemented exactly as from cual-id and in that order

Constructors

ResultCodeOption(str::AbstractString)

Create a ResultCodeOption based on a the character codes contained within str. str is case insensitive, may contain an arbitrary number of valid codes (as specified above), and may contain duplicates. A ResultCodeOption cannot be constructed from a combination of strings and bitmasks/integers.

Extended help

The struct stores values as a bitmask

Bit (Int)Bit (UInt)Description
10x01D - duplicate
20x02F - fixed
40x04N - not fixable
80x08V - valid
source
CualerID.base30encode — Method
base30encode(v::Integer; pad::Integer=1)
base30encode(v::UUID; pad::Integer=1)

Creates a base30 representation of v padded out to pad digits. If v is a UUID, then the UInt128 value of the UUID is passed directly into the method.

Examples

julia> base30encode(30)
"10"
julia> using UUIDs; base30encode(uuid1())
"7ZK00JECBDF2H7GNBXN59C6S9S"
source
CualerID.cualer_id — Method
cualer_id(u::UUID; length::Integer = 29)

Convert u to a base30 CualerID, truncating all but the last length digits as the human-readable representation of u

source
CualerID.mint_ids! — Method
mint_ids!(
    [existing_ids::Vector{UUID}],
    desired_total::Integer,
    desired_length::Integer,
    failure_threshold::AbstractFloat,
)

Creates desired_total number of UUIDs that are valid CualerIDs at a desired_length

Arguments

  • existing_ids::Vector{UUID}: A set of existing CualerIDs that have already been validated. The default is an empty array, i.e. construct an entirely new set of CualerIDs.
  • desired_total::Integer: The length to grow existing_ids to
  • desired_length::Integer: The length of the CualerID string that is compared to check for conflicts
  • failure_threshold::AbstractFloat: The fraction of non-conflicting values (between 0 and
    1. that is required
source