gen

package
v0.0.0-...-d1ab4a3 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2015 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IDGenerator

type IDGenerator interface {
	// GenID generates a new ID. This method is go-routine safe.
	GenID() uint64
}

IDGenerator generates 64-bit IDs.

type RandomIDGen

type RandomIDGen struct{}

RandomIDGen generates random IDs.

func (*RandomIDGen) GenID

func (g *RandomIDGen) GenID() uint64

type SeqIDGen

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

SeqIDGen generates sequential IDs.

func NewSeqIDGen

func NewSeqIDGen(init uint64) *SeqIDGen

NewSeqIDGen creates a SeqIDGen that will start its IDs from init+1.

func (*SeqIDGen) GenID

func (g *SeqIDGen) GenID() uint64

func (*SeqIDGen) StartFrom

func (g *SeqIDGen) StartFrom(id uint64)

ResetMinTo resets the minimum to be at least id.

Jump to

Keyboard shortcuts

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