GithubHelp home page GithubHelp logo

elderica / ulid Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 22 KB

Universally Unique Lexicographically Sortable Identifier

License: BSD 3-Clause "New" or "Revised" License

Makefile 2.51% Common Lisp 97.49%

ulid's Introduction

ulid

Universally Unique Lexicographically Sortable Identifier

See details: https://github.com/ulid/spec

Synopsis

(asdf:load-system :ulid)

(format t "~a~&" (ulid:generate-now))

API

Type: u128

represents unsigned 128-bits integer.

Type: base32

represents 26-characters string encoded with Crockford's Base32.

Struct: ulid

holds unsigned 128-bit integer that represents unique lexicographically sortable identifier. The first 48 bits of 128 bits are a UNIX timestamp in milliseconds for lexicographically sorting. The remaining 80 bits are randomness that ensure the identifier is unique.

Function: ulid-timestamp

returns timestamp part of ulid.

Function: ulid-randomness

returns randomness part of ulid.

Condition: ulid-out-of-range

are signaled when you try to decode invalid Base32 encoded string.

Function: ulid->u128

converts ulid into unsigned 128-bits integer.

Function u128->base32

encodes unsigned 128-bits integer to 26-characters Crockford's Base32.

Function: ulid->base32

encodes ulid to 26-characters Crockford's Base32.

Function: base32->u128

decodes 26-character Crockford's Base32 to unsigned 128-bit integer.

Function: u128->ulid

converts unsigned 128-bits integer to ulid.

Function: base32->ulid

decodes 26-characters Crockford's Base32 string to ulid.

Function: generate-now

generates ulid from current timestamp and randomness.

Install

First, you should clone this repository to ~/common-lisp/ulid.

Try ULID generation on your shell:

$ make build
$ ./ulid

You can copy ./ulid binary anywhere you like.


Licence: BSD

ulid's People

Contributors

elderica avatar

Stargazers

Joel Boehland avatar Sebastian Christ avatar Alexander Artemenko avatar

Watchers

 avatar vindarel avatar

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.