Archived
2
0
This repository has been archived on 2025-04-21. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
repo/database/src/port.rs
T

25 lines
656 B
Rust

pub type Result<T = ()> = std::result::Result<T, Box<dyn std::error::Error>>;
#[allow(async_fn_in_trait)]
pub trait CRUD<C> {
type New;
type Unique;
type Update;
type Existing;
async fn create(connection: &mut C, data: Self::New) -> Result<Self::Existing>;
async fn read(connection: &C, data: Self::Unique) -> Result<Option<Self::Existing>>;
async fn update(
connection: &mut C,
existing: &mut Self::Existing,
data: Self::Update,
) -> Result;
async fn delete(connection: &mut C, data: Self::Unique) -> Result;
}
const TOO_LONG: &str = "too long";
pub mod base;
pub mod package;
pub mod user;