Struct exar::Connection [] [src]

pub struct Connection { /* fields omitted */ }

Exar DB's database connection, which contains a reference to a collection wrapped into an Arc/Mutex. It allows publishing and subscribing to the underling collection of events.

Examples

extern crate exar;

use exar::*;
use std::sync::{Arc, Mutex};

let collection_name = "test";
let collection_config = CollectionConfig::default();
let collection = Collection::new(collection_name, &collection_config).unwrap();
let connection = Connection::new(Arc::new(Mutex::new(collection)));

Methods

impl Connection
[src]

Creates a new instance of a connection with the given collection.

Publishes an event into the underlying collection and returns the id for the event created or a DatabaseError if a failure occurs.

Subscribes to the underlying collection of events using the given query and returns an event stream or a DatabaseError if a failure occurs.

Closes the connection.

Trait Implementations

impl Clone for Connection
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Connection
[src]

Formats the value using the given formatter.