gfc-collective / gfc-timeuuid   1.0.0

Apache License 2.0 GitHub

Gilt Foundation Classes Collection Version 1 UUID Module

Scala versions: 2.13 2.12

gfc-timeuuid Maven Central Build Status Coverage Status

An Scala timeuuid library for generating version 1 UUIDs, based on http://www.ietf.org/rfc/rfc4122.txts.

This library is a fork and new home of the now unmaintained Gilt Foundation Classes (com.gilt.gfc), now called the GFC Collective, maintained by some of the original authors.

Getting gfc-timeuuid

The latest version is 1.0.0, released on 21/Jan/2020 and cross-built against Scala 2.12.x and 2.13.x.

If you're using SBT, add the following line to your build file:

libraryDependencies += "org.gfccollective" %% "gfc-timeuuid" % "1.0.0"

For Maven and other build tools, you can visit search.maven.org. (This search will also list other available libraries from the GFC Collective.)

Contents and Example Usage

Generates a new unique time based UUID

val uuid = TimeUuid()

Convert time UUID to unix timestamp

import org.gfccollective.timeuuid._

val uuid = TimeUuid()
val timestamp = uuid.toLong

Convert time UUID to unix date

import org.gfccollective.timeuuid._

val uuid = TimeUuid()
val date = uuid.toDate

Convert arrays of 16 bytes to UUID:

val bytes = new Array[Byte](16)
val uuid = bytes.toUUID

License

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0