Struct query_builder::SelectQuery
[−]
[src]
pub struct SelectQuery<'a, 'c> { pub whre: BTreeMap<&'a str, Value<'c>>, // some fields omitted }
Rust representation of an SQL Select Query
Fields
whre: BTreeMap<&'a str, Value<'c>>
Methods
impl<'a, 'c> SelectQuery<'a, 'c>
[src]
pub fn select(rows: &[&'a str]) -> SelectQuery<'a, 'c>
[src]
Creates a new SelectQuery
that selects data from the row/s rows
pub fn from(self, t: &'a str) -> Self
[src]
Sets the table to select from to the value of t
ⓘThis example is not tested
let mut q = SelectQuery::select(&["user"]).from("users"); assert_eq!(q.as_string(), "SELECT user FROM users")
pub fn limit(&mut self, l: usize)
[src]
Sets the limit value of the Query to the value of l
ⓘThis example is not tested
let mut q = SelectQuery::select(&["user"]).from("users"); q.limit(12); assert_eq!(q.as_string(), "SELECT user FROM users LIMIT 12")
pub fn has_limit(&self) -> bool
[src]
Return whether or not the SelectQuery
has a limit
ⓘThis example is not tested
let mut q = SelectQuery::select(&["user"]).from("users"); q.limit(12); assert!(q.has_limit); q.clear_limit(); assert!(!q.has_limit);
pub fn get_limit(&self) -> Option<usize>
[src]
Returns the value of the Limit of the SelectQuery
if there is one
ⓘThis example is not tested
let mut q = SelectQuery::select(&["user"]).from("users"); assert_eq!(q.get_limit(), None); q.limit(12); assert_eq!(q.get_limit(), Some(12));
pub fn clear_limit(&mut self)
[src]
Removes the limit from the query
ⓘThis example is not tested
let mut q = SelectQuery::select(&["user"]).from("users"); q.limit(42); assert_eq!(q.as_string(), "SELECT user FORM users LIMIT 42"); // clear limit q.clear_limit() assert_eq!(q.as_string(), "SELECT user FROM users");
pub fn as_string(&self) -> String
[src]
Creates the string representation of the query
ⓘThis example is not tested
let mut q = SelectQuery::select(&["*"]).from("users"); assert_eq!(q.as_string(), "SELECT * FROM users")
Trait Implementations
impl<'a, 'c> Debug for SelectQuery<'a, 'c>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<'a, 'c> Display for SelectQuery<'a, 'c>
[src]
fn fmt(&self, f: &mut Formatter) -> FormatResult
[src]
Formats the value using the given formatter. Read more