feat: Start dummy in-memory database
This commit is contained in:
parent
1ef02c58dd
commit
bdb5008914
9 changed files with 181 additions and 3 deletions
37
src/db/user.rs
Normal file
37
src/db/user.rs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
use std::fmt;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct UserRef {
|
||||
pub username: String,
|
||||
pub domain: String,
|
||||
}
|
||||
|
||||
impl fmt::Display for UserRef {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}@{}", self.username, self.domain)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct User {
|
||||
pub username: String,
|
||||
pub domain: String,
|
||||
pub password: String,
|
||||
pub mail: String,
|
||||
// recovery_mail: String,
|
||||
}
|
||||
|
||||
impl User {
|
||||
pub fn user_ref(&self) -> UserRef {
|
||||
UserRef {
|
||||
username: self.username.clone(),
|
||||
domain: self.domain.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for User {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}@{}", self.username, self.domain)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue