vertex_properties/
vertex_properties.rs

1use gremlin_client::{GremlinClient, List, Map, VertexProperty};
2
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4    let client = GremlinClient::connect("localhost")?;
5
6    let results = client
7        .execute("g.V(param).properties()", &[("param", &1)])?
8        .filter_map(Result::ok)
9        .map(|f| f.take::<VertexProperty>())
10        .collect::<Result<Vec<VertexProperty>, _>>()?;
11
12    println!("{:?}", results[0].get::<String>()?);
13
14    let results = client
15        .execute("g.V(param).propertyMap()", &[("param", &1)])?
16        .filter_map(Result::ok)
17        .map(|f| f.take::<Map>())
18        .collect::<Result<Vec<Map>, _>>()?;
19
20    println!(
21        "{:?}",
22        results[0]["name"].get::<List>()?[0]
23            .get::<VertexProperty>()?
24            .get::<String>()?
25    );
26
27    Ok(())
28}