pub trait Database:
Clone
+ Send
+ Sync
+ 'static {
Show 24 methods
// Required methods
fn get_team<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Team>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn create_team<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
budget_cents: i64,
) -> Pin<Box<dyn Future<Output = Result<Team, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_user<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<User>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_user_by_email<'life0, 'life1, 'async_trait>(
&'life0 self,
email: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<User>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn create_user<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
team_id: &'life1 str,
email: &'life2 str,
role: &'life3 str,
password_hash: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<User, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn update_password_hash<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
password_hash: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn count_users_by_role<'life0, 'life1, 'async_trait>(
&'life0 self,
role: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<i64, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_api_key<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ApiKey>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_api_key_by_hash<'life0, 'life1, 'async_trait>(
&'life0 self,
key_hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ApiKey>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn create_api_key<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
key_hash: &'life1 str,
user_id: &'life2 str,
team_id: &'life3 str,
name: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<ApiKey, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn deactivate_api_key<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ApiKey, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_model_alias<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ModelAlias>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn create_model_alias<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
team_id: &'life1 str,
alias: &'life2 str,
target_model: &'life3 str,
provider: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<ModelAlias, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
fn get_quota<'life0, 'life1, 'async_trait>(
&'life0 self,
team_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Quota>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn create_quota<'life0, 'life1, 'async_trait>(
&'life0 self,
team_id: &'life1 str,
rpm_limit: i32,
tpm_limit: i32,
) -> Pin<Box<dyn Future<Output = Result<Quota, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn record_usage<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
team_id: &'life1 str,
api_key_id: &'life2 str,
model: &'life3 str,
input_tokens: i32,
output_tokens: i32,
response_time_ms: i64,
) -> Pin<Box<dyn Future<Output = Result<UsageLog, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn list_deployments<'life0, 'life1, 'async_trait>(
&'life0 self,
model: &'life1 str,
is_active: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Deployment>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_deployment<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Deployment>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn create_deployment<'life0, 'async_trait>(
&'life0 self,
req: CreateDeploymentRequest,
) -> Pin<Box<dyn Future<Output = Result<Deployment, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update_deployment<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
req: CreateDeploymentRequest,
) -> Pin<Box<dyn Future<Output = Result<Deployment, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete_deployment<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_routing_config<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<RoutingConfig>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update_routing_config<'life0, 'async_trait>(
&'life0 self,
req: UpdateRoutingConfigRequest,
) -> Pin<Box<dyn Future<Output = Result<RoutingConfig, DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn ping<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Required Methods§
fn get_team<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Team>, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_team<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
budget_cents: i64,
) -> Pin<Box<dyn Future<Output = Result<Team, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_user<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<User>, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_user_by_email<'life0, 'life1, 'async_trait>(
&'life0 self,
email: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<User>, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_user<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
team_id: &'life1 str,
email: &'life2 str,
role: &'life3 str,
password_hash: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<User, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn update_password_hash<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
password_hash: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn count_users_by_role<'life0, 'life1, 'async_trait>(
&'life0 self,
role: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<i64, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_api_key<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ApiKey>, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_api_key_by_hash<'life0, 'life1, 'async_trait>(
&'life0 self,
key_hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ApiKey>, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_api_key<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
key_hash: &'life1 str,
user_id: &'life2 str,
team_id: &'life3 str,
name: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<ApiKey, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn deactivate_api_key<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ApiKey, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_model_alias<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ModelAlias>, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_model_alias<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
team_id: &'life1 str,
alias: &'life2 str,
target_model: &'life3 str,
provider: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<ModelAlias, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn get_quota<'life0, 'life1, 'async_trait>(
&'life0 self,
team_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Quota>, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_quota<'life0, 'life1, 'async_trait>(
&'life0 self,
team_id: &'life1 str,
rpm_limit: i32,
tpm_limit: i32,
) -> Pin<Box<dyn Future<Output = Result<Quota, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn record_usage<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
team_id: &'life1 str,
api_key_id: &'life2 str,
model: &'life3 str,
input_tokens: i32,
output_tokens: i32,
response_time_ms: i64,
) -> Pin<Box<dyn Future<Output = Result<UsageLog, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn list_deployments<'life0, 'life1, 'async_trait>(
&'life0 self,
model: &'life1 str,
is_active: Option<bool>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Deployment>, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_deployment<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Deployment>, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_deployment<'life0, 'async_trait>(
&'life0 self,
req: CreateDeploymentRequest,
) -> Pin<Box<dyn Future<Output = Result<Deployment, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_deployment<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
req: CreateDeploymentRequest,
) -> Pin<Box<dyn Future<Output = Result<Deployment, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_deployment<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_routing_config<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<RoutingConfig>, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_routing_config<'life0, 'async_trait>(
&'life0 self,
req: UpdateRoutingConfigRequest,
) -> Pin<Box<dyn Future<Output = Result<RoutingConfig, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn ping<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".