Documentation
¶
Index ¶
- Constants
- func GetLongID() (i int64)
- func Lock(key string)
- func NextID() int64
- func ParseId(id int64) (t time.Time, ts int64, workerId int64, seq int64)
- func QuickSort2(arrInter interface{}, compare func(x, y uintptr) bool)
- func RLock(key string)
- func RUnLock(key string)
- func UnLock(key string)
- type IP
- type IPInfo
- type IdWorker
Constants ¶
View Source
const ( CEpoch = 1474802888000 CWorkerIdBits = 10 // Num of WorkerId Bits CSenquenceBits = 12 // Num of Sequence Bits CWorkerIdShift = 12 CTimeStampShift = 22 CSequenceMask = 0xfff // equal as getSequenceMask() CMaxWorker = 0x3ff // equal as getMaxWorkerId() )
Variables ¶
This section is empty.
Functions ¶
func QuickSort2 ¶
只支持指针数组,通过指针侵入数组,但是对于compare里的uintptr要做转换,如下: str := (*string)(unsafe.Pointer(x))
Types ¶
type IP ¶
type IP struct { IP string `json:"ip"` Country string `json:"country"` Area string `json:"area"` Region string `json:"region"` City string `json:"city"` Isp string `json:"isp"` CountryID string `json:"country_id"` AreaID string `json:"area_id"` RegionID string `json:"region_id"` CityID string `json:"city_id"` IspID string `json:"isp_id"` }
type IdWorker ¶
type IdWorker struct {
// contains filtered or unexported fields
}
IdWorker Struct
var IW *IdWorker
func NewIdWorker ¶
NewIdWorker Func: Generate NewIdWorker with Given workerid
Click to show internal directories.
Click to hide internal directories.