MCPcopy Create free account
hub / github.com/PRQL/prql / translate_ident_part

Function translate_ident_part

prqlc/prqlc/src/sql/gen_expr.rs:954–968  ·  view source on GitHub ↗
(ident: String, ctx: &Context)

Source from the content-addressed store, hash-verified

952}
953
954pub(super) fn translate_ident_part(ident: String, ctx: &Context) -> sql_ast::Ident {
955 let is_bare = valid_ident().is_match(&ident);
956 match ctx.dialect.ident_quoting_style() {
957 IdentQuotingStyle::ConditionallyQuoted => {
958 if is_bare && !keywords::is_keyword(&ident, &ctx.dialect_enum) {
959 sql_ast::Ident::new(ident)
960 } else {
961 sql_ast::Ident::with_quote(ctx.dialect.ident_quote(), ident)
962 }
963 }
964 IdentQuotingStyle::AlwaysQuoted => {
965 sql_ast::Ident::with_quote(ctx.dialect.ident_quote(), ident)
966 }
967 }
968}
969
970pub(super) fn translate_operand(
971 expr: rq::Expr,

Callers 5

translate_select_itemFunction · 0.85
translate_identFunction · 0.85
translate_table_aliasFunction · 0.85
translate_excludeFunction · 0.85

Calls 4

valid_identFunction · 0.85
is_keywordFunction · 0.85
ident_quoting_styleMethod · 0.45
ident_quoteMethod · 0.45

Tested by

no test coverage detected