Struct gremlin_client::structure::P
source · pub struct P { /* private fields */ }Implementations§
source§impl P
impl P
pub fn operator(&self) -> &String
pub fn value(&self) -> &GValue
pub fn eq<V>(value: V) -> Pwhere
V: ToGValue,
pub fn neq<V>(value: V) -> Pwhere
V: ToGValue,
sourcepub fn gt<V>(value: V) -> Pwhere
V: ToGValue,
pub fn gt<V>(value: V) -> Pwhere
V: ToGValue,
Examples found in repository?
examples/traversal_complex.rs (line 32)
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = GremlinClient::connect("localhost")?;
let g = traversal().with_remote(client);
create_graph(&g)?;
let result = g
.v(())
.has_label("complex_vertex")
.has(("name", "test1"))
.out("complex_label")
.out("complex_label")
.value_map(())
.next()?
.expect("no vertices found");
println!(
"Found vertex with name {:?}",
result["name"].get::<List>().unwrap()[0]
);
let results = g
.v(())
.has_label("complex_vertex")
.has(("number", P::gt(3)))
.to_list()?;
println!(
"Found {} vertices with number greater than 3",
results.len()
);
let results = g
.v(())
.has_label("complex_vertex")
.has(("number", P::within((3, 6))))
.to_list()?;
println!("Found {} vertices with number 3 or 6", results.len());
let results = g
.v(())
.has_label("complex_vertex")
.where_(__.out("complex_label").count().is(P::gte(1)))
.to_list()?;
println!(
"Found {} vertices with 1 or more connected edges with label complex_label",
results.len()
);
Ok(())
}sourcepub fn gte<V>(value: V) -> Pwhere
V: ToGValue,
pub fn gte<V>(value: V) -> Pwhere
V: ToGValue,
Examples found in repository?
examples/traversal_complex.rs (line 51)
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = GremlinClient::connect("localhost")?;
let g = traversal().with_remote(client);
create_graph(&g)?;
let result = g
.v(())
.has_label("complex_vertex")
.has(("name", "test1"))
.out("complex_label")
.out("complex_label")
.value_map(())
.next()?
.expect("no vertices found");
println!(
"Found vertex with name {:?}",
result["name"].get::<List>().unwrap()[0]
);
let results = g
.v(())
.has_label("complex_vertex")
.has(("number", P::gt(3)))
.to_list()?;
println!(
"Found {} vertices with number greater than 3",
results.len()
);
let results = g
.v(())
.has_label("complex_vertex")
.has(("number", P::within((3, 6))))
.to_list()?;
println!("Found {} vertices with number 3 or 6", results.len());
let results = g
.v(())
.has_label("complex_vertex")
.where_(__.out("complex_label").count().is(P::gte(1)))
.to_list()?;
println!(
"Found {} vertices with 1 or more connected edges with label complex_label",
results.len()
);
Ok(())
}pub fn lt<V>(value: V) -> Pwhere
V: ToGValue,
pub fn lte<V>(value: V) -> Pwhere
V: ToGValue,
sourcepub fn within<V>(value: V) -> Pwhere
V: IntoRange,
pub fn within<V>(value: V) -> Pwhere
V: IntoRange,
Examples found in repository?
examples/traversal_complex.rs (line 43)
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = GremlinClient::connect("localhost")?;
let g = traversal().with_remote(client);
create_graph(&g)?;
let result = g
.v(())
.has_label("complex_vertex")
.has(("name", "test1"))
.out("complex_label")
.out("complex_label")
.value_map(())
.next()?
.expect("no vertices found");
println!(
"Found vertex with name {:?}",
result["name"].get::<List>().unwrap()[0]
);
let results = g
.v(())
.has_label("complex_vertex")
.has(("number", P::gt(3)))
.to_list()?;
println!(
"Found {} vertices with number greater than 3",
results.len()
);
let results = g
.v(())
.has_label("complex_vertex")
.has(("number", P::within((3, 6))))
.to_list()?;
println!("Found {} vertices with number 3 or 6", results.len());
let results = g
.v(())
.has_label("complex_vertex")
.where_(__.out("complex_label").count().is(P::gte(1)))
.to_list()?;
println!(
"Found {} vertices with 1 or more connected edges with label complex_label",
results.len()
);
Ok(())
}Trait Implementations§
impl StructuralPartialEq for P
Auto Trait Implementations§
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more