Parse a `{ key: value, ... }` object literal into a field map. Returns `None` if the input doesn't start with `{` (not an object literal). Returns `Some(Err(msg))` on parse errors (malformed object literal). Returns `Some(Ok(fields))` on success.
(s: &str)
| 14 | /// Returns `Some(Err(msg))` on parse errors (malformed object literal). |
| 15 | /// Returns `Some(Ok(fields))` on success. |
| 16 | pub fn parse_object_literal(s: &str) -> Option<Result<HashMap<String, Value>, SqlError>> { |
| 17 | let trimmed = s.trim(); |
| 18 | if !trimmed.starts_with('{') { |
| 19 | return None; |
| 20 | } |
| 21 | let chars: Vec<char> = trimmed.chars().collect(); |
| 22 | let mut pos = 0; |
| 23 | Some(parse_object(&chars, &mut pos)) |
| 24 | } |
| 25 | |
| 26 | /// Parse `[{ ... }, { ... }]` — an array of object literals for batch insert. |
| 27 | /// |