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<Ident>,
pub one_to_many_foreign_key: Option<Path>,
pub column: Option<LitStr>,
pub skip: Flag,
pub experimental_encode_as_json: Flag,
}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<Ident>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.
skip: FlagSkip serializing this field to/from the database. Note the field must implement Default.
experimental_encode_as_json: FlagExperimental: Encode this field as JSON in the database.
Only applies to derive(IntoArguments). For Model structs, wrap the object in Json<..>.