/go-shortid

Short id generator. Url-friendly. Non-predictable. Cluster-compatible.

Primary LanguageGoMIT LicenseMIT

ShortId

Build Status

Port of dylang/shortid to Go

Usage

package main

import(
  "github.com/SKAhack/go-shortid"
)

func main() {
  g := shortid.Generator()
  g.Generate() // => 9uK7FCrIm
}

Example

$ ./example
HJpRDHKIP
JJBjvDJ5IQ
HHLZUC9hVP
JuQpRCJhVg
u91ZUCJhIm
u9np_ru5SQ
9HV6UCH5Vg
99_Z_D9hVP
9HsZ_rJKVg
JJOpvDH5Vg

API

See: dylang/shortid

Initialize

  g := shortid.Generator()

Generate()

generate a new ShortId

  g.Generate() // => JJOpvDH5Vg

SetSeed(float64)

  g.SetSeed(1)

License

MIT