[][src]Function postgres_parser::join_name_list

pub fn join_name_list(list_of_names: &Node) -> Result<String, PgParserError>

A common pattern in Postgres' parse trees, when it needs to represent the name of a thing (a table, a field, a view, etc), especially when that name can be qualified, is to represent that name as a List of string Values.

This is a helper function to join these qualified name Lists together into a single Rust string.

It's expected that the list_of_names argument be a postgres_parser::Node::List variant, where each of its contained members is a postgres_parser::Node::Value where its string member is_some().

If all these conditions are true, the result will be a dot-delimited string of each part of the List of names (Ok("the.qualified.name")).

If not, the result will either be Err(PgParserError::NotAList) or Err(PgParserError::NotAString).