From 7c273294d6cefb3269071bbe0cde7735e8763116 Mon Sep 17 00:00:00 2001 From: citrons Date: Fri, 25 Jul 2025 18:23:37 -0500 Subject: make IDs lexically orderable --- proto/id.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'proto') diff --git a/proto/id.go b/proto/id.go index ae74718..9cb092e 100644 --- a/proto/id.go +++ b/proto/id.go @@ -13,7 +13,12 @@ func GenId() string { t := time.Now().UnixMilli() - epoch.UnixMilli() id := uint64(t << 6) | uint64(counter.Load() & 63) counter.Add(1) - return strconv.FormatUint(id, 36) + + var result string + for _, c := range strconv.FormatUint(id, 36) { + result = string(c) + result + } + return result } func Timestamp() string { -- cgit v1.2.3