Struct rusted_cypher::cypher::statement::Statement
[−]
[src]
pub struct Statement { /* fields omitted */ }
Represents a statement to be sent to the server
Methods
impl Statement
[src]
fn new<T: Into<String>>(statement: T) -> Self
fn statement(&self) -> &str
Returns the statement text
fn add_param<K, V>(&mut self, key: K, value: V) -> Result<(), JsonError> where
K: Into<String>,
V: Serialize + Copy,
K: Into<String>,
V: Serialize + Copy,
Adds parameter to the Statement
The parameter value is serialized into a Value
. Since the serialization can fail, the
method returns a Result
fn with_param<K, V>(self, key: K, value: V) -> Result<Self, JsonError> where
K: Into<String>,
V: Serialize + Copy,
K: Into<String>,
V: Serialize + Copy,
Adds parameter in builder style
This method consumes self
and returns it with the parameter added, so the binding does
not need to be mutable
Examples
let statement = Statement::new("MATCH n RETURN n") .with_param("param1", "value1")? .with_param("param2", 2)? .with_param("param3", 3.0)?;
fn param<T: DeserializeOwned>(&self, key: &str) -> Option<Result<T, Error>>
Gets the value of the parameter
Returns None
if there is no parameter with the given name or Some(serde_json::error::Error)
if the parameter cannot be converted back from
serde_json::value::Value`
fn parameters(&self) -> &BTreeMap<String, Value>
Gets a reference to the underlying parameters BTreeMap
fn set_parameters<T: Serialize>(
&mut self,
params: &BTreeMap<String, T>
) -> Result<(), JsonError>
&mut self,
params: &BTreeMap<String, T>
) -> Result<(), JsonError>
Sets the parameters BTreeMap
, overriding current values
fn remove_param(&mut self, key: &str)
Removes parameter from the statment
Trying to remove a non-existent parameter has no effect
Trait Implementations
impl Clone for Statement
[src]
fn clone(&self) -> Statement
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for Statement
[src]
impl<T: Into<String>> From<T> for Statement
[src]
fn from(stmt: T) -> Self
Performs the conversion.