Build a [`RelationDesc`] from column specs.
(columns: &[ColumnSpec])
| 205 | |
| 206 | /// Build a [`RelationDesc`] from column specs. |
| 207 | fn relation_desc(columns: &[ColumnSpec]) -> anyhow::Result<RelationDesc> { |
| 208 | let mut builder = RelationDesc::builder(); |
| 209 | for col in columns { |
| 210 | builder = builder.with_column( |
| 211 | col.name.as_str(), |
| 212 | SqlColumnType { |
| 213 | scalar_type: scalar_type_from_str(&col.ty)?, |
| 214 | nullable: col.nullable, |
| 215 | }, |
| 216 | ); |
| 217 | } |
| 218 | Ok(builder.finish()) |
| 219 | } |
| 220 | |
| 221 | /// Strip surrounding double quotes from a token, if present. |
| 222 | fn unquote(s: &str) -> &str { |
no test coverage detected