genid

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateOrderNo

func GenerateOrderNo(orderType OrderType) (string, error)

GenerateOrderNo 生成订单编号。 参数:

orderType: 订单类型。如果为空,默认使用 DefaultOrder。

返回值:

string: 生成的订单编号。
error: 如果生成唯一ID失败,则返回错误。

func GenerateTransferInOrder

func GenerateTransferInOrder() (string, error)

func GenerateTransferOutOrder

func GenerateTransferOutOrder() (string, error)

func ValidateOrderNo

func ValidateOrderNo(orderNo string) bool

ValidateOrderNo 验证订单号是否有效。 订单号的有效性基于以下两个条件: 1. 订单号的长度必须不少于11位。 2. 订单号的前缀必须是有效的订单类型前缀之一。 参数:

orderNo - 待验证的订单号字符串。

返回值:

如果订单号有效,返回true;否则返回false。

Types

type OrderType

type OrderType string

OrderType represents different types of orders

const (
	// TransferIn represents incoming transfer orders
	TransferIn OrderType = "TI" // 充值
	// TransferOut represents outgoing transfer orders
	TransferOut OrderType = "TO" // 提现
	// DefaultOrder represents default order type
	DefaultOrder OrderType = "DO" // 默认
)

Jump to

Keyboard shortcuts

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