[][src]Enum barrel::Type

pub enum Type {
    Text,
    Varchar(usize),
    Primary,
    Integer,
    Float,
    Double,
    Boolean,
    Binary,
    Foreign(&'static str),
    Custom(&'static str),
    Array(Box<Type>),
}

Type enum to specificy the type of an SQL column. NOTE: Not all types are supported by all database backends!

When creating a column users need to specify the type and potential metadata this type requires to the add_column function.

t.add_column("posts", Type::Array(box Type::Foreign("posts")));

Variants

Text

Create a simple "text" field

Varchar(usize)

Provide a size limit for this field

Primary

Create a primary key regardless of database

This type is more of a convenience wrapper around other (64-bit) integer types. It might be changed at some point or just removed.

Be careful when using this type!

Integer

Creates a 64-bit integer

Float

Creates a 32-bit float

Double

Creates a 64-bit float

Boolean

Boring ol' boolean

Binary

Create a simple "binary" field

Foreign(&'static str)

Provide the name of a table to point to

Custom(&'static str)

Used for types not Implemented by the migration system. This field is not statically checked.

Array(Box<Type>)

Any type can also exist as an array type

Trait Implementations

impl PartialEq<Type> for Type[src]

impl Clone for Type[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Type[src]

Auto Trait Implementations

impl Send for Type

impl Sync for Type

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> IntoSql for T[src]

fn into_sql<T>(self) -> Self::Expression where
    Self: AsExpression<T>, 
[src]

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]

Convert &self to an expression for Diesel's query builder. Read more