pub struct ColumnMarker {
pub table: Cow<'static, str>,
pub name: Cow<'static, str>,
}Expand description
A lightweight column identifier for use in selection descriptors.
Stores either borrowed static metadata or owned runtime strings so callers can avoid allocations for generated/schema-known columns without giving up support for dynamic names.
Fields§
§table: Cow<'static, str>Table name.
name: Cow<'static, str>Column name.
Implementations§
Source§impl ColumnMarker
impl ColumnMarker
Sourcepub fn new(table: impl Into<String>, name: impl Into<String>) -> Self
pub fn new(table: impl Into<String>, name: impl Into<String>) -> Self
Create a new column marker.
Accepts any type that implements Into<String>, so both
&str literals and owned String values work without ceremony.
Sourcepub const fn from_static(table: &'static str, name: &'static str) -> Self
pub const fn from_static(table: &'static str, name: &'static str) -> Self
Create a new marker backed by borrowed static metadata.
Sourcepub fn alias(&self) -> String
pub fn alias(&self) -> String
Returns the join-safe alias for this column.
The alias uses the format “table__column” which is safe to use in queries with joins, preventing column name conflicts.
§Example
use nautilus_core::ColumnMarker;
let marker = ColumnMarker::new("users", "id");
assert_eq!(marker.alias(), "users__id");Trait Implementations§
Source§impl Clone for ColumnMarker
impl Clone for ColumnMarker
Source§fn clone(&self) -> ColumnMarker
fn clone(&self) -> ColumnMarker
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ColumnMarker
impl Debug for ColumnMarker
impl Eq for ColumnMarker
Source§impl<T> From<Column<T>> for ColumnMarker
Converts a typed column into a ColumnMarker for use in query building.
impl<T> From<Column<T>> for ColumnMarker
Converts a typed column into a ColumnMarker for use in query building.
Source§fn from(col: Column<T>) -> ColumnMarker
fn from(col: Column<T>) -> ColumnMarker
Converts to this type from the input type.
Source§impl From<ColumnMarker> for SelectItem
impl From<ColumnMarker> for SelectItem
Source§fn from(marker: ColumnMarker) -> Self
fn from(marker: ColumnMarker) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ColumnMarker
impl PartialEq for ColumnMarker
Source§fn eq(&self, other: &ColumnMarker) -> bool
fn eq(&self, other: &ColumnMarker) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ColumnMarker
Auto Trait Implementations§
impl Freeze for ColumnMarker
impl RefUnwindSafe for ColumnMarker
impl Send for ColumnMarker
impl Sync for ColumnMarker
impl Unpin for ColumnMarker
impl UnsafeUnpin for ColumnMarker
impl UnwindSafe for ColumnMarker
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