~jan0sch/smederee

Showing details for patch ded56d3375c203e9dfaf322ada87703eeaf518c4.
2023-06-16 (Fri), 2:34 PM - Jens Grassel - ded56d3375c203e9dfaf322ada87703eeaf518c4

Add Ordering and Order for Username type.

Summary of changes
1 files modified with 3 lines added and 1 lines removed
  • modules/security/src/main/scala/de/smederee/security/Username.scala with 3 added and 1 removed lines
diff -rN -u old-smederee/modules/security/src/main/scala/de/smederee/security/Username.scala new-smederee/modules/security/src/main/scala/de/smederee/security/Username.scala
--- old-smederee/modules/security/src/main/scala/de/smederee/security/Username.scala	2025-01-16 03:15:34.217188107 +0000
+++ new-smederee/modules/security/src/main/scala/de/smederee/security/Username.scala	2025-01-16 03:15:34.217188107 +0000
@@ -29,7 +29,9 @@
   */
 opaque type Username = String
 object Username {
-  given Eq[Username] = Eq.fromUniversalEquals
+  given Eq[Username]       = Eq.fromUniversalEquals
+  given Ordering[Username] = (x: Username, y: Username) => x.compareTo(y)
+  given Order[Username]    = Order.fromOrdering
 
   val MinimumLength: Int    = 2
   val MaximumLength: Int    = 31