summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcitrons <citrons@mondecitronne.com>2025-07-25 18:23:37 -0500
committercitrons <citrons@mondecitronne.com>2025-07-25 18:23:37 -0500
commit7c273294d6cefb3269071bbe0cde7735e8763116 (patch)
tree7c11a58da1adf82be9377c440b137e14d2d11c9c
parent751cca759b5298483b793e7b7622eaf5f426415a (diff)
make IDs lexically orderable
-rw-r--r--proto/id.go7
1 files changed, 6 insertions, 1 deletions
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 {