/tinyid

Distributed id generator written in golang

Primary LanguageGo

Quick Start

Build and run

clone the repo

git clone https://github.com/tianhongw/tinyid.git

cd tinyid

start the server using docker-compose

make up

Make a request

curl http://127.0.0.1:8080/tinyid/next_id?type=test&size=5&token=abc

Your’ll get the response like either of the following depending on the database selected at random:

{
    "id_list": [
        1,
        3,
        5,
        7,
        9
    ]
}
{
    "id_list": [
        2,
        4,
        6,
        8,
        10
    ]
}

Architecture

tinyid.png