generator

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: May 9, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UUID added in v0.0.19

type UUID [16]byte

UUID provides functionality to produce a new random Universal Unique Identifier as defined in RFC 4122.

uuid, ids := new(generator.UUID), make([]entity.ID, 4)
for i := range sequence.Simple(len(ids)) {
	ids[i] = entity.ID(uid.Next())
}

func (UUID) Next added in v0.0.19

func (generator UUID) Next() UUID

Next returns a new random UUID which may or may not be valid.

func (UUID) String added in v0.0.19

func (generator UUID) String() string

String returns the string form of the UUID, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, or "" if the UUID is invalid.

func (UUID) Valid added in v0.0.19

func (generator UUID) Valid() bool

Valid returns true if the UUID is valid.

type Uint32

type Uint32 uint32

Uint32 provides functionality to produce increasing sequence of numbers.

uid, ids := new(generator.Uint32).At(7), make([]entity.ID, 4)

for i := range sequence.Simple(len(ids)) {
	ids[i] = entity.ID(uid.Next())
}

func (*Uint32) At

func (generator *Uint32) At(position uint32) *Uint32

At sets the Uint32 to the new position.

func (*Uint32) Current

func (generator *Uint32) Current() uint32

Current returns a current value of the Uint32.

func (*Uint32) Jump

func (generator *Uint32) Jump(distance uint32) uint32

Jump moves the Uint32 forward at the specified distance.

func (*Uint32) Next

func (generator *Uint32) Next() uint32

Next moves the Uint32 one step forward.

func (*Uint32) Reset

func (generator *Uint32) Reset() uint32

Reset returns a current value of the Uint32 and resets it.

type Uint64

type Uint64 uint64

Uint64 provides functionality to produce increasing sequence of numbers.

uid, ids := new(generator.Uint64).At(7), make([]entity.ID, 4)

for i := range sequence.Simple(len(ids)) {
	ids[i] = entity.ID(uid.Next())
}

func (*Uint64) At

func (generator *Uint64) At(position uint64) *Uint64

At sets the Uint64 to the new position.

func (*Uint64) Current

func (generator *Uint64) Current() uint64

Current returns a current value of the Uint64.

func (*Uint64) Jump

func (generator *Uint64) Jump(distance uint64) uint64

Jump moves the Uint64 forward at the specified distance.

func (*Uint64) Next

func (generator *Uint64) Next() uint64

Next moves the Uint64 one step forward.

func (*Uint64) Reset

func (generator *Uint64) Reset() uint64

Reset returns a current value of the Uint64 and resets it.

Jump to

Keyboard shortcuts

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