summaryrefslogtreecommitdiff
path: root/src/types/ids.rs
diff options
context:
space:
mode:
authorPROINT <>2026-07-22 14:41:42 +0700
committerPROINT <>2026-07-22 14:41:42 +0700
commit9cb86b850699dc5b19e2582f5a2c64c5acc0a24b (patch)
tree8ea8b9392646efd2b000c4064d72b96572de77ee /src/types/ids.rs
parent2fb9ff9efbafa582ca7e83f12c61548d8e7a93ed (diff)
Added AccountRepository trait
Diffstat (limited to 'src/types/ids.rs')
-rw-r--r--src/types/ids.rs43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/types/ids.rs b/src/types/ids.rs
new file mode 100644
index 0000000..03ebb59
--- /dev/null
+++ b/src/types/ids.rs
@@ -0,0 +1,43 @@
+use ulid::Ulid;
+
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
+pub struct AccountId(Ulid);
+
+impl AccountId {
+ pub(crate) fn from_ulid(ulid: Ulid) -> Self {
+ AccountId(ulid)
+ }
+ pub fn as_ulid(&self) -> Ulid {
+ self.0
+ }
+}
+
+impl std::fmt::Display for AccountId {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(f, "{}", self.0)
+ }
+}
+
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
+pub struct PostingId(Ulid);
+
+impl PostingId {
+ pub(crate) fn from_ulid(ulid: Ulid) -> Self {
+ PostingId(ulid)
+ }
+ pub fn as_ulid(&self) -> Ulid {
+ self.0
+ }
+}
+
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
+pub struct JournalEntryId(Ulid);
+
+impl JournalEntryId {
+ pub(crate) fn from_ulid(ulid: Ulid) -> Self {
+ JournalEntryId(ulid)
+ }
+ pub fn as_ulid(&self) -> Ulid {
+ self.0
+ }
+}