Coder Social home page Coder Social logo

gauche-ulid's Introduction

Gauche-ulid

An ULID implementation in Gauche.

Requirement

  • Gauche 0.9.7 or later

API

Record Type: <ulid>

ULID type.

Procedure: make-ulid :optional (timestamp #f) (random #f) → ulid

Creates an <ulid> instance.

TIMESTAMP is a timestamp component of ULID. It should be a non-negative integer representing Unix time in milliseconds. Its default value is (ulid:current-time).

RANDOM should be an integer or a procedure. If RANDOM is an integer, it is used as a random component of ULID. If RANDOM is a procedure, it is called with two arguments, a byte-size and a timestamp, and should return a random component of ULID, a non-negative integer that fits in the given byte-size. RANDOM procedure may use the timestamp argument to ensure monotonicity. If RANDOM is not specified, a random intger generated with ulid:urand-read-integer or ulid:random-integer is used.

Procedure: ulid-timestamp ulid → integer

Extracts the timestamp component of ULID.

Procedure: ulid-time ulid → time-utc

Extracts the timestamp component of ULID as a SRFI-19 <time>.

Procedure: ulid-random ulid → integer

Extracts the random component of ULID.

Procedure: ulid->string ulid → string

Converts ULID into a string representation.

Procedure: string->ulid str → ulid

Parses STR as an ULID.

Procedure: ulid->bytevector ulid → u8vector

Converts ULID into a binary representation.

Procedure: bytevector->ulid bytevector → ulid

Parses BYTEVECTOR as an ULID.

Procedure: ulid:current-time → integer

Returns the current time in Unix time milliseconds.

Procedure: ulid:urand-read-integer byte-size timestamp → integer

Reads a BYTE-SIZE bytes non-negative integer from /dev/urandom. If /dev/urandom is not available, this procedure returns false. This procedure does not use TIMESTAMP argument.

Procedure: ulid:random-integer byte-size timestamp → integer

Generates a BYTE-SIZE bytes non-negative integer by using SRFI-27 random-intger procedure. This procedure does not use TIMESTAMP argument.

Note: this procedure may not be cryptographically secure.

gauche-ulid's People

Contributors

leque avatar

Watchers

 avatar  avatar  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.