sequence

package
v0.0.0-...-845bd32 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2019 License: AGPL-3.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustRegister

func MustRegister(sequenceType string, sequence Sequence)

Register makes a sequence generator available by the provided sequenceType. If Register is called twice with the same name or if driver is nil, it panics.

func Sequences

func Sequences() []string

Sequences returns a sorted list of the types of the registered sequences.

Types

type Sequence

type Sequence interface {
	// Open opens the sequence generator.
	Open() (err error)
	// NextSequence generates next sequence integer(unsigned 64bit).
	// If some error happens, err will not be nil and seq will be 0.
	// Else, err will be nil and next valid sequence integer will be in seq.
	NextSequence() (seq uint64, err error)
	// Close closes the sequence generator.
	Close()
}

func GetSequence

func GetSequence(sequenceType string) (sequence Sequence, err error)

GetSequence returns corresponding sequence instance with the specified sequenceType. If the specified sequenceType does not register itself, then err will be non nil and sequence will be nil. Else, err will be nil and sequence will be corresponding sequence instance.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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