Skip to content

Commit 0ee6f18

Browse files
committed
comment
1 parent 7c8feff commit 0ee6f18

File tree

1 file changed

+2
-55
lines changed

1 file changed

+2
-55
lines changed

src/types/from_sql.rs

+2-55
Original file line numberDiff line numberDiff line change
@@ -175,61 +175,8 @@ impl<'a> FromSql<'a> for uuid::Uuid {
175175
}
176176
}
177177

178-
// macro_rules! from_sql_vec_impl {
179-
// ( $( $t:ty: $k:pat => $f:expr ),* ) => {
180-
// $(
181-
// impl<'a> FromSql<'a> for Vec<$t> {
182-
// fn from_sql(value: ValueRef<'a>) -> FromSqlResult<Self> {
183-
// match value {
184-
// ValueRef::Array($k, vs) => {
185-
// let f: fn(ValueRef<'a>) -> FromSqlResult<$t> = $f;
186-
// let mut result = Vec::with_capacity(vs.len());
187-
// for r in vs.iter() {
188-
// let value: $t = f(r.clone())?;
189-
// result.push(value);
190-
// }
191-
// Ok(result)
192-
// }
193-
// _ => {
194-
// let from = SqlType::from(value.clone()).to_string();
195-
// Err(Error::FromSql(FromSqlError::InvalidType {
196-
// src: from,
197-
// dst: format!("Vec<{}>", stringify!($t)).into(),
198-
// }))
199-
// }
200-
// }
201-
// }
202-
// }
203-
// )*
204-
// // New implementation for nested Vec<Vec<T>>
205-
// $(
206-
// impl<'a> FromSql<'a> for Vec<Vec<$t>> {
207-
// fn from_sql(value: ValueRef<'a>) -> FromSqlResult<Self> {
208-
// match value {
209-
// ValueRef::Array(SqlType::Array(_), outer_vs) => {
210-
// outer_vs.iter().map(|outer_v| match outer_v {
211-
// ValueRef::Array($k, inner_vs) => {
212-
// let f: fn(ValueRef<'a>) -> FromSqlResult<$t> = $f;
213-
// inner_vs.iter().map(|inner_v| f(inner_v.clone())).collect()
214-
// },
215-
// _ => Err(Error::FromSql(FromSqlError::InvalidType {
216-
// src: SqlType::from(outer_v.clone()).to_string(),
217-
// dst: format!("Vec<Vec<{}>>", stringify!($t)).into(),
218-
// })),
219-
// }).collect()
220-
// },
221-
// _ => Err(Error::FromSql(FromSqlError::InvalidType {
222-
// src: SqlType::from(value.clone()).to_string(),
223-
// dst: "Vec<Vec<_>>".into(),
224-
// })),
225-
// }
226-
// }
227-
// }
228-
// )*
229-
230-
// };
231-
// }
232178
macro_rules! from_sql_vec_impl {
179+
// Base case: Vec<T>
233180
(
234181
$($t:ty: $k:pat => $f:expr),*
235182
) => {
@@ -256,7 +203,7 @@ macro_rules! from_sql_vec_impl {
256203
}
257204
}
258205
}
259-
206+
// Recursive case: Vec<Vec<T>>
260207
impl<'a> FromSql<'a> for Vec<Vec<$t>> {
261208
fn from_sql(value: ValueRef<'a>) -> FromSqlResult<Self> {
262209
match value {

0 commit comments

Comments
 (0)