zyro / elixir-uuid

UUID generator and utilities for Elixir
Apache License 2.0
361 stars 84 forks source link

Allow setting and retrieving timestamps for UUIDv1 #64

Closed nathanalderson closed 2 years ago

nathanalderson commented 2 years ago

This PR adds two new functions:

This is useful for me specifically because we use Cassandra and the UUIDv1s generated by this library are compatible with its timeuuid column type. Although Cassandra provides functions to extract timestamps from these timeuuids, there is no function to create a timeuuid from a timestamp, so I can't insert elements with a timestamp other than "now".

I added tests for the existing functionality that I touched as well as the newly added functionality.

Thanks for this great library! :)