MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / insert_json_vec

Function insert_json_vec

tests/json_vec_tests.rs:22–44  ·  view source on GitHub ↗
(db: &DatabaseConnection)

Source from the content-addressed store, hash-verified

20}
21
22pub async fn insert_json_vec(db: &DatabaseConnection) -> Result<(), DbErr> {
23 let json_vec = json_vec::Model {
24 id: 1,
25 str_vec: Some(json_vec::StringVec(vec![
26 "1".to_string(),
27 "2".to_string(),
28 "3".to_string(),
29 ])),
30 };
31
32 let result = json_vec.clone().into_active_model().insert(db).await?;
33
34 assert_eq!(result, json_vec);
35
36 let model = json_vec::Entity::find()
37 .filter(json_vec::Column::Id.eq(json_vec.id))
38 .one(db)
39 .await?;
40
41 assert_eq!(model, Some(json_vec));
42
43 Ok(())
44}
45
46pub async fn insert_json_string_vec_derive(db: &DatabaseConnection) -> Result<(), DbErr> {
47 let json_vec = json_vec_derive::json_string_vec::Model {

Callers 1

mainFunction · 0.85

Calls 6

into_active_modelMethod · 0.80
filterMethod · 0.80
StringVecClass · 0.50
insertMethod · 0.45
oneMethod · 0.45
eqMethod · 0.45

Tested by

no test coverage detected