Macro diesel::Identifiable
[−]
[src]
macro_rules! Identifiable { ($($args:tt)*) => { ... }; }
Implements the Identifiable
trait for a given struct. This
macro should be called by copy/pasting the definition of the struct into it.
The struct must have a field called id
, and the type of that field must be
Copy
. This macro does not work with tuple structs.
Example
struct User { id: i32, name: String, } Identifiable! { #[table_name(users)] struct User { id: i32, name: String, } }