firedbg_stream_indexer/entity/
event.rs1use sea_orm::entity::prelude::*;
2use serde::Serialize;
3
4#[derive(Debug, Clone, PartialEq, Eq, DeriveEntityModel, Serialize)]
5#[sea_orm(table_name = "event")]
6pub struct Model {
7 #[sea_orm(primary_key, column_type = "Integer")]
8 pub id: i64,
9 pub breakpoint_id: u32,
10 pub thread_id: i64,
12 #[sea_orm(indexed)]
13 pub frame_id: i64,
14 pub parent_frame_id: Option<i64>,
15 pub stack_pointer: Option<i64>,
16 pub function_name: Option<String>,
17 pub event_type: EventType,
18 pub timestamp: TimeDateTimeWithTimeZone,
19 pub data: String,
21 pub pretty: String,
23 pub is_error: bool,
25}
26
27#[derive(Debug, Copy, Clone, EnumIter, DeriveRelation)]
28pub enum Relation {
29 #[sea_orm(
30 belongs_to = "super::breakpoint::Entity",
31 from = "Column::BreakpointId",
32 to = "super::breakpoint::Column::Id"
33 )]
34 Breakpoint,
35}
36
37impl Related<super::file::Entity> for Entity {
38 fn to() -> RelationDef {
39 Relation::Breakpoint.def()
40 }
41}
42
43impl ActiveModelBehavior for ActiveModel {}
44
45#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, DeriveDisplay)]
46#[sea_orm(
47 rs_type = "String",
48 db_type = "String(Some(1))",
49 enum_name = "event_type"
50)]
51pub enum EventType {
52 #[sea_orm(string_value = "B")]
53 Breakpoint,
54 #[sea_orm(string_value = "P")]
55 Panic,
56 #[sea_orm(string_value = "F")]
57 FunctionCall,
58 #[sea_orm(string_value = "R")]
59 FunctionReturn,
60}
61
62impl Serialize for EventType {
63 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
64 where
65 S: serde::Serializer,
66 {
67 serializer.serialize_str(&self.to_string())
68 }
69}