Struct redis_ts::TsRangeQuery

source ·
pub struct TsRangeQuery { /* private fields */ }
Expand description

Let’s you build a ts range query with all options via a builder pattern:

use redis_ts::{TsAggregationType, TsBucketTimestamp, TsRangeQuery};
let query = TsRangeQuery::default()
    .from(1234)
    .to(5678)
    .latest(true)
    .filter_by_value(1.0, 5.0)
    .aggregation_type(TsAggregationType::Avg(5000))
    .bucket_timestamp(TsBucketTimestamp::High)
    .empty(true);

Implementations§

source§

impl TsRangeQuery

source

pub fn from<T: Into<Integer>>(self, from: T) -> Self

Start timestamp of the series to query. Defaults to ‘-’ (earliest sample) if left empty.

source

pub fn to<T: Into<Integer>>(self, to: T) -> Self

End timestamp of the series to query. Defaults to ‘+’ (latest sample) if left empty.

source

pub fn latest(self, latest: bool) -> Self

Will enable the LATEST flag on the query.

source

pub fn filter_by_ts<T: Into<Integer>>(self, ts: Vec<T>) -> Self

Will enable the FILTER_BY_TS option with given timestamps. Will only be added if the given Vec contains any ts values.

source

pub fn filter_by_value(self, min: f64, max: f64) -> Self

Will enable the FILTER_BY_VALUE option with given min and max values.

source

pub fn count(self, count: u64) -> Self

Determines the max amount of returned samples.

source

pub fn align(self, align: TsAlign) -> Self

Controls the aggregation alignment. Will only be added if the query actually contains aggregation params.

source

pub fn aggregation_type(self, aggregation_type: TsAggregationType) -> Self

The type of aggregation to be performed on the series.

source

pub fn bucket_timestamp(self, bucket_timestamp: TsBucketTimestamp) -> Self

Controls reporting of aggregation bucket timestamps. Will only be added if the query actually contains aggregation params.

source

pub fn empty(self, empty: bool) -> Self

Enables the EMPTY flag on the query.

Trait Implementations§

source§

impl Clone for TsRangeQuery

source§

fn clone(&self) -> TsRangeQuery

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for TsRangeQuery

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for TsRangeQuery

source§

fn default() -> TsRangeQuery

Returns the “default value” for a type. Read more
source§

impl ToRedisArgs for TsRangeQuery

source§

fn write_redis_args<W>(&self, out: &mut W)
where W: ?Sized + RedisWrite,

This writes the value into a vector of bytes. Each item is a single argument. Most items generate a single item. Read more
source§

fn to_redis_args(&self) -> Vec<Vec<u8>>

This converts the value into a vector of bytes. Each item is a single argument. Most items generate a vector of a single item. Read more
source§

fn describe_numeric_behavior(&self) -> NumericBehavior

Returns an information about the contained value with regards to it’s numeric behavior in a redis context. This is used in some high level concepts to switch between different implementations of redis functions (for instance INCR vs INCRBYFLOAT).
source§

fn is_single_arg(&self) -> bool

Returns an indiciation if the value contained is exactly one argument. It returns false if it’s zero or more than one. This is used in some high level functions to intelligently switch between GET and MGET variants.

Auto Trait Implementations§

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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more