use std::collections::HashMap;
use std::path::PathBuf;
use prqlc::ir::decl::RootModule;
use prqlc::ir::pl::Ident;
use prqlc::SourceTree;
#[derive(Debug, Default)]
pub struct ProjectDiscovered {
pub root_path: PathBuf,
pub sources: HashMap<PathBuf, String>,
}
#[derive(Debug)]
pub struct ProjectCompiled {
pub sources: SourceTree,
pub root_module: RootModule,
pub database_module: DatabaseModule,
pub queries: HashMap<Ident, String>,
}
#[derive(Debug)]
pub struct DatabaseModule {
pub path: Vec<String>,
pub def_id: Option<usize>,
pub connection_params: SqliteConnectionParams,
}
#[derive(Debug)]
pub struct SqliteConnectionParams {
pub file_relative: std::path::PathBuf,
}
impl std::fmt::Display for ProjectDiscovered {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut r = format!("path: {}\nsources:\n", self.root_path.to_string_lossy());
for source in self.sources.keys() {
r += "- ";
r += &source.to_string_lossy();
r += "\n";
}
f.write_str(&r)
}
}