Returns the name of a column if it has been given a name already, or generates a new name for it and registers it in the AnchorContext's column_names HashMap.
(&mut self, cid: CId)
| 173 | /// Returns the name of a column if it has been given a name already, or generates |
| 174 | /// a new name for it and registers it in the AnchorContext's column_names HashMap. |
| 175 | pub(crate) fn ensure_column_name(&mut self, cid: CId) -> Option<&String> { |
| 176 | // don't name wildcards & named RelationColumns |
| 177 | let decl = &self.column_decls[&cid]; |
| 178 | if let ColumnDecl::RelationColumn(_, _, col) = decl { |
| 179 | match col { |
| 180 | RelationColumn::Single(Some(name)) => { |
| 181 | let entry = self.column_names.entry(cid); |
| 182 | return Some(entry.or_insert_with(|| name.clone())); |
| 183 | } |
| 184 | RelationColumn::Wildcard => return None, |
| 185 | _ => {} |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | let entry = self.column_names.entry(cid); |
| 190 | Some(entry.or_insert_with(|| self.col_name.gen())) |
| 191 | } |
| 192 | |
| 193 | pub(super) fn load_names( |
| 194 | &mut self, |
no test coverage detected