Documentation ¶
Overview ¶
Package utils *
- @Author:manguanghui
- @Date: 2021/11/22
- @Desc: 生成雪花算法ID
*
Package utils *
- @Author:manguanghui
- @Date: 2021/11/22
- @Desc:
*
Index ¶
- Constants
- func Base64Decode(str string) []byte
- func Base64Encode(str []byte) string
- func CreateFile(filepath string)
- func FileSuffix(path string) string
- func GeneratedID() string
- func GetOutboundIP() (string, error)
- func GoId() int64
- func IsNotString(str string) bool
- func IsString(str string) bool
- func Md5(str string) string
- func NowDate() string
- func NowDateTime() string
- func NowParseDate(date string) (time.Time, error)
- func NowUnix() int64
- func ParseId(id int64) (t time.Time, ts int64, workerId int64, seq int64)
- func SHA256(message []byte) string
- func String(value interface{}) string
- func ZlibUnCompress(compressSrc []byte) ([]byte, error)
- type IdWorker
Constants ¶
View Source
const ( CEpoch = 1474802888000 CWorkerIdBits = 10 // Num of WorkerId Bits CSequenceBits = 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 IsNotString ¶
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.