Add #[automatically_derived]
to all derived implementations
This commit is contained in:
parent
2a34381a8d
commit
864ec522b8
@ -68,12 +68,14 @@ pub fn expand_derive_active_model(ident: Ident, data: Data) -> syn::Result<Token
|
|||||||
#(pub #field: sea_orm::ActiveValue<#ty>),*
|
#(pub #field: sea_orm::ActiveValue<#ty>),*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[automatically_derived]
|
||||||
impl std::default::Default for ActiveModel {
|
impl std::default::Default for ActiveModel {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
<Self as sea_orm::ActiveModelBehavior>::new()
|
<Self as sea_orm::ActiveModelBehavior>::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[automatically_derived]
|
||||||
impl std::convert::From<<Entity as EntityTrait>::Model> for ActiveModel {
|
impl std::convert::From<<Entity as EntityTrait>::Model> for ActiveModel {
|
||||||
fn from(m: <Entity as EntityTrait>::Model) -> Self {
|
fn from(m: <Entity as EntityTrait>::Model) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -82,12 +84,14 @@ pub fn expand_derive_active_model(ident: Ident, data: Data) -> syn::Result<Token
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[automatically_derived]
|
||||||
impl sea_orm::IntoActiveModel<ActiveModel> for <Entity as EntityTrait>::Model {
|
impl sea_orm::IntoActiveModel<ActiveModel> for <Entity as EntityTrait>::Model {
|
||||||
fn into_active_model(self) -> ActiveModel {
|
fn into_active_model(self) -> ActiveModel {
|
||||||
self.into()
|
self.into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[automatically_derived]
|
||||||
impl sea_orm::ActiveModelTrait for ActiveModel {
|
impl sea_orm::ActiveModelTrait for ActiveModel {
|
||||||
type Entity = Entity;
|
type Entity = Entity;
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ use syn::Data;
|
|||||||
|
|
||||||
pub fn expand_derive_active_model_behavior(_ident: Ident, _data: Data) -> syn::Result<TokenStream> {
|
pub fn expand_derive_active_model_behavior(_ident: Ident, _data: Data) -> syn::Result<TokenStream> {
|
||||||
Ok(quote!(
|
Ok(quote!(
|
||||||
|
#[automatically_derived]
|
||||||
impl sea_orm::ActiveModelBehavior for ActiveModel {}
|
impl sea_orm::ActiveModelBehavior for ActiveModel {}
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@ pub fn impl_default_as_str(ident: &Ident, data: &Data) -> syn::Result<TokenStrea
|
|||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
Ok(quote!(
|
Ok(quote!(
|
||||||
|
#[automatically_derived]
|
||||||
impl #ident {
|
impl #ident {
|
||||||
fn default_as_str(&self) -> &str {
|
fn default_as_str(&self) -> &str {
|
||||||
match self {
|
match self {
|
||||||
@ -84,6 +85,7 @@ pub fn impl_col_from_str(ident: &Ident, data: &Data) -> syn::Result<TokenStream>
|
|||||||
});
|
});
|
||||||
|
|
||||||
Ok(quote!(
|
Ok(quote!(
|
||||||
|
#[automatically_derived]
|
||||||
impl std::str::FromStr for #ident {
|
impl std::str::FromStr for #ident {
|
||||||
type Err = sea_orm::ColumnFromStrErr;
|
type Err = sea_orm::ColumnFromStrErr;
|
||||||
|
|
||||||
@ -103,6 +105,7 @@ pub fn expand_derive_column(ident: &Ident, data: &Data) -> syn::Result<TokenStre
|
|||||||
Ok(quote!(
|
Ok(quote!(
|
||||||
#impl_iden
|
#impl_iden
|
||||||
|
|
||||||
|
#[automatically_derived]
|
||||||
impl sea_orm::IdenStatic for #ident {
|
impl sea_orm::IdenStatic for #ident {
|
||||||
fn as_str(&self) -> &str {
|
fn as_str(&self) -> &str {
|
||||||
self.default_as_str()
|
self.default_as_str()
|
||||||
@ -120,6 +123,7 @@ pub fn expand_derive_custom_column(ident: &Ident, data: &Data) -> syn::Result<To
|
|||||||
|
|
||||||
#impl_col_from_str
|
#impl_col_from_str
|
||||||
|
|
||||||
|
#[automatically_derived]
|
||||||
impl sea_orm::Iden for #ident {
|
impl sea_orm::Iden for #ident {
|
||||||
fn unquoted(&self, s: &mut dyn std::fmt::Write) {
|
fn unquoted(&self, s: &mut dyn std::fmt::Write) {
|
||||||
write!(s, "{}", self.as_str()).unwrap();
|
write!(s, "{}", self.as_str()).unwrap();
|
||||||
|
@ -70,6 +70,7 @@ impl DeriveEntity {
|
|||||||
.unwrap_or_else(|| quote!(None));
|
.unwrap_or_else(|| quote!(None));
|
||||||
|
|
||||||
quote!(
|
quote!(
|
||||||
|
#[automatically_derived]
|
||||||
impl sea_orm::entity::EntityName for #ident {
|
impl sea_orm::entity::EntityName for #ident {
|
||||||
fn schema_name(&self) -> Option<&str> {
|
fn schema_name(&self) -> Option<&str> {
|
||||||
#expanded_schema_name
|
#expanded_schema_name
|
||||||
@ -93,6 +94,7 @@ impl DeriveEntity {
|
|||||||
} = self;
|
} = self;
|
||||||
|
|
||||||
quote!(
|
quote!(
|
||||||
|
#[automatically_derived]
|
||||||
impl sea_orm::entity::EntityTrait for #ident {
|
impl sea_orm::entity::EntityTrait for #ident {
|
||||||
type Model = #model_ident;
|
type Model = #model_ident;
|
||||||
|
|
||||||
@ -109,6 +111,7 @@ impl DeriveEntity {
|
|||||||
let ident = &self.ident;
|
let ident = &self.ident;
|
||||||
|
|
||||||
quote!(
|
quote!(
|
||||||
|
#[automatically_derived]
|
||||||
impl sea_orm::Iden for #ident {
|
impl sea_orm::Iden for #ident {
|
||||||
fn unquoted(&self, s: &mut dyn std::fmt::Write) {
|
fn unquoted(&self, s: &mut dyn std::fmt::Write) {
|
||||||
write!(s, "{}", self.as_str()).unwrap();
|
write!(s, "{}", self.as_str()).unwrap();
|
||||||
@ -121,6 +124,7 @@ impl DeriveEntity {
|
|||||||
let ident = &self.ident;
|
let ident = &self.ident;
|
||||||
|
|
||||||
quote!(
|
quote!(
|
||||||
|
#[automatically_derived]
|
||||||
impl sea_orm::IdenStatic for #ident {
|
impl sea_orm::IdenStatic for #ident {
|
||||||
fn as_str(&self) -> &str {
|
fn as_str(&self) -> &str {
|
||||||
<Self as sea_orm::EntityName>::table_name(self)
|
<Self as sea_orm::EntityName>::table_name(self)
|
||||||
|
@ -37,6 +37,7 @@ pub fn expand_derive_entity_model(data: Data, attrs: Vec<Attribute>) -> syn::Res
|
|||||||
#[derive(Copy, Clone, Default, Debug, sea_orm::prelude::DeriveEntity)]
|
#[derive(Copy, Clone, Default, Debug, sea_orm::prelude::DeriveEntity)]
|
||||||
pub struct Entity;
|
pub struct Entity;
|
||||||
|
|
||||||
|
#[automatically_derived]
|
||||||
impl sea_orm::prelude::EntityName for Entity {
|
impl sea_orm::prelude::EntityName for Entity {
|
||||||
fn schema_name(&self) -> Option<&str> {
|
fn schema_name(&self) -> Option<&str> {
|
||||||
#schema_name
|
#schema_name
|
||||||
@ -273,6 +274,7 @@ pub fn expand_derive_entity_model(data: Data, attrs: Vec<Attribute>) -> syn::Res
|
|||||||
#primary_keys
|
#primary_keys
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[automatically_derived]
|
||||||
impl PrimaryKeyTrait for PrimaryKey {
|
impl PrimaryKeyTrait for PrimaryKey {
|
||||||
type ValueType = #primary_key_types;
|
type ValueType = #primary_key_types;
|
||||||
|
|
||||||
@ -290,6 +292,7 @@ pub fn expand_derive_entity_model(data: Data, attrs: Vec<Attribute>) -> syn::Res
|
|||||||
#columns_enum
|
#columns_enum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[automatically_derived]
|
||||||
impl sea_orm::prelude::ColumnTrait for Column {
|
impl sea_orm::prelude::ColumnTrait for Column {
|
||||||
type EntityName = Entity;
|
type EntityName = Entity;
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ pub fn expand_derive_from_query_result(ident: Ident, data: Data) -> syn::Result<
|
|||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
Ok(quote!(
|
Ok(quote!(
|
||||||
|
#[automatically_derived]
|
||||||
impl sea_orm::FromQueryResult for #ident {
|
impl sea_orm::FromQueryResult for #ident {
|
||||||
fn from_query_result(row: &sea_orm::QueryResult, pre: &str) -> Result<Self, sea_orm::DbErr> {
|
fn from_query_result(row: &sea_orm::QueryResult, pre: &str) -> Result<Self, sea_orm::DbErr> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
|
@ -76,6 +76,7 @@ impl IntoActiveModel {
|
|||||||
});
|
});
|
||||||
|
|
||||||
quote!(
|
quote!(
|
||||||
|
#[automatically_derived]
|
||||||
impl sea_orm::IntoActiveModel<#active_model_ident> for #ident {
|
impl sea_orm::IntoActiveModel<#active_model_ident> for #ident {
|
||||||
fn into_active_model(self) -> #active_model_ident {
|
fn into_active_model(self) -> #active_model_ident {
|
||||||
#active_model_ident {
|
#active_model_ident {
|
||||||
|
@ -123,6 +123,7 @@ impl DeriveModel {
|
|||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
quote!(
|
quote!(
|
||||||
|
#[automatically_derived]
|
||||||
impl sea_orm::FromQueryResult for #ident {
|
impl sea_orm::FromQueryResult for #ident {
|
||||||
fn from_query_result(row: &sea_orm::QueryResult, pre: &str) -> Result<Self, sea_orm::DbErr> {
|
fn from_query_result(row: &sea_orm::QueryResult, pre: &str) -> Result<Self, sea_orm::DbErr> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
@ -160,6 +161,7 @@ impl DeriveModel {
|
|||||||
let missing_field_msg = format!("field does not exist on {}", ident);
|
let missing_field_msg = format!("field does not exist on {}", ident);
|
||||||
|
|
||||||
quote!(
|
quote!(
|
||||||
|
#[automatically_derived]
|
||||||
impl sea_orm::ModelTrait for #ident {
|
impl sea_orm::ModelTrait for #ident {
|
||||||
type Entity = #entity_ident;
|
type Entity = #entity_ident;
|
||||||
|
|
||||||
|
@ -31,12 +31,14 @@ pub fn expand_derive_primary_key(ident: Ident, data: Data) -> syn::Result<TokenS
|
|||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
Ok(quote!(
|
Ok(quote!(
|
||||||
|
#[automatically_derived]
|
||||||
impl sea_orm::Iden for #ident {
|
impl sea_orm::Iden for #ident {
|
||||||
fn unquoted(&self, s: &mut dyn std::fmt::Write) {
|
fn unquoted(&self, s: &mut dyn std::fmt::Write) {
|
||||||
write!(s, "{}", self.as_str()).unwrap();
|
write!(s, "{}", self.as_str()).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[automatically_derived]
|
||||||
impl sea_orm::IdenStatic for #ident {
|
impl sea_orm::IdenStatic for #ident {
|
||||||
fn as_str(&self) -> &str {
|
fn as_str(&self) -> &str {
|
||||||
match self {
|
match self {
|
||||||
@ -45,6 +47,7 @@ pub fn expand_derive_primary_key(ident: Ident, data: Data) -> syn::Result<TokenS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[automatically_derived]
|
||||||
impl sea_orm::PrimaryKeyToColumn for #ident {
|
impl sea_orm::PrimaryKeyToColumn for #ident {
|
||||||
type Column = Column;
|
type Column = Column;
|
||||||
|
|
||||||
|
@ -143,6 +143,7 @@ impl DeriveRelation {
|
|||||||
.collect::<Result<Vec<_>, _>>()?;
|
.collect::<Result<Vec<_>, _>>()?;
|
||||||
|
|
||||||
Ok(quote!(
|
Ok(quote!(
|
||||||
|
#[automatically_derived]
|
||||||
impl sea_orm::entity::RelationTrait for #ident {
|
impl sea_orm::entity::RelationTrait for #ident {
|
||||||
fn def(&self) -> sea_orm::entity::RelationDef {
|
fn def(&self) -> sea_orm::entity::RelationDef {
|
||||||
match self {
|
match self {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user