Skip to main content

EnumSqlType

Trait EnumSqlType 

Source
pub trait EnumSqlType<const HAS_EXPLICIT_DISCRIMINANT: bool, DB: Backend>: SqlType {
    type Strategy: EnumMapping<DB>;
}
Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.
Expand description

A marker trait for SQL types representing database side enums

This trait describes how an enum should be mapped to the underlying database storage type by specifying one of a set of different strategies.

The generic constant HAS_EXPLICIT_DISCRIMINANT can be used to enforce that for a given mapping the user needs to provide explicit discriminant values. The #[derive(Enum)] macro will pass the true only if this is the case.

The generic type DB represents the database backend for which this mapping is valid

§Deriving

This trait can be automatically derived by using #[derive(SqlType)] with the #[diesel(enum_type)] attribute

Required Associated Types§

Source

type Strategy: EnumMapping<DB>

The mapping strategy used by this type

This mainly exists to share the logic between different SQL types

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl EnumSqlType<true, Mysql> for Unsigned<BigInt>

Available on crate feature mysql_backend only.
Source§

impl EnumSqlType<true, Mysql> for Unsigned<Integer>

Available on crate feature mysql_backend only.
Source§

impl EnumSqlType<true, Mysql> for Unsigned<SmallInt>

Available on crate feature mysql_backend only.
Source§

impl EnumSqlType<true, Mysql> for Unsigned<TinyInt>

Available on crate feature mysql_backend only.
Source§

impl<DB> EnumSqlType<true, DB> for BigInt
where DB: Backend, IntMapping<i64, Self>: EnumMapping<DB>,

Source§

impl<DB> EnumSqlType<true, DB> for Integer
where DB: Backend, IntMapping<i32, Self>: EnumMapping<DB>,

Source§

impl<DB> EnumSqlType<true, DB> for SmallInt
where DB: Backend, IntMapping<i16, Self>: EnumMapping<DB>,

Source§

impl<DB> EnumSqlType<true, DB> for TinyInt
where DB: Backend, IntMapping<i8, Self>: EnumMapping<DB>,

Source§

impl<const ANYWAY: bool, DB> EnumSqlType<ANYWAY, DB> for Text