Skip to content

feat: Client can be created with custom endpoint configuration

Latest
Compare
Choose a tag to compare
@selmeci selmeci released this 14 Mar 09:54
6c2e672

A client can also be initialized with custom endpoint configuration.

use dgraph_tonic::{Endpoint, EndpointConfig, Client};

use std::time::Duration;

#[derive(Debug, Default)]
struct EndpointWithTimeout {}

impl EndpointConfig for EndpointWithTimeout {
    fn configure_endpoint(&self, endpoint: Endpoint) -> Endpoint {
        endpoint.timeout(Duration::from_secs(5))
    }
}

fn main() {
  let endpoint_config = EndpointWithTimeout::default();
  let client = Client::new_with_endpoint_config("http://127.0.0.1:19080",endpoint_config).expect("Dgraph client");
}