dbs

package
v0.2.18 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2022 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeID

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

DecodeID id解码.

func ID

func ID() uint64

ID 获取ID.

Example
package main

import (
	"fmt"

	"github.com/xuender/oils/dbs"
)

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

func NewID

func NewID(num uint64) uint64

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

Example
package main

import (
	"fmt"

	"github.com/xuender/oils/dbs"
)

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

func Rand

func Rand() uint64

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

Example
package main

import (
	"fmt"

	"github.com/xuender/oils/dbs"
)

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

Types

This section is empty.

Directories

Path Synopsis
Package gorms 数据库操作.
Package gorms 数据库操作.

Jump to

Keyboard shortcuts

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