maker

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppID added in v1.0.4

func AppID(prefix string) string

AppID 生成 APP ID,除 prefix 外长度15位,组成结构参考 AppIDWith

func AppIDWith added in v1.0.4

func AppIDWith(prefix string, length uint) string

AppIDWith 生成 APP ID,长度12-20位,受第二参数 length 约束,组成结构如下: |00|111|22222|33333|

|  |    |     |
|  |    |     `-------- 当日的秒数(5位)
|  |    `-------------- 随机数补位(2-10位)
|  `------------------- 当日是一年中的第几日,[000, 366](3位)
 `---------------------- 年份最后2位(2位)

func TransNo

func TransNo(uid uint) string

TransNo 生成用户订单号,长度24位,组成结构参考 TransNoWith

func TransNoWith

func TransNoWith(uid, length uint) string

TransNoWith 生成用户订单号,长度16-32位,受第二参数 length 约束,组成结构如下: |00|111|22222|3333|44444|

|  |    |     |    |
|  |    |     |    `--- 当日的秒数(5位)
|  |    |      `------- 用户 ID 最后四位,[0001, 9999](4位)
|  |    `-------------- 随机数补位(2-18位)
|  `------------------- 当日是一年中的第几日,[000, 366](3位)
 `---------------------- 年份最后2位(2位)

Types

This section is empty.

Jump to

Keyboard shortcuts

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