DerivedColumn

Struct DerivedColumn 

Source
pub struct DerivedColumn<E: Entity> { /* private fields */ }
Expand description

A column computed dynamically based on other columns or expressions.

Implementations§

Source§

impl<E: Entity> DerivedColumn<E>

Source

pub fn new(expr: String) -> Self

Creates a new instance.

Source

pub fn alias(alias: &str) -> Self

Constructs an instance for the column alias.

Source

pub fn coalesce<V: IntoSqlValue>(col: E::Column, value: V) -> Self

Constructs an instance using COALESCE to provide a default value for the column.

Source

pub fn coalesce_aggregation<V: IntoSqlValue>( aggregation: Aggregation<E>, value: V, ) -> Self

Constructs an instance using COALESCE to provide a default value for the aggregation.

Source

pub fn year(col: E::Column) -> Self

Constructs an instance for extracting the year from a column.

Source

pub fn year_month(col: E::Column) -> Self

Constructs an instance for extracting the year-month from a column.

Source

pub fn date(col: E::Column) -> Self

Constructs an instance for extracting the date from a column.

Source

pub fn format_date_time(col: E::Column) -> Self

Constructs an instance for formating a date-time as %Y-%m-%d %H:%M:%S.

Source

pub fn json_extract(col: E::Column, path: &str) -> Self

Constructs an instance for extracting values from a JSON column.

Trait Implementations§

Source§

impl<E: Entity> AsRef<str> for DerivedColumn<E>

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<E: Clone + Entity> Clone for DerivedColumn<E>

Source§

fn clone(&self) -> DerivedColumn<E>

Returns a duplicate 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<E: Debug + Entity> Debug for DerivedColumn<E>

Source§

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

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

impl<E: Entity> Display for DerivedColumn<E>

Source§

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

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

impl<E: Entity> ModelColumn<E> for DerivedColumn<E>

Source§

fn into_column_expr(self) -> String

Converts self into a column expression.
Source§

impl<E: PartialEq + Entity> PartialEq for DerivedColumn<E>

Source§

fn eq(&self, other: &DerivedColumn<E>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<E: Entity> StructuralPartialEq for DerivedColumn<E>

Auto Trait Implementations§

§

impl<E> Freeze for DerivedColumn<E>

§

impl<E> RefUnwindSafe for DerivedColumn<E>
where E: RefUnwindSafe,

§

impl<E> Send for DerivedColumn<E>
where E: Send,

§

impl<E> Sync for DerivedColumn<E>
where E: Sync,

§

impl<E> Unpin for DerivedColumn<E>
where E: Unpin,

§

impl<E> UnwindSafe for DerivedColumn<E>
where E: UnwindSafe,

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> Casing<T> for T
where T: AsRef<str>,

Source§

fn to_case(&self, case: Case<'_>) -> String

Convert the string into the given case. It will reference self and create a new String with the same pattern and delimeter as case. It will split on boundaries defined at Boundary::defaults(). Read more
Source§

fn set_boundaries(&self, bs: &[Boundary]) -> StateConverter<'_, T>

Creates a StateConverter struct initialized with the boundaries provided. Read more
Source§

fn remove_boundaries(&self, bs: &[Boundary]) -> StateConverter<'_, T>

Creates a StateConverter struct initialized without the boundaries provided. Read more
Source§

fn from_case(&self, case: Case<'_>) -> StateConverter<'_, T>

Start the case conversion by storing the boundaries associated with the given case. Read more
Source§

fn is_case(&self, case: Case<'_>) -> bool

Determines if self is of the given case. This is done simply by applying the conversion and seeing if the result is the same. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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

Source§

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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