[Tarantool-patches] [PATCH v2 2/2] uuid: support uuid comparison with strings
Igor Munkin
imun at tarantool.org
Tue Nov 24 18:20:54 MSK 2020
Oleg,
Thanks for the patch! Considering the version on the remote branch, LGTM
except a single nit below.
On 18.11.20, olegrok at tarantool.org wrote:
> From: Oleg Babin <babinoleg at mail.ru>
>
> 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, le) and every string
Minor: Strictly saying, you're right, but AFAICS we usually use the key
name (i.e. __eq, __le and __lt) for metamethods in description.
> argument is tried to be converted to uuid value to compare then.
>
> Follow-up #5511
>
> @TarantoolBot document
> Title: uuid values could be compared with strings
>
> Currently 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
> ```
> ---
> Issue: https://github.com/tarantool/tarantool/issues/5511
> Branch: https://github.com/tarantool/tarantool/tree/olegrok/5511-uuid-cmp-v2
>
> src/lua/uuid.lua | 31 +++++++++++++--
> test/app/uuid.result | 85 ++++++++++++++++++++++++++++++++++++++----
> test/app/uuid.test.lua | 27 ++++++++++++++
> 3 files changed, 131 insertions(+), 12 deletions(-)
>
<snipped>
> --
> 2.29.0
>
--
Best regards,
IM
More information about the Tarantool-patches
mailing list