Refactor the use of deprecated chrono methods (#1312)
This commit is contained in:
parent
ccca35ab1a
commit
69eb4b8ea8
@ -27,8 +27,8 @@ pub async fn crud_in_parallel(db: &DatabaseConnection) -> Result<(), DbErr> {
|
|||||||
key: "markup".to_owned(),
|
key: "markup".to_owned(),
|
||||||
value: "1.18".to_owned(),
|
value: "1.18".to_owned(),
|
||||||
bytes: vec![1, 2, 3],
|
bytes: vec![1, 2, 3],
|
||||||
date: Some(Date::from_ymd(2021, 9, 27)),
|
date: Some(Date::from_ymd_opt(2021, 9, 27).unwrap()),
|
||||||
time: Some(Time::from_hms(11, 32, 55)),
|
time: Some(Time::from_hms_opt(11, 32, 55).unwrap()),
|
||||||
},
|
},
|
||||||
metadata::Model {
|
metadata::Model {
|
||||||
uuid: Uuid::new_v4(),
|
uuid: Uuid::new_v4(),
|
||||||
@ -36,8 +36,8 @@ pub async fn crud_in_parallel(db: &DatabaseConnection) -> Result<(), DbErr> {
|
|||||||
key: "exchange_rate".to_owned(),
|
key: "exchange_rate".to_owned(),
|
||||||
value: "0.78".to_owned(),
|
value: "0.78".to_owned(),
|
||||||
bytes: vec![1, 2, 3],
|
bytes: vec![1, 2, 3],
|
||||||
date: Some(Date::from_ymd(2021, 9, 27)),
|
date: Some(Date::from_ymd_opt(2021, 9, 27).unwrap()),
|
||||||
time: Some(Time::from_hms(11, 32, 55)),
|
time: Some(Time::from_hms_opt(11, 32, 55).unwrap()),
|
||||||
},
|
},
|
||||||
metadata::Model {
|
metadata::Model {
|
||||||
uuid: Uuid::new_v4(),
|
uuid: Uuid::new_v4(),
|
||||||
|
@ -23,7 +23,7 @@ pub async fn create_metadata(db: &DatabaseConnection) -> Result<(), DbErr> {
|
|||||||
let model = self_join::Model {
|
let model = self_join::Model {
|
||||||
uuid: Uuid::new_v4(),
|
uuid: Uuid::new_v4(),
|
||||||
uuid_ref: None,
|
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?;
|
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 {
|
let linked_model = self_join::Model {
|
||||||
uuid: Uuid::new_v4(),
|
uuid: Uuid::new_v4(),
|
||||||
uuid_ref: Some(model.clone().uuid),
|
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?;
|
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 {
|
let not_linked_model = self_join::Model {
|
||||||
uuid: Uuid::new_v4(),
|
uuid: Uuid::new_v4(),
|
||||||
uuid_ref: None,
|
uuid_ref: None,
|
||||||
time: Some(Time::from_hms(3, 00, 00)),
|
time: Some(Time::from_hms_opt(3, 00, 00).unwrap()),
|
||||||
};
|
};
|
||||||
|
|
||||||
not_linked_model
|
not_linked_model
|
||||||
|
@ -28,8 +28,8 @@ pub async fn insert_metadata(db: &DatabaseConnection) -> Result<(), DbErr> {
|
|||||||
key: "markup".to_owned(),
|
key: "markup".to_owned(),
|
||||||
value: "1.18".to_owned(),
|
value: "1.18".to_owned(),
|
||||||
bytes: vec![1, 2, 3],
|
bytes: vec![1, 2, 3],
|
||||||
date: Some(Date::from_ymd(2021, 9, 27)),
|
date: Some(Date::from_ymd_opt(2021, 9, 27).unwrap()),
|
||||||
time: Some(Time::from_hms(11, 32, 55)),
|
time: Some(Time::from_hms_opt(11, 32, 55).unwrap()),
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = metadata.clone().into_active_model().insert(db).await?;
|
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(),
|
key: "markup".to_owned(),
|
||||||
value: "1.18".to_owned(),
|
value: "1.18".to_owned(),
|
||||||
bytes: vec![1, 2, 3],
|
bytes: vec![1, 2, 3],
|
||||||
date: Some(Date::from_ymd(2021, 9, 27)),
|
date: Some(Date::from_ymd_opt(2021, 9, 27).unwrap()),
|
||||||
time: Some(Time::from_hms(11, 32, 55)),
|
time: Some(Time::from_hms_opt(11, 32, 55).unwrap()),
|
||||||
};
|
};
|
||||||
|
|
||||||
let res = Metadata::insert(metadata.clone().into_active_model())
|
let res = Metadata::insert(metadata.clone().into_active_model())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user