pub struct WriteQuery { /* private fields */ }
Expand description
Internal Representation of a Write query that has not yet been built
Implementations§
Source§impl WriteQuery
impl WriteQuery
Sourcepub fn new<S>(timestamp: Timestamp, measurement: S) -> Self
pub fn new<S>(timestamp: Timestamp, measurement: S) -> Self
Creates a new WriteQuery
Sourcepub fn add_field<S, F>(self, field: S, value: F) -> Self
pub fn add_field<S, F>(self, field: S, value: F) -> Self
Adds a field to the WriteQuery
§Examples
use influxdb::{Query, Timestamp};
use influxdb::InfluxDbWriteable;
Timestamp::Nanoseconds(0).into_query("measurement").add_field("field1", 5).build();
Sourcepub fn add_tag<S, I>(self, tag: S, value: I) -> Self
pub fn add_tag<S, I>(self, tag: S, value: I) -> Self
Adds a tag to the WriteQuery
Please note that a WriteQuery
requires at least one field. Composing a query with
only tags will result in a failure building the query.
§Examples
use influxdb::{Query, Timestamp};
use influxdb::InfluxDbWriteable;
Timestamp::Nanoseconds(0)
.into_query("measurement")
.add_tag("field1", 5); // calling `.build()` now would result in a `Err(Error::InvalidQueryError)`
pub fn get_precision(&self) -> String
Trait Implementations§
Source§impl Clone for WriteQuery
impl Clone for WriteQuery
Source§fn clone(&self) -> WriteQuery
fn clone(&self) -> WriteQuery
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for WriteQuery
impl Debug for WriteQuery
Source§impl Query for WriteQuery
impl Query for WriteQuery
Source§fn build(&self) -> Result<ValidQuery, Error>
fn build(&self) -> Result<ValidQuery, Error>
Builds valid InfluxSQL which can be run against the Database.
In case no fields have been specified, it will return an error,
as that is invalid InfluxSQL syntax. Read more
Source§fn build_with_opts(&self, use_v2: bool) -> Result<ValidQuery, Error>
fn build_with_opts(&self, use_v2: bool) -> Result<ValidQuery, Error>
Like [build] but with additional support for unsigned integers in the line protocol.
Please note, this crate can only interact with InfluxDB 2.0 in compatibility mode
and does not natively support InfluxDB 2.0. Read more
fn get_type(&self) -> QueryType
Auto Trait Implementations§
impl Freeze for WriteQuery
impl RefUnwindSafe for WriteQuery
impl Send for WriteQuery
impl Sync for WriteQuery
impl Unpin for WriteQuery
impl UnwindSafe for WriteQuery
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