From f878f0b5eaa44e8ee8d67cbfd706926ff2119113 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Tue, 1 Oct 2024 23:57:22 -0400 Subject: Organize IDs into top-level namespaces. (This is part of a larger reorganization.) --- src/repo/channel.rs | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) (limited to 'src/repo/channel.rs') diff --git a/src/repo/channel.rs b/src/repo/channel.rs index ad42710..9f1d930 100644 --- a/src/repo/channel.rs +++ b/src/repo/channel.rs @@ -1,12 +1,10 @@ -use std::fmt; - use sqlx::{sqlite::Sqlite, SqliteConnection, Transaction}; use super::sequence::Sequence; use crate::{ + channel::Id, clock::DateTime, events::types::{self}, - id::Id as BaseId, }; pub trait Provider { @@ -176,38 +174,3 @@ impl<'c> Channels<'c> { Ok(channels) } } - -// Stable identifier for a [Channel]. Prefixed with `C`. -#[derive( - Clone, - Debug, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - sqlx::Type, - serde::Deserialize, - serde::Serialize, -)] -#[sqlx(transparent)] -#[serde(transparent)] -pub struct Id(BaseId); - -impl From for Id { - fn from(id: BaseId) -> Self { - Self(id) - } -} - -impl Id { - pub fn generate() -> Self { - BaseId::generate("C") - } -} - -impl fmt::Display for Id { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - self.0.fmt(f) - } -} -- cgit v1.2.3