Derive Macro diesel::associations::Identifiable[][src]

#[derive(Identifiable)]
{
    // Attributes available to this derive:
    #[table_name]
    #[primary_key]
    #[column_name]
}

Implements Identifiable for references of the current type

By default, the primary key field is assumed to be a single field called id. If it’s not, you can put #[primary_key(your_id)] on your struct. If you have a composite primary key, the syntax is #[primary_key(id1, id2)].

By default, #[derive(Identifiable)] will assume that your table is in scope and its name is the plural form of your struct name. Diesel uses very simple pluralization rules. It only adds an s to the end, and converts CamelCase to snake_case. If your table name does not follow this convention or is not in scope, you can specify a path to the table with #[table_name = "path::to::table"]. Our rules for inferring table names is considered public API. It will never change without a major version bump.

Attributes

Optional container attributes