[−][src]Struct barrel::types::Type
A database column type and all the metadata attached to it
Using this struct directly is not recommended. Instead, you should be
using the constructor APIs in the types
module.
use barrel::types::*;
let column = varchar()
.size(255)
.nullable(true)
.indexed(true)
.unique(true);
Please see the default vaulues section in the types
module docs!
Fields
nullable: bool
unique: bool
increments: bool
indexed: bool
default: Option<T>
size: Option<usize>
Methods
impl<T> Type<T>
[src]
This is a public API, be considered about breaking thigns
pub fn nullable(self, arg: bool) -> Self
[src]
Set the nullability of this type
pub fn unique(self, arg: bool) -> Self
[src]
Set the uniqueness of this type
pub fn increments(self, arg: bool) -> Self
[src]
Specify if this type should auto-increment
pub fn indexed(self, arg: bool) -> Self
[src]
Specify if this type should be indexed by your SQL implementation
pub fn default(self, arg: impl Into<T>) -> Self
[src]
Provide a default value for a type column
pub fn size(self, arg: usize) -> Self
[src]
Specify a size limit (important or varchar & similar)
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> IntoSql for T
[src]
fn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
[src]
Self: AsExpression<T>,
Convert self
to an expression for Diesel's query builder. Read more
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
[src]
&'a Self: AsExpression<T>,
Convert &self
to an expression for Diesel's query builder. Read more