pub struct ColumnAttr {
pub primary_key: Flag,
pub insertable_primary_key: Flag,
pub default: Flag,
pub default_value: Option<LitStr>,
pub join_table: Option<LitStr>,
pub foreign_field: Option<Path>,
pub column: Option<LitStr>,
pub skip: Flag,
pub json: Flag,
}Expand description
Available attributes on a column (struct field)
Fields§
§primary_key: Flag§insertable_primary_key: FlagMarks a primary key, but includes it in the Insert struct.
default: FlagSpecifies that a default exists at the database level.
default_value: Option<LitStr>Specify a default value on the Rust side.
join_table: Option<LitStr>Example:
pub struct User {
pub org_id: i32,
#[ormlite(join_table = “user_role”)]
pub roles: Join<Vec
foreign_field: Option<Path>Example:
pub struct User {
pub id: i32,
#[ormlite(foreign_field = 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.
Required for many to one joins.
Example:
pub struct User {
#[ormlite(column = “organization_id”)]
pub organization: Join
skip: FlagSkip serializing this field to/from the database. Note the field must implement Default.
json: FlagImplementations§
Source§impl ColumnAttr
impl ColumnAttr
pub fn from_attrs(ast: &[Attribute]) -> Vec<Self>
Trait Implementations§
Source§impl Parse for ColumnAttr
impl Parse for ColumnAttr
fn parse(input: ParseStream<'_>) -> Result<Self>
Auto Trait Implementations§
impl Freeze for ColumnAttr
impl RefUnwindSafe for ColumnAttr
impl !Send for ColumnAttr
impl !Sync for ColumnAttr
impl Unpin for ColumnAttr
impl UnwindSafe for ColumnAttr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more