Trait butane::FieldType

source ·
pub trait FieldType: ToSql + FromSql {
    type RefType: ToSql + ?Sized;

    const SQLTYPE: SqlType;
}
Expand description

Type suitable for being a database column.

Required Associated Types§

source

type RefType: ToSql + ?Sized

Reference type. Used for ergonomics with String (which has reference type str). For most, it is Self

Required Associated Constants§

Implementations on Foreign Types§

source§

impl FieldType for f32

source§

const SQLTYPE: SqlType = SqlType::Real

§

type RefType = f32

source§

impl FieldType for Value

source§

const SQLTYPE: SqlType = SqlType::Json

§

type RefType = Value

source§

impl FieldType for i64

source§

const SQLTYPE: SqlType = SqlType::BigInt

§

type RefType = i64

source§

impl FieldType for i8

source§

const SQLTYPE: SqlType = SqlType::Int

§

type RefType = i8

source§

impl FieldType for Uuid

source§

const SQLTYPE: SqlType = SqlType::Blob

§

type RefType = Uuid

source§

impl FieldType for DateTime<Utc>

source§

const SQLTYPE: SqlType = SqlType::Timestamp

§

type RefType = str

source§

impl FieldType for u32

source§

const SQLTYPE: SqlType = SqlType::BigInt

§

type RefType = u32

source§

impl FieldType for u16

source§

const SQLTYPE: SqlType = SqlType::Int

§

type RefType = u16

source§

impl FieldType for Vec<u8, Global>

source§

const SQLTYPE: SqlType = SqlType::Blob

§

type RefType = Vec<u8, Global>

source§

impl FieldType for String

source§

const SQLTYPE: SqlType = SqlType::Text

§

type RefType = str

source§

impl FieldType for i16

source§

const SQLTYPE: SqlType = SqlType::Int

§

type RefType = i16

source§

impl<T> FieldType for Option<T>where T: FieldType,

source§

const SQLTYPE: SqlType = T::SQLTYPE

§

type RefType = Option<T>

source§

impl FieldType for bool

source§

const SQLTYPE: SqlType = SqlType::Bool

§

type RefType = bool

source§

impl FieldType for u8

source§

const SQLTYPE: SqlType = SqlType::Int

§

type RefType = u8

source§

impl FieldType for i32

source§

const SQLTYPE: SqlType = SqlType::Int

§

type RefType = i32

source§

impl FieldType for f64

source§

const SQLTYPE: SqlType = SqlType::Real

§

type RefType = f64

source§

impl FieldType for NaiveDateTime

source§

const SQLTYPE: SqlType = SqlType::Timestamp

§

type RefType = str

source§

impl<T> FieldType for HashMap<String, T, RandomState>where T: Clone + PartialEq<T> + for<'a> Deserialize<'a> + Serialize,

§

type RefType = HashMap<String, T, RandomState>

source§

const SQLTYPE: SqlType = SqlType::Json

Implementors§

source§

impl<T> FieldType for ForeignKey<T>where T: DataObject,

source§

const SQLTYPE: SqlType = <<T as DataObject>::PKType>::SQLTYPE

§

type RefType = <<T as DataObject>::PKType as FieldType>::RefType