package order import ( "fmt" "git.k6n.net/mats/platform/uid" ) // OrderId is a 64-bit order identifier with a compact base62 string form. type OrderId uid.ID // String returns the canonical base62 encoding. func (id OrderId) String() string { return uid.ID(id).String() } // NewOrderId generates a cryptographically random non-zero id. func NewOrderId() (OrderId, error) { id, err := uid.New() if err != nil { return 0, fmt.Errorf("NewOrderId: %w", err) } return OrderId(id), nil } // ParseOrderId parses a base62 string into an OrderId. func ParseOrderId(s string) (OrderId, bool) { id, ok := uid.Parse(s) return OrderId(id), ok }