selmeci / dgraph-tonic

Async/Sync gRPC client for Dgraph DB
MIT License
83 stars 8 forks source link

Response Does not Contain Schema Field #24

Closed MateusAmin closed 4 years ago

MateusAmin commented 4 years ago

The example here appears to be incorrect:

https://github.com/selmeci/dgraph-tonic#run-a-query

I would appreciate any pointers on printing out the schema query.

MateusAmin commented 4 years ago
        use serde_json::Value;

        let schema_query = r#"
            schema {}
        "#;
        let mut txn = client.new_read_only_txn();
        let response = txn.query(schema_query).await.expect("Response");

        let s: Value = serde_json::from_slice(&response.json).unwrap();

        println!("{:}", serde_json::to_string_pretty(&s).unwrap());