pub struct Database {
pub pool: PgPool,
}
Fields
pool: PgPool
Implementations
sourceimpl Database
impl Database
pub async fn migrate(&self) -> Result<(), ServiceError>
pub async fn ping(&self) -> bool
sourcepub async fn delete_user(&self, username: &str) -> Result<(), ServiceError>
pub async fn delete_user(&self, username: &str) -> Result<(), ServiceError>
delete a user
sourcepub async fn username_exists(&self, username: &str) -> Result<bool, ServiceError>
pub async fn username_exists(&self, username: &str) -> Result<bool, ServiceError>
check if username exists
sourcepub async fn email_exists(&self, email: &str) -> Result<bool, ServiceError>
pub async fn email_exists(&self, email: &str) -> Result<bool, ServiceError>
check if email exists
sourcepub async fn update_email(&self, p: &UpdateEmail<'_>) -> Result<(), ServiceError>
pub async fn update_email(&self, p: &UpdateEmail<'_>) -> Result<(), ServiceError>
update a user’s email
sourcepub async fn get_password(&self, l: &Login<'_>) -> Result<NameHash, ServiceError>
pub async fn get_password(&self, l: &Login<'_>) -> Result<NameHash, ServiceError>
get a user’s password
sourcepub async fn update_password(&self, p: &NameHash) -> Result<(), ServiceError>
pub async fn update_password(&self, p: &NameHash) -> Result<(), ServiceError>
update user’s password
sourcepub async fn update_username(
&self,
current: &str,
new: &str
) -> Result<(), ServiceError>
pub async fn update_username(
&self,
current: &str,
new: &str
) -> Result<(), ServiceError>
update username
pub async fn add_site(&self, msg: &Site) -> Result<(), ServiceError>
pub async fn get_site(
&self,
owner: &str,
hostname: &str
) -> Result<Site, ServiceError>
pub async fn list_all_sites(
&self,
owner: &str
) -> Result<Vec<Site>, ServiceError>
pub async fn delete_site(
&self,
owner: &str,
hostname: &str
) -> Result<(), ServiceError>
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Database
impl Send for Database
impl Sync for Database
impl Unpin for Database
impl !UnwindSafe for Database
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more