uuid: support uuid comparison with strings
Before this patch it was impossible to compare uuid values with string representations of uuid. However we have cases when such comparisons is possible (e.g. "decimal" where we can compare decimal values with strings and numbers). This patch extends uuid comparators (__eq, __lt and __le) and every string argument is tried to be converted to uuid value to compare then. Follow-up #5511 @TarantoolBot document Title: uuid comparison rules Currently comparison between uuid values is supported. Example: ```lua u1 = uuid.fromstr('aaaaaaaa-aaaa-4000-b000-000000000001') u2 = uuid.fromstr('bbbbbbbb-bbbb-4000-b000-000000000001') u1 > u2 -- false u1 >= u2 -- false u1 <= u2 -- true u1 < u2 -- true ``` Also it's possible to compare uuid values with its string representations: ```lua u1_str = 'aaaaaaaa-aaaa-4000-b000-000000000001' u1 = uuid.fromstr(u1_str) u2_str = 'bbbbbbbb-bbbb-4000-b000-000000000001' u1 == u1_str -- true u1 == u2_str -- false u1 >= u1_str -- true u1 < u2_str -- true ```
Loading
Please register or sign in to comment