nano

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UnixNanoID

type UnixNanoID struct {
	sync.Mutex
	// contains filtered or unexported fields
}

UnixNanoID use unix nano as id, but it must be increment.

func NewUnixNanoID

func NewUnixNanoID(current int64) *UnixNanoID

NewUnixNanoID new unix nano id

func (*UnixNanoID) GenID

func (n *UnixNanoID) GenID() int64

GenID generate id

func (*UnixNanoID) GenIDByTS

func (n *UnixNanoID) GenIDByTS(ts int64) int64

GenIDByTS swap, if bigger than current, return it

type UnixNanoNoLockID

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

UnixNanoNoLockID lock free -- without lock lock control by caller user

func NewUnixNanoNoLockID

func NewUnixNanoNoLockID(current int64) *UnixNanoNoLockID

NewUnixNanoNoLockID new unix nano id -- without lock

func (*UnixNanoNoLockID) GenID

func (n *UnixNanoNoLockID) GenID() int64

GenID generate id

func (*UnixNanoNoLockID) GenIDByTS

func (n *UnixNanoNoLockID) GenIDByTS(ts int64) int64

GenIDByTS swap, if bigger than current, return it

Jump to

Keyboard shortcuts

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