@@ -175,61 +175,8 @@ impl<'a> FromSql<'a> for uuid::Uuid {
175
175
}
176
176
}
177
177
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
- // }
232
178
macro_rules! from_sql_vec_impl {
179
+ // Base case: Vec<T>
233
180
(
234
181
$( $t: ty: $k: pat => $f: expr) ,*
235
182
) => {
@@ -256,7 +203,7 @@ macro_rules! from_sql_vec_impl {
256
203
}
257
204
}
258
205
}
259
-
206
+ // Recursive case: Vec<Vec<T>>
260
207
impl <' a> FromSql <' a> for Vec <Vec <$t>> {
261
208
fn from_sql( value: ValueRef <' a>) -> FromSqlResult <Self > {
262
209
match value {
0 commit comments