diff --git a/helix-db/src/utils/id.rs b/helix-db/src/utils/id.rs index f6eb980d..e29035f8 100644 --- a/helix-db/src/utils/id.rs +++ b/helix-db/src/utils/id.rs @@ -25,6 +25,10 @@ impl ID { self.0 } + pub fn id(&self) -> u128 { + self.0 + } + pub fn stringify(&self) -> String { uuid::Uuid::from_u128(self.0).to_string() } @@ -117,14 +121,12 @@ pub fn v6_uuid() -> u128 { uuid::Uuid::now_v6(&[1, 2, 3, 4, 5, 6]).as_u128() } - #[cfg(test)] mod tests { use sonic_rs::json; use super::*; - #[test] fn test_uuid_deserialization() { let uuid = json!({ "id": "1f07ae4b-e354-6660-b5f0-fd3ce8bc4b49" }); @@ -134,9 +136,11 @@ mod tests { id: ID, } - let deserialized: IDWrapper = sonic_rs::from_value(&uuid).unwrap(); - assert_eq!(deserialized.id.stringify(), "1f07ae4b-e354-6660-b5f0-fd3ce8bc4b49"); + assert_eq!( + deserialized.id.stringify(), + "1f07ae4b-e354-6660-b5f0-fd3ce8bc4b49" + ); } #[test] @@ -151,4 +155,4 @@ mod tests { assert_eq!(uuid.to_string(), "1f07ae4b-e354-6660-b5f0-fd3ce8bc4b49"); } -} \ No newline at end of file +}