Struct FieldRef
pub struct FieldRef<M, T> { /* private fields */ }Implementations§
§impl<M, T> FieldRef<M, T>
impl<M, T> FieldRef<M, T>
pub const fn new(column: &'static str) -> FieldRef<M, T>
pub const fn column_name(self) -> &'static str
pub const fn column_name(self) -> &'static str
The underlying SQL column name. Exposed so AST-builder helpers
like super::coalesce::coalesce can interop with the typed
FieldRef API without giving up generic-column flexibility.
pub fn asc(self) -> OrderClause
pub fn desc(self) -> OrderClause
§impl<M, T> FieldRef<M, T>
impl<M, T> FieldRef<M, T>
pub fn eq<V>(self, value: V) -> Filterwhere
V: IntoSqlValue,
pub fn ne<V>(self, value: V) -> Filterwhere
V: IntoSqlValue,
pub fn in_<I, V>(self, values: I) -> Filterwhere
I: IntoIterator<Item = V>,
V: IntoSqlValue,
pub fn lt<V>(self, value: V) -> Filterwhere
V: IntoSqlValue,
pub fn lte<V>(self, value: V) -> Filterwhere
V: IntoSqlValue,
pub fn gt<V>(self, value: V) -> Filterwhere
V: IntoSqlValue,
pub fn gte<V>(self, value: V) -> Filterwhere
V: IntoSqlValue,
pub fn eq_or_null<V>(self, value: V) -> Filterwhere
V: IntoSqlValue,
pub fn eq_or_null<V>(self, value: V) -> Filterwhere
V: IntoSqlValue,
Match rows where the column is null OR equals value. The
canonical inline-SQL workaround for “filter only if the caller
provided this value, otherwise let nulls through” — schemas
with sparse, optional foreign-key-style columns hit this
constantly. Renders as (col IS NULL OR col = $1).
Use Self::match_optional when the caller’s value is
itself an Option — that variant skips the filter entirely on
None instead of binding a null.
pub fn match_optional<V>(self, value: Option<V>) -> Option<Filter>where
V: IntoSqlValue,
pub fn match_optional<V>(self, value: Option<V>) -> Option<Filter>where
V: IntoSqlValue,
Filter on equality when the caller has a value, skip the
filter entirely when they don’t. Returns None for the no-op
case so callers can plumb it through
[crate::FilterExpr::any_of_optional]-style helpers, or feed
it directly into a where_optional(...) builder method on the
query builders.
The emitted filter is the same (col IS NULL OR col = $1) as
Self::eq_or_null — when the caller did supply a value,
we still let nulls through, matching the canonical
“optional-equality with null-as-wildcard” semantics from the
inline-SQL pattern.
§impl<M, T> FieldRef<M, T>
impl<M, T> FieldRef<M, T>
pub fn json_has_key(self, key: impl Into<String>) -> FilterExpr
pub fn json_has_key(self, key: impl Into<String>) -> FilterExpr
PG: col ? 'key' — the JSON document contains key as a
top-level field. SQLite (no native ? operator): lowers to
json_extract(col, '$.key') IS NOT NULL.
Intended for jsonb / JSON columns. Using this on a non-JSON
column compiles fine but errors at the engine layer when the
SQL runs — Rust’s type system doesn’t gate this for you.
The key is taken as impl Into<String> so callers can pass
either a &'static str literal or a runtime-owned String
(e.g. user-driven analytics queries that pivot on a metric
name from the request).
pub fn json_get_text(self, key: impl Into<String>) -> JsonTextPath
pub fn json_get_text(self, key: impl Into<String>) -> JsonTextPath
PG: col ->> 'key' <op> $1 — extract the value at key as
text, then compare. SQLite: json_extract(col, '$.key') <op> $1. Returns a JsonTextPath that supports the standard
comparison ops via chained methods. See Self::json_has_key
for the key-ownership rationale.
§impl<M> FieldRef<M, Vec<f32>>
impl<M> FieldRef<M, Vec<f32>>
pub fn distance_to(
self,
metric: VectorMetric,
query_vector: Vec<f32>,
) -> VectorDistanceExpr
pub fn distance_to( self, metric: VectorMetric, query_vector: Vec<f32>, ) -> VectorDistanceExpr
Left-hand operand of a Vector(n) distance comparison (see
docs/design/extensions.md §6/§7, cratestack#163) — chain a
comparator (.lt/.lte/.gt/.gte/.eq) for a threshold
filter, or .asc/.desc to use it as an ORDER BY target. The
metric is never inferred from an index (a similarity search
must keep working with no vector index present, per AC #2 on
cratestack#163) — pass it explicitly, or derive it from a known
index opclass via VectorMetric::from_opclass.
PG-only (pgvector); the embedded rusqlite backend fails loud at
render time if reached, mirroring [Self::covers_geography].
pub fn order_by_distance(
self,
metric: VectorMetric,
query_vector: Vec<f32>,
) -> OrderClause
pub fn order_by_distance( self, metric: VectorMetric, query_vector: Vec<f32>, ) -> OrderClause
Shorthand for distance_to(metric, query_vector).asc() — order
by distance, nearest first, the standard k-NN similarity-search
shape.
§impl<M> FieldRef<M, Option<Vec<f32>>>
impl<M> FieldRef<M, Option<Vec<f32>>>
pub fn distance_to(
self,
metric: VectorMetric,
query_vector: Vec<f32>,
) -> VectorDistanceExpr
pub fn distance_to( self, metric: VectorMetric, query_vector: Vec<f32>, ) -> VectorDistanceExpr
Same as FieldRef::<M, Vec<f32>>::distance_to for a nullable
Vector(n) column. Rows with a NULL vector compare as NULL
distance, which sorts last under the framework’s default
NULLS LAST ordering (crate::NullOrder) and never matches a
threshold filter.
pub fn order_by_distance(
self,
metric: VectorMetric,
query_vector: Vec<f32>,
) -> OrderClause
pub fn order_by_distance( self, metric: VectorMetric, query_vector: Vec<f32>, ) -> OrderClause
Shorthand for distance_to(metric, query_vector).asc().
Trait Implementations§
impl<M, T> Copy for FieldRef<M, T>
§impl<M, T> IntoColumnName for FieldRef<M, T>
impl<M, T> IntoColumnName for FieldRef<M, T>
fn into_column_name(self) -> &'static str
Auto Trait Implementations§
impl<M, T> Freeze for FieldRef<M, T>
impl<M, T> RefUnwindSafe for FieldRef<M, T>
impl<M, T> Send for FieldRef<M, T>
impl<M, T> Sync for FieldRef<M, T>
impl<M, T> Unpin for FieldRef<M, T>
impl<M, T> UnsafeUnpin for FieldRef<M, T>
impl<M, T> UnwindSafe for FieldRef<M, T>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<T> OrderedSeq<'_, T> for Twhere
T: Clone,
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
MaybeRef].