diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2024-09-14 00:16:51 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2024-09-14 00:18:08 -0400 |
| commit | 5249aad35741f6f029c442a04d679937fb91d2bb (patch) | |
| tree | c75085a93538367ae3f5da8f64f90b33a3c8feef /src/channel/repo/channels.rs | |
| parent | 407ca8df6284ce1a4c649b018c7326fd195bbd26 (diff) | |
Placeholder UX, probably
Diffstat (limited to 'src/channel/repo/channels.rs')
| -rw-r--r-- | src/channel/repo/channels.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/channel/repo/channels.rs b/src/channel/repo/channels.rs index 6fb0c23..fc52aa3 100644 --- a/src/channel/repo/channels.rs +++ b/src/channel/repo/channels.rs @@ -44,6 +44,22 @@ impl<'c> Channels<'c> { Ok(channel) } + pub async fn by_id(&mut self, channel: Id) -> Result<Channel, BoxedError> { + let channel = sqlx::query_as!( + Channel, + r#" + select id as "id: Id", name + from channel + where id = $1 + "#, + channel, + ) + .fetch_one(&mut *self.0) + .await?; + + Ok(channel) + } + pub async fn all(&mut self) -> Result<Vec<Channel>, BoxedError> { let channels = sqlx::query_as!( Channel, |
