cargo fmt
This commit is contained in:
parent
091a91fc0a
commit
fff738a706
@ -298,11 +298,7 @@ pub async fn create_json_vec_table(db: &DbConn) -> Result<ExecResult, DbErr> {
|
|||||||
.auto_increment()
|
.auto_increment()
|
||||||
.primary_key(),
|
.primary_key(),
|
||||||
)
|
)
|
||||||
.col(
|
.col(ColumnDef::new(json_vec::Column::StrVec).string().not_null())
|
||||||
ColumnDef::new(json_vec::Column::StrVec)
|
|
||||||
.string()
|
|
||||||
.not_null(),
|
|
||||||
)
|
|
||||||
.to_owned();
|
.to_owned();
|
||||||
|
|
||||||
create_table(db, &create_table_stmt, JsonVec).await
|
create_table(db, &create_table_stmt, JsonVec).await
|
||||||
|
@ -22,11 +22,7 @@ async fn main() -> Result<(), DbErr> {
|
|||||||
pub async fn insert_json_vec(db: &DatabaseConnection) -> Result<(), DbErr> {
|
pub async fn insert_json_vec(db: &DatabaseConnection) -> Result<(), DbErr> {
|
||||||
let json_vec = json_vec::Model {
|
let json_vec = json_vec::Model {
|
||||||
id: 1,
|
id: 1,
|
||||||
str_vec: json_vec::StringVec(vec![
|
str_vec: json_vec::StringVec(vec!["1".to_string(), "2".to_string(), "3".to_string()]),
|
||||||
"1".to_string(),
|
|
||||||
"2".to_string(),
|
|
||||||
"3".to_string(),
|
|
||||||
])
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = json_vec.clone().into_active_model().insert(db).await?;
|
let result = json_vec.clone().into_active_model().insert(db).await?;
|
||||||
@ -38,10 +34,7 @@ pub async fn insert_json_vec(db: &DatabaseConnection) -> Result<(), DbErr> {
|
|||||||
.one(db)
|
.one(db)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(model, Some(json_vec));
|
||||||
model,
|
|
||||||
Some(json_vec)
|
|
||||||
);
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user