Skip to main content

knowledge_base_crud/read/
contexts.rs

1use crate::{Error, KnowledgeBaseRepository, filesystem};
2use knowledge_base_models::EntityId;
3
4#[derive(Clone, Copy, Debug)]
5pub struct EntityContexts<'a> {
6    repository: &'a KnowledgeBaseRepository,
7}
8
9impl<'a> EntityContexts<'a> {
10    pub(crate) fn new(repository: &'a KnowledgeBaseRepository) -> Self {
11        Self { repository }
12    }
13
14    pub fn read(&self, id: &EntityId) -> Result<String, Error> {
15        filesystem::read(self.repository.root(), "entity_context", id.as_str(), "md")
16    }
17}