MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / extract_string_literal_arg

Function extract_string_literal_arg

nodedb-sql/src/resolver/columns.rs:318–335  ·  view source on GitHub ↗
(arg: &sqlparser::ast::FunctionArg)

Source from the content-addressed store, hash-verified

316}
317
318fn extract_string_literal_arg(arg: &sqlparser::ast::FunctionArg) -> Option<String> {
319 use sqlparser::ast::{Expr, FunctionArg, FunctionArgExpr, Value};
320 let expr = match arg {
321 FunctionArg::Unnamed(FunctionArgExpr::Expr(e)) => e,
322 FunctionArg::Named {
323 arg: FunctionArgExpr::Expr(e),
324 ..
325 } => e,
326 _ => return None,
327 };
328 match expr {
329 Expr::Value(v) => match &v.value {
330 Value::SingleQuotedString(s) => Some(s.clone()),
331 _ => None,
332 },
333 _ => None,
334 }
335}
336
337#[cfg(test)]
338mod tests {

Callers 1

resolve_array_tvfFunction · 0.85

Calls 1

cloneMethod · 0.45

Tested by

no test coverage detected