shortid

package module
v0.0.0-...-24d054c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2014 License: MIT Imports: 6 Imported by: 8

README

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chars

type Chars struct {
	// contains filtered or unexported fields
}

type Gen

type Gen struct {
	// contains filtered or unexported fields
}

func Generator

func Generator() *Gen

func (*Gen) Decode

func (g *Gen) Decode(id string) map[string]int

func (*Gen) Generate

func (g *Gen) Generate() string

func (*Gen) SetCharacters

func (g *Gen) SetCharacters(char string) error

func (*Gen) SetSeed

func (g *Gen) SetSeed(seed float64)

func (*Gen) SetWorker

func (g *Gen) SetWorker(id int) *Gen

type Random

type Random struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL