pub struct QueryBuilder { /* private fields */ }
Expand description
A builder for InfluxQL queries
let query = QueryBuilder::from("indoor_environment")
.field("temperature")
.field("humidity")
.start(Utc.ymd(2021, 3, 7).and_hms(21, 0, 0))
.build();
assert_eq!(
query.as_ref(),
"SELECT temperature, humidity \
FROM indoor_environment \
WHERE time > '2021-03-07T21:00:00Z'",
);
Implementations§
Source§impl QueryBuilder
impl QueryBuilder
Sourcepub fn from<T>(measurement: T) -> Self
pub fn from<T>(measurement: T) -> Self
Create a query selecting from a measurement
This sets the measurement in the FROM
clause.
Sourcepub fn database<T>(self, database: T) -> Self
pub fn database<T>(self, database: T) -> Self
Set the database
This sets the database in the FROM
clause:
database.retention_policy.measurement
.
Sourcepub fn retention_policy<T>(self, retention_policy: T) -> Self
pub fn retention_policy<T>(self, retention_policy: T) -> Self
Set the retention policy
This sets the retention policy in the FROM
clause:
database.retention_policy.measurement
.
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