Struct Et

Source
pub struct Et {
    pub conn: Connection,
    pub collections: HashMap<String, Collection>,
}

Fieldsยง

ยงconn: Connectionยงcollections: HashMap<String, Collection>

Implementationsยง

Sourceยง

impl Et

Source

pub fn new<P: AsRef<Path>>(path: P) -> Et

Examples found in repository?
examples/store_query.rs (line 11)
10fn main() -> Result<(), et::Error> {
11    let mut pot = Et::new(".");
12
13    // lets make a new collection
14    pot.create_collection("address_book")?;
15
16    // well make a new item we want to store
17    let person = Person {
18        name: String::from("david holtz"),
19        age: 26,
20    };
21
22    // we insert the object into the collection!
23    pot.insert::<Person>("address_book", &person)?;
24
25    // before we query we can add an index to speed things up
26    pot.add_index_to_collection("address_book", "name", "naming_index")?;
27
28    // finally we can query
29    let query = QueryBuilder::new()
30        .collection("address_book")
31        .kind(QueryKind::Object)
32        .key("name")
33        .comparison("=")
34        .string("david holtz")
35        .finish();
36
37    let results = pot.execute(query);
38    println!("{:#?}", results);
39
40    Ok(())
41}
Source

pub fn close(self)

Source

pub fn list_collections(&mut self) -> Result<Vec<String>>

Source

pub fn create_collection(&mut self, name: &str) -> Result<bool, Error>

Examples found in repository?
examples/store_query.rs (line 14)
10fn main() -> Result<(), et::Error> {
11    let mut pot = Et::new(".");
12
13    // lets make a new collection
14    pot.create_collection("address_book")?;
15
16    // well make a new item we want to store
17    let person = Person {
18        name: String::from("david holtz"),
19        age: 26,
20    };
21
22    // we insert the object into the collection!
23    pot.insert::<Person>("address_book", &person)?;
24
25    // before we query we can add an index to speed things up
26    pot.add_index_to_collection("address_book", "name", "naming_index")?;
27
28    // finally we can query
29    let query = QueryBuilder::new()
30        .collection("address_book")
31        .kind(QueryKind::Object)
32        .key("name")
33        .comparison("=")
34        .string("david holtz")
35        .finish();
36
37    let results = pot.execute(query);
38    println!("{:#?}", results);
39
40    Ok(())
41}
Source

pub fn execute(&self, query: Query) -> Result<Vec<Entry>, Error>

Examples found in repository?
examples/store_query.rs (line 37)
10fn main() -> Result<(), et::Error> {
11    let mut pot = Et::new(".");
12
13    // lets make a new collection
14    pot.create_collection("address_book")?;
15
16    // well make a new item we want to store
17    let person = Person {
18        name: String::from("david holtz"),
19        age: 26,
20    };
21
22    // we insert the object into the collection!
23    pot.insert::<Person>("address_book", &person)?;
24
25    // before we query we can add an index to speed things up
26    pot.add_index_to_collection("address_book", "name", "naming_index")?;
27
28    // finally we can query
29    let query = QueryBuilder::new()
30        .collection("address_book")
31        .kind(QueryKind::Object)
32        .key("name")
33        .comparison("=")
34        .string("david holtz")
35        .finish();
36
37    let results = pot.execute(query);
38    println!("{:#?}", results);
39
40    Ok(())
41}
Source

pub fn add_object_to_collection( &mut self, cname: &str, val: String, ) -> Result<bool, Error>

Source

pub fn add_index_to_collection( &mut self, collection_name: &str, key: &str, index_name: &str, ) -> Result<bool, Error>

Examples found in repository?
examples/store_query.rs (line 26)
10fn main() -> Result<(), et::Error> {
11    let mut pot = Et::new(".");
12
13    // lets make a new collection
14    pot.create_collection("address_book")?;
15
16    // well make a new item we want to store
17    let person = Person {
18        name: String::from("david holtz"),
19        age: 26,
20    };
21
22    // we insert the object into the collection!
23    pot.insert::<Person>("address_book", &person)?;
24
25    // before we query we can add an index to speed things up
26    pot.add_index_to_collection("address_book", "name", "naming_index")?;
27
28    // finally we can query
29    let query = QueryBuilder::new()
30        .collection("address_book")
31        .kind(QueryKind::Object)
32        .key("name")
33        .comparison("=")
34        .string("david holtz")
35        .finish();
36
37    let results = pot.execute(query);
38    println!("{:#?}", results);
39
40    Ok(())
41}
Source

pub fn insert<T: Serialize>( &mut self, cname: &str, svalue: &T, ) -> Result<bool, Error>

Examples found in repository?
examples/store_query.rs (line 23)
10fn main() -> Result<(), et::Error> {
11    let mut pot = Et::new(".");
12
13    // lets make a new collection
14    pot.create_collection("address_book")?;
15
16    // well make a new item we want to store
17    let person = Person {
18        name: String::from("david holtz"),
19        age: 26,
20    };
21
22    // we insert the object into the collection!
23    pot.insert::<Person>("address_book", &person)?;
24
25    // before we query we can add an index to speed things up
26    pot.add_index_to_collection("address_book", "name", "naming_index")?;
27
28    // finally we can query
29    let query = QueryBuilder::new()
30        .collection("address_book")
31        .kind(QueryKind::Object)
32        .key("name")
33        .comparison("=")
34        .string("david holtz")
35        .finish();
36
37    let results = pot.execute(query);
38    println!("{:#?}", results);
39
40    Ok(())
41}
Source

pub fn upsert_at_index<T: Serialize>( &mut self, cname: &str, index: usize, svalue: &T, ) -> Result<bool, Error>

Trait Implementationsยง

Sourceยง

impl Debug for Et

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementationsยง

ยง

impl !Freeze for Et

ยง

impl !RefUnwindSafe for Et

ยง

impl Send for Et

ยง

impl !Sync for Et

ยง

impl Unpin for Et

ยง

impl UnwindSafe for Et

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.