pub struct Et {
pub conn: Connection,
pub collections: HashMap<String, Collection>,
}
Fieldsยง
ยงconn: Connection
ยงcollections: HashMap<String, Collection>
Implementationsยง
Sourceยงimpl Et
impl Et
Sourcepub fn new<P: AsRef<Path>>(path: P) -> Et
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}
pub fn close(self)
pub fn list_collections(&mut self) -> Result<Vec<String>>
Sourcepub fn create_collection(&mut self, name: &str) -> Result<bool, Error>
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}
Sourcepub fn execute(&self, query: Query) -> Result<Vec<Entry>, Error>
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}
pub fn add_object_to_collection( &mut self, cname: &str, val: String, ) -> Result<bool, Error>
Sourcepub fn add_index_to_collection(
&mut self,
collection_name: &str,
key: &str,
index_name: &str,
) -> Result<bool, Error>
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}
Sourcepub fn insert<T: Serialize>(
&mut self,
cname: &str,
svalue: &T,
) -> Result<bool, Error>
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}
pub fn upsert_at_index<T: Serialize>( &mut self, cname: &str, index: usize, svalue: &T, ) -> Result<bool, Error>
Trait Implementationsยง
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more