[][src]Derive Macro diesel::prelude::Insertable

    // Attributes available to this derive:

Implements Insertable

To implement Insertable this derive needs to know the corresponding table type. By default it uses the snake_case type name with an added s. It is possible to change this default by using #[table_name = "something"]. In both cases the module for that table must be in scope. For example, to derive this for a struct called User, you will likely need a line such as use schema::users;

If a field name of your struct differs from the name of the corresponding column, you can annotate the field with #[column_name = "some_column_name"].

Your struct can also contain fields which implement Insertable. This is useful when you want to have one field map to more than one column (for example, an enum that maps to a label and a value column). Add #[diesel(embed)] to any such fields.


Optional type attributes

Optional field attributes