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

Method from_json_vec

src/executor/query.rs:1370–1383  ·  view source on GitHub ↗

Get a Vec from an Array of Json

(value: serde_json::Value)

Source from the content-addressed store, hash-verified

1368
1369 /// Get a Vec<Self> from an Array of Json
1370 fn from_json_vec(value: serde_json::Value) -> Result<Vec<Self>, TryGetError> {
1371 match value {
1372 serde_json::Value::Array(values) => {
1373 let mut res = Vec::new();
1374 for item in values {
1375 res.push(serde_json::from_value(item).map_err(crate::error::json_err)?);
1376 }
1377 Ok(res)
1378 }
1379 _ => Err(TryGetError::DbErr(DbErr::Json(
1380 "Value is not an Array".to_owned(),
1381 ))),
1382 }
1383 }
1384}
1385
1386#[cfg(feature = "with-json")]

Callers

nothing calls this directly

Implementers 1

json_vec.rstests/common/features/json_vec.rs

Calls 3

DbErrEnum · 0.85
pushMethod · 0.80
newFunction · 0.50

Tested by

no test coverage detected