项目作者: nexthack

项目描述 :
goshort encodes an integer id into a url safe string
高级语言: Go
项目地址: git://github.com/nexthack/goshort.git
创建时间: 2017-04-15T18:13:58Z
项目社区:https://github.com/nexthack/goshort

开源协议:

下载


ShortURL

Inspired from https://github.com/delight-im/ShortURL .An encoding scheme
to convert an id to a string and vice versa.Uses a space of 52 characters and
is url safe.

The auto increment id from database can be encoded and used as url shortener

Usage

  • goshort.encode() takes an ID and turns it into a short string
  • goshort.decode() takes a short string and turns it into an ID

Example output

  • 3141592 <=> vJST
  • 123456789 <=> pgK8p

License

This project is licensed under the terms of the MIT License.