diff options
Diffstat (limited to 'src/artist.rs')
-rw-r--r-- | src/artist.rs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/artist.rs b/src/artist.rs index 476dad9..0ea9131 100644 --- a/src/artist.rs +++ b/src/artist.rs @@ -1,9 +1,9 @@ use crate::error::Error; use crate::Result; -#[derive(sqlx::FromRow)] +#[derive(sqlx::FromRow, sqlx::Type)] pub struct Artist { - id: Option<i32>, + artist_id: Option<i32>, pub handle: String, pub name: Option<String>, pub bio: Option<String>, @@ -11,7 +11,17 @@ pub struct Artist { } impl Artist { - pub fn id(&self) -> Option<i32> { - self.id + pub fn new(handle: String) -> Self { + Self { + artist_id: None, + handle, + name: None, + bio: None, + site: None, + } + } + + pub fn artist_id(&self) -> Option<i32> { + self.artist_id } } |