Documentation ¶
Index ¶
- Constants
- Variables
- func GenId(t time.Time, ts int64, workerId int64, seq int64) (id int64)
- func GetProjectStartTime() (t time.Time)
- func InitWithDB(dbType DBType, dsn string) (err error)
- func ParseId(id int64) (t time.Time, ts int64, workerId int64, seq int64)
- func SetProjectStartTime(t time.Time)
- type DBType
- type IdWorker
Constants ¶
View Source
const ( WorkerIdBits = 10 // Num of WorkerId Bits SequenceBits = 12 // Num of Sequence Bits WorkerIdShift = 12 TimeStampShift = 22 )
Variables ¶
View Source
var ( MaxWorker = maxInt(WorkerIdBits) SequenceMask = maxInt(SequenceBits) )
Functions ¶
func GetProjectStartTime ¶
func InitWithDB ¶
func SetProjectStartTime ¶
Types ¶
type IdWorker ¶
type IdWorker struct {
// contains filtered or unexported fields
}
IdWorker Struct
func NewIdWorker ¶
NewIdWorker Func: Generate NewIdWorker with Given workerid
Click to show internal directories.
Click to hide internal directories.