pub trait ToNodeBuilder<T: Display = Self>: Display {
Show 25 methods
// Provided methods
fn quoted(&self) -> String { ... }
fn with(&self, relation_or_node: &str) -> String { ... }
fn from(&self, node: &str) -> String { ... }
fn as_named_label(&self, label_name: &str) -> String { ... }
fn as_param(&self) -> String { ... }
fn equals(&self, value: &str) -> String { ... }
fn compares(&self, operator: &str, value: &str) -> String { ... }
fn compares_parameterized(&self, operator: &str) -> String { ... }
fn equals_parameterized(&self) -> String { ... }
fn plus_equal_parameterized(&self) -> String { ... }
fn greater_parameterized(&self) -> String { ... }
fn lower_parameterized(&self) -> String { ... }
fn greater_than(&self, value: &str) -> String { ... }
fn plus_equal(&self, value: &str) -> String { ... }
fn contains_one(&self, value: &str) -> String { ... }
fn contains_not(&self, value: &str) -> String { ... }
fn contains_all(&self, values: &str) -> String { ... }
fn contains_any(&self, values: &str) -> String { ... }
fn contains_none(&self, values: &str) -> String { ... }
fn as_alias(&self, alias: &str) -> String { ... }
fn filter(&self, condition: &str) -> String { ... }
fn comma(&self, right: &str) -> String { ... }
fn count(&self) -> String { ... }
fn with_id(&self, id: &str) -> String { ... }
fn with_composite_id(&self, id: &str) -> String { ... }
}
Provided Methods§
fn quoted(&self) -> String
Sourcefn with(&self, relation_or_node: &str) -> String
fn with(&self, relation_or_node: &str) -> String
Draws the start of a relation ->node
§Example
use surreal_simple_querybuilder::prelude::*;
let s = "user".with("project");
assert_eq!("user->project", s);
Sourcefn from(&self, node: &str) -> String
fn from(&self, node: &str) -> String
Draws the end of a relation <-node
§Example
use surreal_simple_querybuilder::prelude::*;
let s = "user".from("project");
assert_eq!("user<-project", s);
Sourcefn as_named_label(&self, label_name: &str) -> String
fn as_named_label(&self, label_name: &str) -> String
Take the current string and add in front of it the given label name as to
make a string of the following format LabelName:CurrentString
§Example
use surreal_simple_querybuilder::prelude::*;
let label = "John".as_named_label("Account");
assert_eq!(label, "Account:John");
fn as_param(&self) -> String
Sourcefn equals(&self, value: &str) -> String
fn equals(&self, value: &str) -> String
§Example
use surreal_simple_querybuilder::prelude::*;
let s = "user".equals("John");
// Note that it doesn't add quotes around strings
assert_eq!("user = John", s);
Sourcefn compares(&self, operator: &str, value: &str) -> String
fn compares(&self, operator: &str, value: &str) -> String
§Example
use surreal_simple_querybuilder::prelude::*;
let s = "age".compares(">=", "45");
assert_eq!("age >= 45", s);
Sourcefn compares_parameterized(&self, operator: &str) -> String
fn compares_parameterized(&self, operator: &str) -> String
Take the current string and add the given operator plus $current_string
after it
§Example
use surreal_simple_querybuilder::prelude::*;
let s = "age".compares_parameterized(">=");
assert_eq!("age >= $age", s);
Sourcefn equals_parameterized(&self) -> String
fn equals_parameterized(&self) -> String
Take the current string and add = $current_string
after it
§Example
use surreal_simple_querybuilder::prelude::*;
let s = "account".equals_parameterized();
assert_eq!("account = $account", s);
Sourcefn plus_equal_parameterized(&self) -> String
fn plus_equal_parameterized(&self) -> String
Take the current string and add += $current_string
after it
§Example
use surreal_simple_querybuilder::prelude::*;
let s = "account".plus_equal_parameterized();
assert_eq!("account += $account", s);
Sourcefn greater_parameterized(&self) -> String
fn greater_parameterized(&self) -> String
Take the current string and add > $current_string
after it
§Example
use surreal_simple_querybuilder::prelude::*;
let s = "age".greater_parameterized();
assert_eq!("age > $age", s);
Sourcefn lower_parameterized(&self) -> String
fn lower_parameterized(&self) -> String
Take the current string and add < $current_string
after it
§Example
use surreal_simple_querybuilder::prelude::*;
let s = "age".lower_parameterized();
assert_eq!("age < $age", s);
Sourcefn greater_than(&self, value: &str) -> String
fn greater_than(&self, value: &str) -> String
Take the current string and add > value
after it
§Example
use surreal_simple_querybuilder::prelude::*;
let s = "account".greater_than("5");
assert_eq!("account > 5", s);
Sourcefn plus_equal(&self, value: &str) -> String
fn plus_equal(&self, value: &str) -> String
Take the current string and add += value
after it
§Example
use surreal_simple_querybuilder::prelude::*;
let s = "friends".plus_equal("account:john");
assert_eq!("friends += account:john", s);
Sourcefn contains_one(&self, value: &str) -> String
fn contains_one(&self, value: &str) -> String
§Example
use surreal_simple_querybuilder::prelude::*;
let s = "account".contains_one("'c'");
assert_eq!("account CONTAINS 'c'", s);
Sourcefn contains_not(&self, value: &str) -> String
fn contains_not(&self, value: &str) -> String
§Example
use surreal_simple_querybuilder::prelude::*;
let s = "account".contains_not("'z'");
assert_eq!("account CONTAINSNOT 'z'", s);
Sourcefn contains_all(&self, values: &str) -> String
fn contains_all(&self, values: &str) -> String
§Example
use surreal_simple_querybuilder::prelude::*;
let s = "account".contains_all("['a', 'c', 'u']");
assert_eq!("account CONTAINSALL ['a', 'c', 'u']", s);
Sourcefn contains_any(&self, values: &str) -> String
fn contains_any(&self, values: &str) -> String
§Example
use surreal_simple_querybuilder::prelude::*;
let s = "account".contains_any("['a', 'c', 'u']");
assert_eq!("account CONTAINSANY ['a', 'c', 'u']", s);
Sourcefn contains_none(&self, values: &str) -> String
fn contains_none(&self, values: &str) -> String
§Example
use surreal_simple_querybuilder::prelude::*;
let s = "account".contains_none("['z', 'd', 'f']");
assert_eq!("account CONTAINSNONE ['z', 'd', 'f']", s);
Sourcefn as_alias(&self, alias: &str) -> String
fn as_alias(&self, alias: &str) -> String
Take the current string and add as alias
after it
§Example
use surreal_simple_querybuilder::prelude::*;
let s = "account->manage->project".as_alias("account_projects");
assert_eq!("account->manage->project AS account_projects", s);
Sourcefn filter(&self, condition: &str) -> String
fn filter(&self, condition: &str) -> String
Take the current string, extract the last segment if it is a nested property, then add parenthesis around it and add the supplied condition in them.
§Example
use surreal_simple_querybuilder::prelude::*;
let path = "account->manage->project";
let s = path.filter("name = 'a_cool_project'");
assert_eq!("account->manage->(project WHERE name = 'a_cool_project')", s);
Sourcefn comma(&self, right: &str) -> String
fn comma(&self, right: &str) -> String
write a comma at the end of the string and append right
after it.
§Example
use surreal_simple_querybuilder::prelude::*;
let select = "*".comma("<-manage<-User as authors");
let query = format!("select {select} from Files");
assert_eq!("select *, <-manage<-User as authors from Files", query);
Sourcefn count(&self) -> String
fn count(&self) -> String
write a count()
around the current string so that it sits between the
parenthesis.
§Example
use surreal_simple_querybuilder::prelude::*;
let count = "id".count();
let query = format!("select {count} from Files");
assert_eq!("select count(id) from Files", query);
Sourcefn with_id(&self, id: &str) -> String
fn with_id(&self, id: &str) -> String
Add the supplied id
right after the current string in order to get the a
new string in the following format current:id
§Example
use surreal_simple_querybuilder::prelude::*;
let query = "Account".with_id("John");
assert_eq!(query, "Account:John");
Sourcefn with_composite_id(&self, id: &str) -> String
fn with_composite_id(&self, id: &str) -> String
Add the supplied composite id
right after the current string in order to
get the a new string in the following format current:⟨id⟩
. The ⟨
and ⟩
are automatically added around the id, if you wish to set a regular id then
refer to with_id()
§Example
use surreal_simple_querybuilder::prelude::*;
let query = "Account".with_composite_id("John/Doe");
assert_eq!(query, "Account:⟨John/Doe⟩");