Closed ak-coram closed 1 year ago
This one's a bit more difficult. I did find one: uuid.lisp. I don't know how good the implementation is, but it may be sufficient for this use case?
@snunez1: thanks for your input, I think the implementation you found is only for generating random UUIDs and is representing them as strings. I've already implemented a conversion from the low-level DuckDB type to strings (see https://github.com/ak-coram/cl-duckdb/blob/bfa037a5d07f0a75e93e011032cbbbbfea0b50b0/duckdb-api.lisp#L80) via format, but felt that users would be better served if we provided a type that uses a more efficient representation and can be used with an existing UUID library.
I've found this library, but it also depends on ironclad: https://github.com/deterministic-arts/DartsCLUUID
Maybe we should provide our own UUID type and implement a few functions for convenience? Perhaps split that into a separate library?
It seems that given the lack of a library for this that is independent of ironclad, that's a good idea. I'll ask our software devs if they have an algorithm or simple implementation handy as a starting point.
Edit: did I misunderstand this. We can generate them, and the problem is an efficient representation? Or, we need to generate them too? If the former, it should be easy with a struct.
@snunez1: I'm not sure we need to generate them (DuckDB has SQL functions for that). We should be able to represent them efficiently (not as text) and at least do equality checks and conversion from and to the string representation. Shouldn't be too hard to implement, I'll try to find the time.
@snunez1: I've decided to write https://github.com/ak-coram/cl-frugal-uuid
Please let me know what you think. Documentation is still lacking, but it's a very small library so that should be fairly easy to cover.
Do you think we can close this issue for now?
Perfect! I just discovered today that version UUID v4 is just a 128 bit random draw from the uniform distribution, and this library was going to be my weekend project, but you beat me to it. Thanks.
Depending on https://github.com/dardoria/uuid/ pulls in ironclad as a transitive dependency, which takes a very long time to compile on ECL (currently timing out the ARM tests). The library is only used for representing UUID values, we should switch to a smaller alternative.