Initial commit
This commit is contained in:
commit
dccfa2d4cf
19 changed files with 3156 additions and 0 deletions
21
dao/src/lib.rs
Normal file
21
dao/src/lib.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
use std::{future::Future, sync::Arc};
|
||||
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum DaoError {
|
||||
#[error("Database query error: {0}")]
|
||||
DatabaseQueryError(#[from] Box<dyn std::error::Error>),
|
||||
}
|
||||
|
||||
pub trait HelloDao {
|
||||
fn get_hello(&self) -> impl Future<Output = Result<Arc<str>, DaoError>> + Send;
|
||||
}
|
||||
|
||||
pub trait PermissionDao {
|
||||
fn has_privilege(
|
||||
&self,
|
||||
user: &str,
|
||||
privilege: &str,
|
||||
) -> impl Future<Output = Result<bool, DaoError>> + Send;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue