lang

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDeviceID

func GetDeviceID(sid int64) (dataCenterId, workerId int64)

GetDeviceID

@param sid
@return dataCenterId
@return workerId

func GetGenTime

func GetGenTime(sid int64) (t string)

GetGenTime

@param sid
@return t

func GetGenTimestamp

func GetGenTimestamp(sid int64) (timestamp int64)

GetGenTimestamp

@param sid
@return timestamp

func GetTimestamp

func GetTimestamp(sid int64) (timestamp int64)

GetTimestamp

@param sid
@return timestamp

func GetTimestampStatus

func GetTimestampStatus() (state float64)

GetTimestampStatus Get the percentage of timestamps used: range (0.0 - 1.0)

@return state

Types

type Snowflake

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

Snowflake Snowflake

func NewSnowflake

func NewSnowflake(dataCenterId, workerId int64) (*Snowflake, error)

NewSnowflake NewSnowflake

@param dataCenterId
@param workerId
@return *Snowflake
@return error

func (*Snowflake) NextVal

func (s *Snowflake) NextVal() int64

NextVal

@receiver s
@return int64

Jump to

Keyboard shortcuts

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