Run fmt --all
This commit is contained in:
parent
e0023611a2
commit
870ca3ffb0
@ -12,8 +12,8 @@ mod util;
|
|||||||
/// ```
|
/// ```
|
||||||
/// use sea_orm::entity::prelude::*;
|
/// use sea_orm::entity::prelude::*;
|
||||||
///
|
///
|
||||||
///#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
|
/// #[derive(Copy, Clone, Default, Debug, DeriveEntity)]
|
||||||
///pub struct Entity;
|
/// pub struct Entity;
|
||||||
/// ```
|
/// ```
|
||||||
#[proc_macro_derive(DeriveEntity, attributes(sea_orm))]
|
#[proc_macro_derive(DeriveEntity, attributes(sea_orm))]
|
||||||
pub fn derive_entity(input: TokenStream) -> TokenStream {
|
pub fn derive_entity(input: TokenStream) -> TokenStream {
|
||||||
@ -150,13 +150,11 @@ pub fn derive_model(input: TokenStream) -> TokenStream {
|
|||||||
/// ### Usage
|
/// ### Usage
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
///
|
|
||||||
/// #[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)]
|
/// #[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)]
|
||||||
/// pub struct Model {
|
/// pub struct Model {
|
||||||
/// pub id: i32,
|
/// pub id: i32,
|
||||||
/// pub name: String,
|
/// pub name: String,
|
||||||
/// }
|
/// }
|
||||||
///
|
|
||||||
/// ```
|
/// ```
|
||||||
#[proc_macro_derive(DeriveActiveModel, attributes(sea_orm))]
|
#[proc_macro_derive(DeriveActiveModel, attributes(sea_orm))]
|
||||||
pub fn derive_active_model(input: TokenStream) -> TokenStream {
|
pub fn derive_active_model(input: TokenStream) -> TokenStream {
|
||||||
@ -183,7 +181,9 @@ pub fn derive_into_active_model(input: TokenStream) -> TokenStream {
|
|||||||
/// ```
|
/// ```
|
||||||
/// use sea_orm::entity::prelude::*;
|
/// use sea_orm::entity::prelude::*;
|
||||||
///
|
///
|
||||||
/// #[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, DeriveActiveModelBehavior,)]
|
/// #[derive(
|
||||||
|
/// Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, DeriveActiveModelBehavior,
|
||||||
|
/// )]
|
||||||
/// pub struct Model {
|
/// pub struct Model {
|
||||||
/// pub id: i32,
|
/// pub id: i32,
|
||||||
/// pub name: String,
|
/// pub name: String,
|
||||||
|
@ -73,7 +73,7 @@ where
|
|||||||
/// #[derive(Clone, Debug, PartialEq, DeriveActiveModel)]
|
/// #[derive(Clone, Debug, PartialEq, DeriveActiveModel)]
|
||||||
/// pub struct Model {
|
/// pub struct Model {
|
||||||
/// pub id: i32,
|
/// pub id: i32,
|
||||||
/// pub name: Option<String> ,
|
/// pub name: Option<String>,
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
@ -211,6 +211,8 @@ pub trait ActiveModelTrait: Clone + Debug {
|
|||||||
///
|
///
|
||||||
/// ### Example
|
/// ### Example
|
||||||
/// ```
|
/// ```
|
||||||
|
/// use sea_orm::entity::prelude::*;
|
||||||
|
///
|
||||||
/// /// Derive the active
|
/// /// Derive the active
|
||||||
/// #[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)]
|
/// #[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)]
|
||||||
/// pub struct Model {
|
/// pub struct Model {
|
||||||
@ -220,7 +222,6 @@ pub trait ActiveModelTrait: Clone + Debug {
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
/// impl ActiveModelBehavior for ActiveModel {}
|
/// impl ActiveModelBehavior for ActiveModel {}
|
||||||
///
|
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
pub trait ActiveModelBehavior: ActiveModelTrait {
|
pub trait ActiveModelBehavior: ActiveModelTrait {
|
||||||
/// Create a new ActiveModel with default values. Also used by `Default::default()`.
|
/// Create a new ActiveModel with default values. Also used by `Default::default()`.
|
||||||
|
@ -37,7 +37,6 @@ pub trait EntityName: IdenStatic + Default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// FIXME Add docs for manual impl
|
|
||||||
/// An Entity implementing `EntityTrait` represents a table in a database.
|
/// An Entity implementing `EntityTrait` represents a table in a database.
|
||||||
///
|
///
|
||||||
/// This trait provides an API for you to inspect it's properties
|
/// This trait provides an API for you to inspect it's properties
|
||||||
@ -79,7 +78,7 @@ pub trait EntityTrait: EntityName {
|
|||||||
RelationBuilder::from_rel(RelationType::HasOne, R::to().rev(), true)
|
RelationBuilder::from_rel(RelationType::HasOne, R::to().rev(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Chech if the Entity has many relations
|
/// Check if the Entity has many relations
|
||||||
fn has_many<R>(_: R) -> RelationBuilder<Self, R>
|
fn has_many<R>(_: R) -> RelationBuilder<Self, R>
|
||||||
where
|
where
|
||||||
R: EntityTrait + Related<Self>,
|
R: EntityTrait + Related<Self>,
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
//! #[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)]
|
//! #[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)]
|
||||||
//! pub struct Model {
|
//! pub struct Model {
|
||||||
//! pub id: i32,
|
//! pub id: i32,
|
||||||
//! pub name: Option<String> ,
|
//! pub name: Option<String>,
|
||||||
//! }
|
//! }
|
||||||
//!
|
//!
|
||||||
//! // Use the [DeriveColumn] to create a Column for an the table called Entity
|
//! // Use the [DeriveColumn] to create a Column for an the table called Entity
|
||||||
|
Loading…
x
Reference in New Issue
Block a user