use crate::{CypherQueryResult, Result, Rudof, api::pg_db::PgDbOperations, formats::InputSpec};
use std::path::Path;
pub struct QueryCypherBuilder<'a> {
rudof: &'a mut Rudof,
query: &'a InputSpec,
db_path: Option<&'a Path>,
db_read_only: bool,
}
impl<'a> QueryCypherBuilder<'a> {
pub(crate) fn new(rudof: &'a mut Rudof, query: &'a InputSpec) -> Self {
Self {
rudof,
query,
db_path: None,
db_read_only: false,
}
}
pub fn with_db(mut self, path: &'a Path, read_only: bool) -> Self {
self.db_path = Some(path);
self.db_read_only = read_only;
self
}
pub fn execute(self) -> Result<CypherQueryResult> {
<Rudof as PgDbOperations>::query_cypher(self.rudof, self.query, self.db_path, self.db_read_only)
}
}