u64

package
v1.1.23 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package u64 是 uint64类库.

函数: Byte2, Uint64, ID, Rand. 对象: U64.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(i uint64) []byte

Bytes uint64 to []byte.

func DecodeID added in v1.0.56

func DecodeID(id uint64) (ts uint64, serial uint64, machine uint64)

DecodeID id解码.

func ID added in v1.0.56

func ID() uint64

ID 获取ID.

Example
package main

import (
	"fmt"

	"gitee.com/xuender/oils/u64"
)

func main() {
	fmt.Println(u64.ID())
	fmt.Println(u64.ID())
}
Output:

func NewID

func NewID(num uint64) uint64

NewID 新建ID. num 4位 16个. 起始日期 2021-10-31 日. 合计53位,js中使用不会出错.

Example
package main

import (
	"fmt"

	"gitee.com/xuender/oils/u64"
)

func main() {
	fmt.Println(u64.NewID(3))
	id := u64.ID()
	fmt.Println(id)
	fmt.Println(u64.DecodeID(id))
}
Output:

func Parse added in v1.0.62

func Parse(str string) uint64

func Rand added in v1.0.60

func Rand() uint64

Rand 随机数,兼容JS数值长度.

Example
package main

import (
	"fmt"

	"gitee.com/xuender/oils/u64"
)

func main() {
	fmt.Println(u64.Rand())
}
Output:

func Uint64

func Uint64(bytes []byte) uint64

Uint64 []byte to Uint64.

Types

type U64

type U64 uint64

U64 uint64对象.

func (U64) Bytes

func (u U64) Bytes() []byte

Bytes 转换字节码.

Jump to

Keyboard shortcuts

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