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: Flag

Skip serializing this field to/from the database. Note the field must implement Default.

§experimental_encode_as_json: Flag

Experimental: Encode this field as JSON in the database. Only applies to derive(IntoArguments). For Model structs, wrap the object in Json<..>.

Trait Implementations§

source§

impl Debug for ColumnAttributes

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Parse for ColumnAttributes

source§

fn parse(input: ParseStream<'_>) -> Result<Self>

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.