Skip to main content

cognee_models/
dataset.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use uuid::Uuid;
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct Dataset {
7    pub id: Uuid,
8    pub name: String,
9    pub owner_id: Uuid,
10    pub tenant_id: Option<Uuid>,
11    pub created_at: DateTime<Utc>,
12    pub updated_at: Option<DateTime<Utc>>,
13}
14
15impl Dataset {
16    /// Create a new Dataset.
17    ///
18    /// `id` must be passed by the caller (use `generate_dataset_id` for Python-compatible
19    /// deterministic IDs, or `Uuid::new_v4()` for a random ID).
20    pub fn new(name: String, owner_id: Uuid, tenant_id: Option<Uuid>, id: Uuid) -> Self {
21        Self {
22            id,
23            name,
24            owner_id,
25            tenant_id,
26            created_at: Utc::now(),
27            updated_at: None,
28        }
29    }
30}