Refactor the use of deprecated chrono methods (#1312)

This commit is contained in:
Billy Chan 2022-12-16 18:14:25 +08:00 committed by GitHub
parent ccca35ab1a
commit 69eb4b8ea8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 11 deletions

View File

@ -27,8 +27,8 @@ pub async fn crud_in_parallel(db: &DatabaseConnection) -> Result<(), DbErr> {
key: "markup".to_owned(),
value: "1.18".to_owned(),
bytes: vec![1, 2, 3],
date: Some(Date::from_ymd(2021, 9, 27)),
time: Some(Time::from_hms(11, 32, 55)),
date: Some(Date::from_ymd_opt(2021, 9, 27).unwrap()),
time: Some(Time::from_hms_opt(11, 32, 55).unwrap()),
},
metadata::Model {
uuid: Uuid::new_v4(),
@ -36,8 +36,8 @@ pub async fn crud_in_parallel(db: &DatabaseConnection) -> Result<(), DbErr> {
key: "exchange_rate".to_owned(),
value: "0.78".to_owned(),
bytes: vec![1, 2, 3],
date: Some(Date::from_ymd(2021, 9, 27)),
time: Some(Time::from_hms(11, 32, 55)),
date: Some(Date::from_ymd_opt(2021, 9, 27).unwrap()),
time: Some(Time::from_hms_opt(11, 32, 55).unwrap()),
},
metadata::Model {
uuid: Uuid::new_v4(),

View File

@ -23,7 +23,7 @@ pub async fn create_metadata(db: &DatabaseConnection) -> Result<(), DbErr> {
let model = self_join::Model {
uuid: Uuid::new_v4(),
uuid_ref: None,
time: Some(Time::from_hms(1, 00, 00)),
time: Some(Time::from_hms_opt(1, 00, 00).unwrap()),
};
model.clone().into_active_model().insert(db).await?;
@ -31,7 +31,7 @@ pub async fn create_metadata(db: &DatabaseConnection) -> Result<(), DbErr> {
let linked_model = self_join::Model {
uuid: Uuid::new_v4(),
uuid_ref: Some(model.clone().uuid),
time: Some(Time::from_hms(2, 00, 00)),
time: Some(Time::from_hms_opt(2, 00, 00).unwrap()),
};
linked_model.clone().into_active_model().insert(db).await?;
@ -39,7 +39,7 @@ pub async fn create_metadata(db: &DatabaseConnection) -> Result<(), DbErr> {
let not_linked_model = self_join::Model {
uuid: Uuid::new_v4(),
uuid_ref: None,
time: Some(Time::from_hms(3, 00, 00)),
time: Some(Time::from_hms_opt(3, 00, 00).unwrap()),
};
not_linked_model

View File

@ -28,8 +28,8 @@ pub async fn insert_metadata(db: &DatabaseConnection) -> Result<(), DbErr> {
key: "markup".to_owned(),
value: "1.18".to_owned(),
bytes: vec![1, 2, 3],
date: Some(Date::from_ymd(2021, 9, 27)),
time: Some(Time::from_hms(11, 32, 55)),
date: Some(Date::from_ymd_opt(2021, 9, 27).unwrap()),
time: Some(Time::from_hms_opt(11, 32, 55).unwrap()),
};
let result = metadata.clone().into_active_model().insert(db).await?;
@ -65,8 +65,8 @@ pub async fn create_and_update_metadata(db: &DatabaseConnection) -> Result<(), D
key: "markup".to_owned(),
value: "1.18".to_owned(),
bytes: vec![1, 2, 3],
date: Some(Date::from_ymd(2021, 9, 27)),
time: Some(Time::from_hms(11, 32, 55)),
date: Some(Date::from_ymd_opt(2021, 9, 27).unwrap()),
time: Some(Time::from_hms_opt(11, 32, 55).unwrap()),
};
let res = Metadata::insert(metadata.clone().into_active_model())