Struct Query

Source
pub struct Query {
    pub keywords: Vec<Keyword>,
}
Expand description

Base struct for all queries built with the query builder

Fields§

§keywords: Vec<Keyword>

Implementations§

Source§

impl Query

Source

pub fn new() -> Self

Create a new query builder

Source

pub fn select<T: Into<String> + Display>( &mut self, table: T, values: Vec<T>, ) -> &mut Self

Add a select statement to the query. Takes the name of the table you’re selecting and the values. You can add a filter with .filter.

Source

pub fn filter(&mut self, fields: Vec<(String, String)>) -> &mut Self

Add a filter statement to the query. Takes a vector of (String,String). The first value is the field name and the second field is the value that should be filtered with.

Source

pub fn insert<T: Into<String> + Display>( &mut self, table: T, fields: Vec<(String, String)>, ) -> &mut Self

Add an insert statement to your query. Takes the name of the table being inserted into and a vector of (String,String). Similarly to .filter() this tuple is in the order (field, value).

Source

pub fn build(&self) -> String

Builds the query into an actual statement.

use edgedb_query_builder::Query;
 
let builder = Query::new().select("Movie", vec!["id","title"]).build();
// This will be turned into:
// select Movie { id, title };

Auto Trait Implementations§

§

impl Freeze for Query

§

impl RefUnwindSafe for Query

§

impl Send for Query

§

impl Sync for Query

§

impl Unpin for Query

§

impl UnwindSafe for Query

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.