Initial commit
This commit is contained in:
commit
dccfa2d4cf
19 changed files with 3156 additions and 0 deletions
10
dao/Cargo.toml
Normal file
10
dao/Cargo.toml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[package]
|
||||
name = "dao"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
thiserror = "1.0.59"
|
||||
uuid = "1.8"
|
||||
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