Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into cont-pr-725
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 committed Aug 25, 2022
2 parents 1cab795 + 3727f7b commit 20d2d24
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions examples/basic/src/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,17 @@ mod form {
use super::fruit::*;
use sea_orm::entity::prelude::*;

#[derive(
Clone, Debug, PartialEq, Eq, DeriveModel, DeriveActiveModel, DeriveActiveModelBehavior,
)]
pub struct Model {
pub id: i32,
#[derive(Clone, Debug, PartialEq, Eq, DeriveIntoActiveModel)]
pub struct InputModel {
pub name: String,
}
}

async fn save_custom_active_model(db: &DbConn) -> Result<(), DbErr> {
let pineapple = form::ActiveModel {
id: NotSet,
name: Set("Pineapple".to_owned()),
};
let pineapple = form::InputModel {
name: "Pineapple".to_owned(),
}
.into_active_model();

let pineapple = pineapple.save(db).await?;

Expand Down

0 comments on commit 20d2d24

Please sign in to comment.