ant8e / uuid4cats-effect

UUID V1, V4, V6, V7 & TypeID generation with cats-effect
Apache License 2.0
13 stars 2 forks source link

Extract timestamp from time-based UUIDs #65

Closed ybasket closed 5 months ago

ybasket commented 5 months ago

Hello, glad to have the honour of writing the first issue 😄

The project looks quite promising and I'd love to adopt it at $WORK, ditching com.github.f4b6a3:uuid-creator, but there's a missing piece of functionality we'd require: extracting timestamps from UUIDv6 and v7 by looking at the time-encoding bits. So something like

object UUID4CatsEffect {
  // could also return Option[Long] with epoch millis or be overloaded
  def extractTimestamp(uuid: UUID): Option[java.time.Instant] = ... 
}

Inspired by UUIDUtil.getInstant.

I'm not sure I can find the time to contribute, but in any way would be glad if this feature made it into the library.

ant8e commented 5 months ago

Hi, Congrats on filling the first issue!

This is a great suggestion, thanks. I will look into it, it should not be too much of a deal.

ant8e commented 5 months ago

66 is addressing this.