1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use gremlin_client::{GremlinClient, List, Map, VertexProperty};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = GremlinClient::connect("localhost")?;

    let results = client
        .execute("g.V(param).properties()", &[("param", &1)])?
        .filter_map(Result::ok)
        .map(|f| f.take::<VertexProperty>())
        .collect::<Result<Vec<VertexProperty>, _>>()?;

    println!("{:?}", results[0].get::<String>()?);

    let results = client
        .execute("g.V(param).propertyMap()", &[("param", &1)])?
        .filter_map(Result::ok)
        .map(|f| f.take::<Map>())
        .collect::<Result<Vec<Map>, _>>()?;

    println!(
        "{:?}",
        results[0]["name"].get::<List>()?[0]
            .get::<VertexProperty>()?
            .get::<String>()?
    );

    Ok(())
}