use crate::datatypes::values::Value;
use crate::graph::schema::GraphBackend;
use crate::graph::storage::GraphRead;
pub mod algorithms;
pub mod blueprint;
pub mod core;
pub mod dir_graph;
pub mod embedder;
pub mod explore;
pub mod features;
pub mod handle;
pub mod introspection;
pub mod io;
pub mod languages;
pub mod mutation;
pub mod schema;
pub mod session;
pub mod storage;
pub use dir_graph::DirGraph;
pub type EmbeddingColumnData = Vec<(String, Vec<(Value, Vec<f32>)>)>;
#[derive(Clone, Debug, Default)]
pub enum TemporalContext {
#[default]
Today,
At(chrono::NaiveDate),
During(chrono::NaiveDate, chrono::NaiveDate),
All,
}
impl TemporalContext {
pub fn is_all(&self) -> bool {
matches!(self, TemporalContext::All)
}
}
#[derive(Debug, Clone)]
pub struct SourceLocation {
pub type_name: String,
pub name: String,
pub qualified_name: String,
pub file_path: Option<String>,
pub line_number: Option<i64>,
pub end_line: Option<i64>,
pub signature: Option<String>,
}
#[derive(Debug, Clone)]
pub enum SourceLookup {
Found(SourceLocation),
Ambiguous(Vec<String>),
NotFound,
}
pub fn resolve_noderefs(graph: &GraphBackend, rows: &mut [Vec<Value>]) {
for row in rows.iter_mut() {
for val in row.iter_mut() {
if let Value::NodeRef(idx) = val {
let node_idx = petgraph::graph::NodeIndex::new(*idx as usize);
if let Some(node) = graph.node_weight(node_idx) {
*val = node.title().into_owned();
} else {
*val = Value::Null;
}
}
}
}
}