pub struct QueryBuilder {
pub query_type: Option<QueryKind>,
pub collection: Option<String>,
pub comparison: Option<String>,
pub key: Option<String>,
pub value: Option<Value>,
}
Fieldsยง
ยงquery_type: Option<QueryKind>
ยงcollection: Option<String>
ยงcomparison: Option<String>
ยงkey: Option<String>
ยงvalue: Option<Value>
Implementationsยง
Sourceยงimpl QueryBuilder
impl QueryBuilder
Sourcepub fn new() -> QueryBuilder
pub fn new() -> QueryBuilder
Examples found in repository?
examples/store_query.rs (line 29)
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 kind(self, typ: QueryKind) -> QueryBuilder
pub fn kind(self, typ: QueryKind) -> QueryBuilder
Examples found in repository?
examples/store_query.rs (line 31)
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 collection(self, collection: &str) -> QueryBuilder
pub fn collection(self, collection: &str) -> QueryBuilder
Examples found in repository?
examples/store_query.rs (line 30)
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 comparison(self, comparison: &str) -> QueryBuilder
pub fn comparison(self, comparison: &str) -> QueryBuilder
Examples found in repository?
examples/store_query.rs (line 33)
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 string(self, value: &str) -> QueryBuilder
pub fn string(self, value: &str) -> QueryBuilder
Examples found in repository?
examples/store_query.rs (line 34)
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 bool(self, value: bool) -> QueryBuilder
pub fn float(self, value: f32) -> QueryBuilder
pub fn int(self, value: i32) -> QueryBuilder
Sourcepub fn key(self, key: &str) -> QueryBuilder
pub fn key(self, key: &str) -> QueryBuilder
Examples found in repository?
examples/store_query.rs (line 32)
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 finish(self) -> Query
pub fn finish(self) -> Query
Examples found in repository?
examples/store_query.rs (line 35)
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}
Trait Implementationsยง
Auto Trait Implementationsยง
impl Freeze for QueryBuilder
impl RefUnwindSafe for QueryBuilder
impl Send for QueryBuilder
impl Sync for QueryBuilder
impl Unpin for QueryBuilder
impl UnwindSafe for QueryBuilder
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