-
Notifications
You must be signed in to change notification settings - Fork 667
make parse_expr_with_alias
public
#1444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10289,8 +10289,21 @@ impl<'a> Parser<'a> { | |
|
||
Ok(ExprWithAlias { expr, alias }) | ||
} | ||
/// return new expression with alias | ||
/// | ||
/// Example | ||
/// ``` | ||
/// # use sqlparser::parser::{Parser, ParserError}; | ||
/// # use sqlparser::dialect::GenericDialect; | ||
/// # fn main() ->Result<(), ParserError> { | ||
/// let sql = r#"SUM("a") as "b""#; | ||
/// let mut parser = Parser::new(&GenericDialect).try_with_sql(sql)?; | ||
/// let expr_with_alias = parser.parse_expr_with_alias()?; | ||
/// assert_eq!(Some("b".to_string()), expr_with_alias.alias.map(|x|x.value)); | ||
/// # Ok(()) | ||
/// # } | ||
|
||
fn parse_expr_with_alias(&mut self) -> Result<ExprWithAlias, ParserError> { | ||
pub fn parse_expr_with_alias(&mut self) -> Result<ExprWithAlias, ParserError> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please also add some documentation to this function (perhaps with an example or two) now that it will become part of the public API? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for missing that piece of document, I have updated it. |
||
let expr = self.parse_expr()?; | ||
let alias = if self.parse_keyword(Keyword::AS) { | ||
Some(self.parse_identifier(false)?) | ||
|
Uh oh!
There was an error while loading. Please reload this page.