Skip to main content

AutoIncrementTable

Trait AutoIncrementTable 

Source
pub trait AutoIncrementTable: Table + Sealed {
    type AutoIncrementColumn: Column<Table = Self>;
}
Available on crate features mariadb_backend or mysql_backend only.
Expand description

A table with a column the database fills from an AUTO_INCREMENT counter when an insert does not provide a value (MySQL and MariaDB).

Sealed, implemented only by the table! macro for tables marking a column with #[auto_increment], an attribute diesel print-schema emits for those backends.

The trait itself needs only a backend feature, so a generated schema.rs compiles under every feature combination. Its consumer, InsertStatement::execute_returning_id, additionally requires the mysql or mariadb connection feature.

Required Associated Types§

Source

type AutoIncrementColumn: Column<Table = Self>

The column filled from the table’s AUTO_INCREMENT counter.

Recorded for future use, execute_returning_id does not consult it.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§