Trait apache_age::AgeClient
source · [−]pub trait AgeClient {
fn connect_age<T>(params: &str, tls_mode: T) -> Result<Client, Error>
where
T: MakeTlsConnect<Socket> + 'static + Send,
T::TlsConnect: Send,
T::Stream: Send,
<T::TlsConnect as TlsConnect<Socket>>::Future: Send;
fn constraint(
&mut self,
graph: &str,
label: &str,
name: &str,
constraint_text: &str
) -> Result<u64, Error>;
fn unique_index(
&mut self,
graph: &str,
label: &str,
name: &str,
field: &str
) -> Result<u64, Error>;
fn required_constraint(
&mut self,
graph: &str,
label: &str,
name: &str,
field: &str
) -> Result<u64, Error>;
fn create_graph(&mut self, name: &str) -> Result<u64, Error>;
fn drop_graph(&mut self, name: &str) -> Result<u64, Error>;
fn graph_exists(&mut self, name: &str) -> Result<bool, Error>;
fn execute_cypher<T>(
&mut self,
graph: &str,
cypher: &str,
agtype: Option<AgType<T>>
) -> Result<u64, Error>
where
T: Serialize,
T: Debug,
T: Sync;
fn query_cypher<T>(
&mut self,
graph: &str,
cypher: &str,
agtype: Option<AgType<T>>
) -> Result<Vec<Row>, Error>
where
T: Serialize,
T: Debug,
T: Sync;
}Expand description
Handles connecting, configuring and querying graph dbs within postgres instance
Required Methods
sourcefn connect_age<T>(params: &str, tls_mode: T) -> Result<Client, Error>where
fn connect_age<T>(params: &str, tls_mode: T) -> Result<Client, Error>where
T: MakeTlsConnect<Socket> + 'static + Send,
T::TlsConnect: Send,
T::Stream: Send,
<T::TlsConnect as TlsConnect<Socket>>::Future: Send,
Create a new constraint for the certain label within graph
IMPORTANT: At least one object has to be created with a certain label
Create unique index for the certain field for the label within graph
IMPORTANT: At least one object has to be created with a certain label
sourcefn required_constraint(
fn required_constraint(
&mut self,
graph: &str,
label: &str,
name: &str,
field: &str
) -> Result<u64, Error>
Exexute cypher query, without any rows to be retured
Query cypher for a single agtype (in a format of json)
IMPORTANT: You need to return result of the query as a map
Example:
MATCH (n: Person) WHERE n.name = 'Alfred' RETURN {name: n.name, surname: n.surname}