pub fn validate_rows<S, T>(rows: &[T]) -> Result<(), (usize, VldSqlxError)>Expand description
Validate a batch of rows against schema S.
Returns the index and error of the first invalid row.
use vld::prelude::*;
vld::schema! {
#[derive(Debug)]
pub struct NameSchema {
pub name: String => vld::string().min(1),
}
}
#[derive(serde::Serialize)]
struct Row { name: String }
let rows = vec![
Row { name: "Alice".into() },
Row { name: "Bob".into() },
];
assert!(vld_sqlx::validate_rows::<NameSchema, _>(&rows).is_ok());