pub mod generated;
#[allow(unused_imports)]
pub use generated::*;
#[macro_use]
#[cfg(feature = "guest")]
extern crate serde_derive;
#[cfg(feature = "guest")]
mod results;
#[cfg(feature = "guest")]
pub use results::FromTable;
#[cfg(feature = "guest")]
mod conversions;
#[cfg(feature = "guest")]
mod errors;
#[cfg(feature = "guest")]
type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Sync + Send>>;
#[doc(hidden)]
#[macro_export]
#[cfg(feature = "guest")]
macro_rules! client_type_error {
($($arg:tt)*) => {
Err($crate::errors::GraphError::ClientTypeError(format!($($arg)*)))
};
}
#[cfg(feature = "guest")]
impl Host {
pub fn query_graph<T: FromTable>(
&self,
graph_name: String,
query: String,
) -> ::wapc_guest::HandlerResult<T> {
let res = self
._query_graph(graph_name.into(), query.into())
.map(|res| T::from_table(&res.result_set));
match res {
Ok(Ok(l)) => Ok(l),
_ => Err("Graph conversion error".into()),
}
}
}
pub const OP_QUERY: &str = "QueryGraph";
pub const OP_DELETE: &str = "DeleteGraph";