web3-proxy/entities/src/rpc_accounting.rs

68 lines
1.9 KiB
Rust
Raw Normal View History

//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
2022-10-10 07:15:07 +03:00
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")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: u64,
pub rpc_key_id: Option<u64>,
2022-10-10 07:15:07 +03:00
pub chain_id: u64,
2022-12-12 07:39:54 +03:00
pub method: Option<String>,
pub error_response: bool,
2022-10-11 08:13:00 +03:00
pub period_datetime: DateTimeUtc,
2022-10-25 06:41:59 +03:00
pub frontend_requests: u64,
pub backend_requests: u64,
pub cache_misses: u64,
pub cache_hits: u64,
2022-10-11 08:13:00 +03:00
pub sum_request_bytes: u64,
pub min_request_bytes: u64,
#[sea_orm(column_type = "Double")]
2022-10-11 08:13:00 +03:00
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,
#[sea_orm(column_type = "Double")]
2022-10-11 08:13:00 +03:00
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,
#[sea_orm(column_type = "Double")]
2022-10-11 08:13:00 +03:00
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-12-14 05:13:23 +03:00
pub archive_request: bool,
pub origin: Option<String>,
pub migrated: Option<DateTimeUtc>,
2022-10-10 07:15:07 +03:00
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
2022-11-01 21:54:39 +03:00
belongs_to = "super::rpc_key::Entity",
2022-10-27 03:12:42 +03:00
from = "Column::RpcKeyId",
2022-11-01 21:54:39 +03:00
to = "super::rpc_key::Column::Id",
2022-10-10 07:15:07 +03:00
on_update = "NoAction",
on_delete = "NoAction"
)]
2022-11-01 21:54:39 +03:00
RpcKey,
2022-10-10 07:15:07 +03:00
}
2022-11-01 21:54:39 +03:00
impl Related<super::rpc_key::Entity> for Entity {
2022-10-10 07:15:07 +03:00
fn to() -> RelationDef {
2022-11-01 21:54:39 +03:00
Relation::RpcKey.def()
2022-10-10 07:15:07 +03:00
}
}
impl ActiveModelBehavior for ActiveModel {}