Struct rusted_cypher::Statement
[−]
[src]
pub struct Statement { // some fields omitted }
Represents a statement to be sent to the server
Methods
impl Statement
fn new(statement: &str) -> Self
fn statement(&self) -> &str
Returns the statement text
fn with_param<V: Serialize + Copy>(self, key: &str, value: V) -> Self
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 add_param<V: Serialize + Copy>(&mut self, key: &str, value: V)
Adds parameter to the Statement
fn param<V: Deserialize>(&self, key: &str) -> Option<Result<V, 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 get_param<V: Deserialize>(&self, key: &str) -> Option<Result<V, Error>>
deprecated: use Statement::param
instead
fn parameters(&self) -> &BTreeMap<String, Value>
Gets a reference to the underlying parameters BTreeMap
fn get_params(&self) -> &BTreeMap<String, Value>
deprecated: use Statement::parameters
instead
fn set_parameters<V: Serialize>(&mut self, params: &BTreeMap<String, V>)
Sets the parameters BTreeMap
, overriding current values
fn set_params<V: Serialize>(&mut self, params: &BTreeMap<String, V>)
deprecated: use Statement::set_parameters
instead
fn remove_param(&mut self, key: &str)
Removes parameter from the statment
Trying to remove a non-existent parameter has no effect