JasterV

JasterV

Any other libraries to create UUIDv4 beside Ecto?

So I don’t depend on Ecto but I need a well maintained library to generate unique identifiers.

The only library other than ecto seems to be “elixir-uuid”, but it hasnt been updated in ages and when I use it I get many warnings because of deprecated stuff. I’ve checked the issues on Github and some of them even state that the generated UUIDs can sometimes be duplicated…

So the only other option I see is using Ecto.UUID… but I don’t want to import this huge library only to use the UUID functionality

Any ideas here?

Most Liked

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

My guess is that:

  1. Most projects already have ecto. Even if you aren’t using a database, its changesets, embedded schemas, and validators are useful.
  2. The rest just copy in the ~50 lines of code from here ecto/lib/ecto/uuid.ex at v3.11.2 · elixir-ecto/ecto · GitHub

Someone certainly could extract that to a library but it’s also just not that many lines of code, and they aren’t gonna change.

Marcus

Marcus

I have also a reimplementation of elixir_uuid | Hex and uuid_utils | Hex . Not released yet, but if it can help I make a release. GitHub - hrzndhrn/ex_uuid: UUID generator according to RFC 4122 · GitHub

entone

entone

There are quite a few forks of the repo, you could look into those. Forks · zyro/elixir-uuid · GitHub

If a library hasn’t been updated in a while, maybe the author has moved on, I’ll also look at open pull requests to see if anyone has made the changes I need, and can move to that version. Pull requests · zyro/elixir-uuid · GitHub

If the changes I want haven’t been made, then I make them :slight_smile: yay open source!

Last Post!

zookzook

zookzook

You can search for it using hex.pm:

Where Next?

Popular in Questions Top

New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New

Other popular topics Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54006 488
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31494 112
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

We're in Beta

About us Mission Statement