use std::sync::Arc;
use surrealdb::Surreal;
use surrealdb::engine::any::Any;
mod cards;
mod core;
mod freshness;
mod graph;
mod import_export;
mod messages;
mod records;
mod sessions;
mod text_search;
mod vectors;
#[cfg(test)]
mod persist_tests;
#[cfg(test)]
mod tests;
pub(super) const MIN_VECTOR_LEN: usize = 8;
#[derive(Clone)]
pub struct SurrealDBStorage {
pub(super) db: Arc<Surreal<Any>>,
#[allow(dead_code)]
pub(super) namespace: String,
#[allow(dead_code)]
pub(super) database: String,
pub(super) persisted: Arc<sessions::PersistedStates>,
}
pub(super) const RELATION_TABLES: [(&str, post_cortex_core::core::context_update::RelationType);
8] = {
use post_cortex_core::core::context_update::RelationType;
[
("required_by", RelationType::RequiredBy),
("leads_to", RelationType::LeadsTo),
("related_to", RelationType::RelatedTo),
("conflicts_with", RelationType::ConflictsWith),
("depends_on", RelationType::DependsOn),
("implements", RelationType::Implements),
("caused_by", RelationType::CausedBy),
("solves", RelationType::Solves),
]
};
pub(super) fn per_relation_table(template: &str) -> String {
RELATION_TABLES
.iter()
.map(|(table, _)| template.replace("{table}", table))
.collect::<Vec<_>>()
.join(" ")
}