Struct ormlite_attr::ColumnAttributes
source · pub struct ColumnAttributes {
pub primary_key: bool,
pub default: bool,
pub many_to_one_key: Option<Path>,
pub many_to_many_table: Option<Path>,
pub one_to_many_foreign_key: Option<Path>,
pub column: Option<LitStr>,
}Expand description
Available attributes on a column (struct field)
Fields§
§primary_key: bool§default: bool§many_to_one_key: Option<Path>Example:
pub struct User {
pub org_id: i32,
#[ormlite(many_to_one_key = org_id)]
pub organization: Join
many_to_many_table: Option<Path>Example:
pub struct User {
pub org_id: i32,
#[ormlite(many_to_many_table_name = join_user_role)]
pub roles: Join<Vec
one_to_many_foreign_key: Option<Path>Example:
pub struct User {
pub id: i32,
#[ormlite(one_to_many_foreign_key = Post::author_id)]
pub posts: Join<Vec
pub struct Post { pub id: i32, pub author_id: i32, }
column: Option<LitStr>The name of the column in the database. Defaults to the field name.