uid

package
v0.0.0-...-98b2de1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2015 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClock     = errors.New("Error clock moved backwards")
	ErrInvalidID = errors.New("Error invalid hashid")
)

Functions

func NewContext

func NewContext(ctx context.Context, g *Generator) context.Context

func SetEpoch

func SetEpoch(t time.Time)

func SetSalt

func SetSalt(s string)

Types

type Generator

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

func NewGenerator

func NewGenerator(machineID int) (*Generator, error)

func (*Generator) Next

func (g *Generator) Next() (ID, error)

type ID

type ID int64

func FromHashID

func FromHashID(s string) (ID, error)

func NextID

func NextID(ctx context.Context) (ID, error)

func (ID) Bytes

func (n ID) Bytes() []byte

func (ID) HashID

func (n ID) HashID() string

Jump to

Keyboard shortcuts

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