pub struct QueryBuilder { /* private fields */ }Expand description
Implementations§
Source§impl QueryBuilder
impl QueryBuilder
Sourcepub fn measurement(self, name: impl Into<String>) -> Self
pub fn measurement(self, name: impl Into<String>) -> Self
Set the measurement to query.
Sourcepub fn tag(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn tag(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add a tag equality filter.
Add multiple tag equality filters.
Sourcepub fn field(self, name: impl Into<String>) -> Self
pub fn field(self, name: impl Into<String>) -> Self
Add a field to the projection (select only these columns).
Sourcepub fn last(self, duration: Duration) -> Self
pub fn last(self, duration: Duration) -> Self
Set the time range to the last duration from now.
Uses the current system time as the end point.
Sourcepub fn estimated_cardinality(self, cardinality: usize) -> Self
pub fn estimated_cardinality(self, cardinality: usize) -> Self
Set the estimated group-key cardinality.
When set, the query engine selects between hash-based and sort-based aggregation strategies. Low cardinality (≤ 1024) uses sort-based grouping for better cache locality and sorted output.
Sourcepub fn downsample(self, interval: Duration, function: AggFn) -> Self
pub fn downsample(self, interval: Duration, function: AggFn) -> Self
Set downsampling parameters.
Bucket results into fixed spans of interval, aligned to the Unix
epoch in UTC.
For a bucket that follows a calendar — local midnight to local
midnight, or a calendar month — use time_bucket() in SQL or declare
a rollup tier; see chronix::timebucket. A Duration cannot be
either, and this API does not pretend it can.
Sourcepub fn offset(self, n: usize) -> Self
pub fn offset(self, n: usize) -> Self
Skip the first n rows before returning results.
Must be used together with limit().
Sourcepub fn window_partition_by(self, columns: &[&str]) -> Self
pub fn window_partition_by(self, columns: &[&str]) -> Self
Set the partition-by columns for window functions.
Sourcepub fn window_value_column(self, column: impl Into<String>) -> Self
pub fn window_value_column(self, column: impl Into<String>) -> Self
Set the value column for window functions.
If not set, the first numeric field column is used by default.
Sourcepub fn namespace(self, ns: impl Into<String>) -> Self
pub fn namespace(self, ns: impl Into<String>) -> Self
Set the namespace scope for tenant isolation.
This embeds the NamespaceId structurally in the query plan AND
injects the __namespace__ tag filter, ensuring data isolation
even if the HTTP layer is bypassed.
Sourcepub fn namespace_scope(self, ns: Option<&str>) -> Self
pub fn namespace_scope(self, ns: Option<&str>) -> Self
Apply an optional namespace scope.
None means “no tenancy” — the single-tenant server and the embedded
API, where points carry no namespace tag and a filter on one would
match nothing. Call sites use this rather than branching, so that
scoping a read is one uniform call instead of an if each of them can
forget.
Trait Implementations§
Source§impl Clone for QueryBuilder
impl Clone for QueryBuilder
Source§fn clone(&self) -> QueryBuilder
fn clone(&self) -> QueryBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for QueryBuilder
impl Debug for QueryBuilder
Auto Trait Implementations§
impl Freeze for QueryBuilder
impl RefUnwindSafe for QueryBuilder
impl Send for QueryBuilder
impl Sync for QueryBuilder
impl Unpin for QueryBuilder
impl UnsafeUnpin for QueryBuilder
impl UnwindSafe for QueryBuilder
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more