web3-proxy/entities/src/rpc_accounting.rs

64 lines
1.8 KiB
Rust
Raw Normal View History

2022-10-10 07:15:07 +03:00
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.1
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
2022-10-11 08:13:00 +03:00
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
2022-10-10 07:15:07 +03:00
#[sea_orm(table_name = "rpc_accounting")]
2022-10-11 08:13:00 +03:00
/// TODO: make migrations match these items
2022-10-10 07:15:07 +03:00
pub struct Model {
#[sea_orm(primary_key)]
pub id: u64,
pub user_key_id: u64,
pub chain_id: u64,
pub method: String,
pub error_response: bool,
2022-10-11 08:13:00 +03:00
pub period_datetime: DateTimeUtc,
pub frontend_requests: u32,
pub backend_requests: u32,
pub backend_retries: u32,
pub cache_misses: u32,
pub cache_hits: u32,
pub sum_request_bytes: u64,
pub min_request_bytes: u64,
pub mean_request_bytes: f64,
pub p50_request_bytes: u64,
pub p90_request_bytes: u64,
pub p99_request_bytes: u64,
pub max_request_bytes: u64,
pub sum_response_millis: u64,
pub min_response_millis: u64,
pub mean_response_millis: f64,
pub p50_response_millis: u64,
pub p90_response_millis: u64,
pub p99_response_millis: u64,
pub max_response_millis: u64,
pub sum_response_bytes: u64,
pub min_response_bytes: u64,
pub mean_response_bytes: f64,
pub p50_response_bytes: u64,
pub p90_response_bytes: u64,
pub p99_response_bytes: u64,
pub max_response_bytes: u64,
2022-10-10 07:15:07 +03:00
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::user_keys::Entity",
from = "Column::UserKeyId",
to = "super::user_keys::Column::Id",
on_update = "NoAction",
on_delete = "NoAction"
)]
UserKeys,
}
impl Related<super::user_keys::Entity> for Entity {
fn to() -> RelationDef {
Relation::UserKeys.def()
}
}
impl ActiveModelBehavior for ActiveModel {}