Skip to main content

hex_prefix_to_uuid_pattern

Function hex_prefix_to_uuid_pattern 

Source
pub fn hex_prefix_to_uuid_pattern(prefix: &str) -> String
Expand description

Re-insert hyphens at canonical UUID positions (8-4-4-4-12) into a hyphen-free hex prefix, so a LIKE '<pattern>%' scan against the hyphenated id column matches correctly. Prefixes that already contain a hyphen are passed through unchanged. No-op for len <= 8 (already correct). Input longer than 32 hex chars is NOT truncated: the extra hex chars are appended past the canonical 12-char final segment with no further hyphen, so the resulting LIKE pattern requires literal characters beyond position 36 that no real (36-char) UUID string can ever have — the scan naturally fails closed instead of silently resolving <valid-32-hex><extra-hex> to the valid UUID.