cognee_database/entities/
node.rs1use sea_orm::entity::prelude::*;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
5#[sea_orm(table_name = "nodes")]
6pub struct Model {
7 #[sea_orm(primary_key, auto_increment = false)]
8 pub id: String,
9 pub slug: String,
10 pub user_id: String,
11 pub data_id: String,
12 #[sea_orm(indexed)]
13 pub dataset_id: String,
14 #[sea_orm(column_type = "Text", nullable)]
15 pub label: Option<String>,
16 #[sea_orm(column_name = "type", column_type = "Text")]
17 pub node_type: String,
18 #[sea_orm(column_type = "Json")]
19 pub indexed_fields: Json,
20 #[sea_orm(column_type = "Json", nullable)]
21 pub attributes: Option<Json>,
22 pub created_at: DateTimeUtc,
23}
24
25#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
26pub enum Relation {
27 #[sea_orm(
28 belongs_to = "super::dataset::Entity",
29 from = "Column::DatasetId",
30 to = "super::dataset::Column::Id"
31 )]
32 Dataset,
33}
34
35impl ActiveModelBehavior for ActiveModel {}