[][src]Type Definition dgraph_tonic::Client

type Client = ClientVariant<Default>;

Default client.

Implementations

impl Client[src]

pub fn new<S: TryInto<Uri>, E: Into<Endpoints<S>>>(
    endpoints: E
) -> Result<Self, Error>
[src]

Create new Dgraph client for interacting v DB.

The client can be backed by multiple endpoints (to the same server, or multiple servers in a cluster).

Arguments

  • endpoints - one endpoint or vector of endpoints

Errors

  • endpoints vector is empty
  • item in vector cannot by converted into Uri

Example

use dgraph_tonic::Client;

// vector of endpoints
let client = Client::new(vec!["http://127.0.0.1:19080", "http://127.0.0.1:19080"]).expect("Dgraph client");
// one endpoint
let client = Client::new("http://127.0.0.1:19080").expect("Dgraph client");