Run fmt --all

This commit is contained in:
Charles Chege 2021-10-30 12:00:07 +03:00
parent e0023611a2
commit 870ca3ffb0
4 changed files with 16 additions and 16 deletions

View File

@ -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,
@ -203,11 +203,11 @@ pub fn derive_active_model_behavior(input: TokenStream) -> TokenStream {
/// ### Usage /// ### Usage
/// ///
/// ``` /// ```
/// #[derive(Debug, FromQueryResult)] /// #[derive(Debug, FromQueryResult)]
/// struct SelectResult { /// struct SelectResult {
/// name: String, /// name: String,
/// num_of_fruits: i32, /// num_of_fruits: i32,
/// } /// }
/// ``` /// ```
#[proc_macro_derive(FromQueryResult)] #[proc_macro_derive(FromQueryResult)]
pub fn derive_from_query_result(input: TokenStream) -> TokenStream { pub fn derive_from_query_result(input: TokenStream) -> TokenStream {
@ -224,7 +224,7 @@ pub fn derive_from_query_result(input: TokenStream) -> TokenStream {
/// ``` /// ```
/// #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] /// #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
/// pub enum Relation { /// pub enum Relation {
/// #[sea_orm( /// #[sea_orm(
/// belongs_to = "super::cake::Entity", /// belongs_to = "super::cake::Entity",
/// from = "Column::CakeId", /// from = "Column::CakeId",
/// to = "super::cake::Column::Id" /// to = "super::cake::Column::Id"

View File

@ -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()`.

View File

@ -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>,

View File

@ -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