pub struct TypedColumn<T: ToSql + Sync> { /* private fields */ }
Expand description
A wrapper around the Column
struct which includes
the rust type of the field.
For each field of a pg_worm::Model
a TypedColumn
is automatically
generated.
A TypedColumn
can be used to access information about
the column and create Filter
s regarding this column.
§Example
use pg_worm::prelude::*;
#[derive(Model)]
struct Foo {
baz: i64
}
assert_eq!(Foo::baz.column_name(), "baz");
Implementations§
Source§impl<T: ToSql + Sync + Send + 'static> TypedColumn<T>
impl<T: ToSql + Sync + Send + 'static> TypedColumn<T>
Sourcepub const fn new(
table_name: &'static str,
column_name: &'static str,
) -> TypedColumn<T>
pub const fn new( table_name: &'static str, column_name: &'static str, ) -> TypedColumn<T>
Creates anew TypedColumn<T>
.
Sourcepub const fn nullable(self) -> TypedColumn<T>
pub const fn nullable(self) -> TypedColumn<T>
Set this property so true
.
Sourcepub const fn unique(self) -> TypedColumn<T>
pub const fn unique(self) -> TypedColumn<T>
Set this property so true
.
Sourcepub const fn primary_key(self) -> TypedColumn<T>
pub const fn primary_key(self) -> TypedColumn<T>
Set this property so true
.
Sourcepub const fn generated(self) -> TypedColumn<T>
pub const fn generated(self) -> TypedColumn<T>
Set this property so true
.
Source§impl<T: ToSql + Sync + Send + 'static + PartialOrd> TypedColumn<T>
impl<T: ToSql + Sync + Send + 'static + PartialOrd> TypedColumn<T>
Sourcepub fn gt<'a>(&self, other: &'a T) -> Where<'a>
pub fn gt<'a>(&self, other: &'a T) -> Where<'a>
Check whether this column’s value is greater than some other value.
Sourcepub fn gte<'a>(&self, other: &'a T) -> Where<'a>
pub fn gte<'a>(&self, other: &'a T) -> Where<'a>
Check whether this colum’s value is greater than or equal to another value.
Source§impl<'a, T: ToSql + Sync + 'a> TypedColumn<Vec<T>>
impl<'a, T: ToSql + Sync + 'a> TypedColumn<Vec<T>>
Sourcepub fn contains(&self, value: &'a T) -> Where<'a>
pub fn contains(&self, value: &'a T) -> Where<'a>
Check whether this column’s array contains some value.
Sourcepub fn contains_not(&self, value: &'a T) -> Where<'a>
pub fn contains_not(&self, value: &'a T) -> Where<'a>
Check whether this column’s array does NOT
contain some value.
Sourcepub fn contains_any(&self, values: &'a Vec<&'a T>) -> Where<'a>
pub fn contains_any(&self, values: &'a Vec<&'a T>) -> Where<'a>
Check whether this column’s array contains any value of another array.
Sourcepub fn contains_all(&self, values: &'a Vec<&'a T>) -> Where<'a>
pub fn contains_all(&self, values: &'a Vec<&'a T>) -> Where<'a>
Check whether this column’s array contains all values of another array.
Sourcepub fn contains_none(&self, values: &'a Vec<&'a T>) -> Where<'a>
pub fn contains_none(&self, values: &'a Vec<&'a T>) -> Where<'a>
Check whether this column’s array does not overlap with another array, i.e. contains none of its values.
Methods from Deref<Target = Column>§
Sourcepub fn primary_key(&self) -> bool
pub fn primary_key(&self) -> bool
Returns this propertie’s value.
Sourcepub fn column_name(&self) -> &'static str
pub fn column_name(&self) -> &'static str
Get the column name.
Sourcepub fn table_name(&self) -> &'static str
pub fn table_name(&self) -> &'static str
Get the name of the table this column is part of.
Trait Implementations§
Source§impl<T: Clone + ToSql + Sync> Clone for TypedColumn<T>
impl<T: Clone + ToSql + Sync> Clone for TypedColumn<T>
Source§fn clone(&self) -> TypedColumn<T>
fn clone(&self) -> TypedColumn<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more