Documentation ¶
Index ¶
- Constants
- func Format(format string, date time.Time) string
- func GetLongID() (i int64)
- func GetPublicIP() string
- func Lock(key string)
- func NextID() int64
- func ParseId(id int64) (t time.Time, ts int64, workerId int64, seq int64)
- func RLock(key string)
- func RUnLock(key string)
- func UnLock(key string)
- type IP
- type IPInfo
- type IdWorker
- type SS_Scheme
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 Format ¶
Format formats a date based on joda conventions for performance this method recommended to be used
func GetPublicIP ¶
func GetPublicIP() string
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.