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

Function try_parse

nodedb-sql/src/ddl_ast/parse/tenant.rs:21–31  ·  view source on GitHub ↗

Try to parse a tenant DDL statement from the upper-cased token slice. Returns `None` if the statement is not a recognized tenant DDL form. Returns `Some(Err(...))` on a syntax error in an otherwise-recognized form.

(
    upper: &str,
    parts: &[&str],
    original: &str,
)

Source from the content-addressed store, hash-verified

19/// Returns `None` if the statement is not a recognized tenant DDL form.
20/// Returns `Some(Err(...))` on a syntax error in an otherwise-recognized form.
21pub(super) fn try_parse(
22 upper: &str,
23 parts: &[&str],
24 original: &str,
25) -> Option<Result<NodedbStatement, SqlError>> {
26 match parts.first().map(|s| s.to_uppercase()).as_deref() {
27 Some("ALTER") => try_parse_alter_tenant(upper, parts, original),
28 Some("SHOW") => try_parse_show_tenant(parts),
29 _ => None,
30 }
31}
32
33// ── ALTER TENANT ──────────────────────────────────────────────────────────────
34

Callers 1

parseFunction · 0.70

Calls 3

try_parse_alter_tenantFunction · 0.85
try_parse_show_tenantFunction · 0.85
firstMethod · 0.80

Tested by

no test coverage detected