Git Product home page Git Product logo

tardis's Introduction

tardis

Clojure library to manage Type 1 UUIDs (time based), wrapping com.eaio.uuid (meaning it is fast and reliable).

Handles "unique", "non-unique" uuids and retrieval of composing values.

Build Status

Installation

Add [cc.qbits/tardis "1.1.1"] in your project.clj

Usage

(use 'qbits.tardis)

user> (non-unique-time-uuid)
#tardis/time-uuid "00000139-64f1-0aa2-8a9b-0024d70cf6c4"

user> (non-unique-time-uuid (java.util.Date.))
#tardis/time-uuid "00000139-64f1-df3b-8a9b-0024d70cf6c4"

;; it can take Longs also
user> (non-unique-time-uuid (.getTime (java.util.Date.)))
#tardis/time-uuid "00000139-64f2-6dc8-8a9b-0024d70cf6c4"

;; or supply the clockseq-and-node yourself
user> (non-unique-time-uuid (java.util.Date.) -8459167316858571068)

The API is identical for unique-time-uuid.

Some helpers:

;; Convert from strings and retrieve time

user> #tardis/time-uuid "7feaa500-efc7-11e1-8a9b-0024d70cf6c4"
#tardis/time-uuid "7feaa500-efc7-11e1-8a9b-0024d70cf6c4"

;; the reader literal is aliased to this fn
user> (to-uuid "7feaa500-efc7-11e1-8a9b-0024d70cf6c4")
#tardis/time-uuid "7feaa500-efc7-11e1-8a9b-0024d70cf6c4"

user> (uuid->time (to-uuid "7feaa500-efc7-11e1-8a9b-0024d70cf6c4"))
9217361010808525281

user> (uuid->time "7feaa500-efc7-11e1-8a9b-0024d70cf6c4")
9217361010808525281

user> (uuid->clockseq+node "7feaa500-efc7-11e1-8a9b-0024d70cf6c4")
-8459167316858571068

user> (uuid->clockseq+node (to-uuid "7feaa500-efc7-11e1-8a9b-0024d70cf6c4"))
-8459167316858571068

License

Copyright © 2012 Max Penet

Distributed under the Eclipse Public License, the same as Clojure.

tardis's People

Contributors

mpenet avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tardis's Issues

Insecure repo settings fails with newer leiningen

In a new leiningen, depending on alia leads to the following error:

$ lein deps 
Tried to use insecure HTTP repository without TLS.
This is almost certainly a mistake; however in rare cases where it's
intentional please see `lein help faq` for details.

and this in the cider stacktrace:

Could not find artifact com.eaio.uuid:uuid:jar:3.3 in clojars (https://repo.clojars.org/)

, which I narrowed down to this library. I agree with leiningen that pulling dependencies over http is a serious security risk and should be fixed as soon as possible.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.